How to use a reference 101

All references are based on the following format

( reference {operator} value )

every valid reference will return a value in the log tab if preceeded by print.

If you try to grab a reference that does not exist it will give a 1069 error. An example is trying to print the heroname from marching army number 6 when you have only got 5 armies marching.

e.g

print m_context.sellPrice(0) will show you the current price of food To make it easier on the eyes you can add a comment on what it is in front

e.g

print food is now sold for ( m_context.sellPrice(0) )

To use this reference in a script you need a comparable, an ifgoto or an ifgosub command and a label to go to.

e.g.

ifgoto ( m_context.sellPrice(0) < 5 ) buyfood

That will tell the bot to find a label named buyfood if the price of food is less than 5

Next step is tieing the two parts together

1: label checkfoodprice 2: ifgoto ( m_context.sellPrice(0) < 5 ) buyfood 3: loop

4: label buyfood 5: buy food 9999999 5 6: goto checkfoodprice

A simple script like that will keep checking the price of food and post a bid every time it drops below 5

References-Kento11 (last edited 2012-10-01 16:52:23 by Kento11)