• My Pages
  • Comments
  • Add Link
  • Subscribe
  • Subscribe User
  • Edit (Text)
  • Rename Page
  • Copy Page
  • Load Page
  • Save Page
  • Delete Page
  • Attachments
  • Check Spelling
  • Diffs
  • Info
  • Revert to this revision
  • XML
  • Render as Docbook
  • Print View
  • Raw Text
  • Delete Cache
  • Like Pages
  • Local Site Map
  • Remove Spam
  • Package Pages
  • Sync Pages

    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.

    • 1: ifgoto ( m_context.Player.playerInfo.sex == 1 ) imaGirl
      2: ifgoto ( m_context.Player.playerInfo.sex == 0 ) imaGuy
      3: goto imNotSure
      
      4: label imaGirl
      5: echo "Girls rule and guys drool!"
      6: stop
      
      7: label imaGuy
      8: echo "Ugh, I don't care, just fetch me a beer!"
      9: stop
      
      10: label imNotSure
      11: echo "er? I shouldn't be here, I think the surgery went wrong!"
      12: stop



    ScriptControlStructures ScriptDeprecated

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