ConvOrder Help

Table of contents

What are orders?

In Warcraft 3, you use orders when you want to check what a unit is doing, or want it to do something.
You can use orders in two different forms:

Order Strings:
Orderstrings are the easy way of using orders. They are logic strings that are easy to remember..
So why not just use them?
The thing is, that everytime you use an order strings you are making it easier for yourself, but just because it is easier for you it is not better.
Whenever you use an orderstring WarCraft III will automatically convert it into an orderid, which takes some time and therefore makes the map script slower.
An ability's orderstring can be seen in the object editor, note that changing it here does only change the field and not the orderstring of the spell, so changing this has no effect.

The good thing with orderstrings are that they are easier to remember and look up than orderids.
Example of an orderstring: "lavamonster".

Order Ids:
An orderid is an integer value that is used in the same situation as you would use an orderstring in.
The difference is, that order ids are direct and therefore faster, but also harder to remember.
There are also certain things that can only be done with orderids.

The disadvantage with orderids is that they are almost impossible to remember, and looking them up takes some time. That is why this program is useful.
Example of an orderid: 852667.

What does this program do?

It converts orderids to strings and orderstrings to ids.
It is very simple to use, and also very fast.

Screenshot of the ConvOrder program.

To use the program, simply open the ConvOrder.exe file and write the value you want to convert in the box.
When you click on the button it will automatically detect if you have entered an orderstring or an orderid and convert it to the opposite.
If you do something wrong, it will come up with an error message explaining the problem.
If you do it right, you can press the button to copy the text to the clipboard, so you can paste it into the Trigger Editor or a third party Jass Editor.

If you click on the button, a window with credits and contact information will pop up.

How do I use orderids in a script?

Using orderids instead of orderstrings in a script is simple.
All natives used for issuing orders that uses strings exists in a version that uses an order id instead.
All the orderid using versions of the orderstring-using natives uses the same name as the orderstring-using natives +"ById". The string argument which is the orderstring is always replaced by an integer argument, which is the orderid.

Example:

    call IssueImmediateOrder(whichUnit, "thunderclap")
Should be replaced with:
    call IssueImmediateOrderById(whichUnit, 852096)
The second line of code does exactly the same as the first, except that it uses an orderid instead of an orderstring.
That makes it faster, but as already said, orderids are harder to remember and look up, so that is what you should use this program for.
Using orderids can also save you some time when you want to compare orders, for example when a unit is issued an order or when you want to know what the current order of a unit is. In both situations the natives you will have to use for that are returning orderids, and by comparing the returned id to another id directly instead of having to convert a string using the OrderId native or similiar, your script will run faster.

It is not only useful when you are writing a Jass script, but also when you are reading a script that uses orders, if you want to understand what exactly the script does.

How do I use orderids to detect special orders?

While all orderstrings have an id representation, not all orderids have a string representation.
Because of this, there are several things that you can do using orderids that you can not do using orderstrings.
Those things has not really got anything to do with this program, but I will list some of the things you can do with orderids here.

Detecting when an item is dragged to another slot using orderids
Detecting when an item is dragged to another slot in a unit's inventory is very simple.
Simply use the EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER event (called "Unit - A unit Is issued an order targeting an object" in the GUI, although I recommend you to use Jass instead) to detect when a unit is issued an order targeting an object.

Now use GetIssuedOrderId to check if it was an item that was dragged to another inventory slot. If that is the case, GetIssuedOrderId will return a number between 852002 and 852007.
The returned integer will be 852002+the number of the slot (starting from 0) the item was dragged to, so you can also easily check which slot the item was dragged to.

Slot numbers:

0

1

2

3

4

5


Detecting when a unit is ordered to use an item
This is, like detecting drag and drog, very simple.
Simply make a trigger that checks for all three order events, and make a comparison using GetIssuedOrderId.
This is basically the same as with drag and drop detection, the returned integer should be between 852008 and 852013. Like before, you can easily check which slot the used item was in, as the returned integer will be 852008+number of the slot the item is in.
This is a good thing, as it is the best, and to my knowledge also the only, method for detecting when a unit is going to use an item before it is used, so you can detect it and eventually stop it.

Detecting when a unit is ordered to learn a spell, research an upgrade, build a strucutre, upgrade itself et cetera
This is very simple. Simply use the correct event, and the value returned by GetIssuedOrderId will be the "rawcode" of the object.
Something interesting is, that the orderids returned by GetIssuedOrderId when any of these events happens will NOT start with 85, unlike other orderids.

Final notes

I hope that you have learned something, and that you will find the program and this document useful.

If you have any questions, post them at Wc3Campaigns or send an email to me at Blade.dk@gmail.com.