Usage:

ifgoto ( reference {operator} value ) label

Example:

ifgoto ( m_city.cityManager.resource.stone.amount > 250000 ) CheckATT

Like it's counterpart Goto, IfGoto allows you to jump to another line elsewhere in the script. The difference is that this one allows you to check a conditional statement before deciding whether to jump to the new script label, or move on to the next line instead.

Using References, this script command allows you powerful access to manage your account, cities, heroes, and armies with precision.

In the following example, we check first line if your account is female. If it is, it will jump to label imaGirl. If it is not it will check if your account is male. If it is, it will jump to label imaGuy. In theory, you will never get past these 2 lines because all accounts are one or the other, but for the sake of humor I have also included a third line that will goto label imNotSure should the 1st two lines fail.

Once at label imaGirl or imaGuy, it will print a message to your bot's log window and then jump to label TheEnd. As with regular Goto, once the bot has jumped to a new line, it continues line by line down the script. I've prevented the bot from continuing with the lines below it in this script by creating an empty "dead end" label at the bottom of the script. Each label will go there, have nothing else to do, and thus the script will end.



ScriptControlStructures ScriptDeprecated

IfGoto (last edited 2015-09-02 12:44:54 by Romulus)