• My Pages
  • Comments
  • Add Link
  • Subscribe
  • Subscribe User
  • Edit (GUI)
  • 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
    • Diff for "Goto"
    Differences between revisions 2 and 3
    Revision 2 as of 2012-09-05 13:18:25
    Size: 939
    Editor: Inanna
    Comment:
    Revision 3 as of 2012-09-09 20:56:20
    Size: 1964
    Editor: Inanna
    Comment:
    Deletions are marked like this. Additions are marked like this.
    Line 8: Line 8:
     . {{{
    label medalfarm
    attack 123,300 !Bubba,!Xavier,any t:400,b:400
    goto trainarch
    label upgradecot
    upgrade house
    repeat 2
    label trainarch
    train arch:2500 atk
    goto upgradecot
    In the following example, the bot will read the first line and print the first message following it, then jump to the third label and print that message, then jump to the second label and print that message twice, and then for lack of another jump it will continue down the script to the third label again, print that message, then jump back to the second label.. thus entering an endless loop of the second and third label.

     {{{
    1: label firstLabel
    2: print This is label 1's stuff
    3: goto thirdLabel
    4: label secondLabel
    5: print This is label 2's stuff
    6: repeat 2
    7: label thirdLabel
    8: print This is label 3's stuff
    9: goto secondLabel
    Line 20: Line 22:
    This produces the following results in the bot:
     {{{
    16:53:21 This is label 1's stuff
    16:53:25 This is label 3's stuff
    16:53:29 This is label 2's stuff
    16:53:33 This is label 2's stuff
    16:53:39 This is label 3's stuff
    16:53:41 This is label 2's stuff
    16:53:43 This is label 2's stuff
    16:53:46 This is label 3's stuff
    16:53:48 This is label 2's stuff
    16:53:50 This is label 2's stuff
    16:53:53 This is label 3's stuff
    16:53:55 This is label 2's stuff
    16:53:57 This is label 2's stuff
    16:54:00 This is label 3's stuff
    (etc. etc. forever)
    }}}

    Usage:

    goto label

    Example:

    goto upgradecot

    Allows you to jump to any label, anywhere in the script.

    In the following example, the bot will read the first line and print the first message following it, then jump to the third label and print that message, then jump to the second label and print that message twice, and then for lack of another jump it will continue down the script to the third label again, print that message, then jump back to the second label.. thus entering an endless loop of the second and third label.

    • 1: label firstLabel
      2: print This is label 1's stuff
      3: goto thirdLabel
      4: label secondLabel
      5: print This is label 2's stuff
      6: repeat 2
      7: label thirdLabel
      8: print This is label 3's stuff
      9: goto secondLabel

    This produces the following results in the bot:

    • 16:53:21 This is label 1's stuff
      16:53:25 This is label 3's stuff
      16:53:29 This is label 2's stuff
      16:53:33 This is label 2's stuff
      16:53:39 This is label 3's stuff
      16:53:41 This is label 2's stuff
      16:53:43 This is label 2's stuff
      16:53:46 This is label 3's stuff
      16:53:48 This is label 2's stuff
      16:53:50 This is label 2's stuff
      16:53:53 This is label 3's stuff
      16:53:55 This is label 2's stuff
      16:53:57 This is label 2's stuff
      16:54:00 This is label 3's stuff
      (etc. etc. forever)


    CategoryAllScripts CategoryFunctionScripts

    Goto (last edited 2013-08-06 17:38:02 by Inanna)