• 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 1 and 10 (spanning 9 versions)
    Revision 1 as of 2012-09-05 13:17:56
    Size: 908
    Editor: Inanna
    Comment:
    Revision 10 as of 2013-08-06 17:38:02
    Size: 2097
    Editor: Inanna
    Comment:
    Deletions are marked like this. Additions are marked like this.
    Line 1: Line 1:
    ||<tablebgcolor="#F9F9F9" tablestyle="margin:1em 1em 1em 0px;border-style:solid;border-color:rgb(170, 170, 170);color:rgb(0, 0, 0);font-family:sans-serif;font-size:13px;line-height:19.5px;text-align:start;" tableclass="wikitable"#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">Usage: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">goto label ||
    ||<#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">Example: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">goto upgradecot ||
    ## page was renamed from GoTo
    ||<tablebgcolor="#F9F9F9" tablestyle="margin:1em 1em 1em 0px;border-style:solid;border-color:rgb(170, 170, 170);color:rgb(0, 0, 0);font-family:sans-serif;font-size:13px;line-height:19.5px;text-align:start;  " tableclass="wikitable"#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;  ">Usage: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">goto label ||
    ||<#F2F2F2 style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;  ">Example: ||<style="border-style:solid;border-color:rgb(170, 170, 170);padding:0.2em;">goto thirdLabel ||
    Line 5: Line 6:
    Allows you to jump to any label, anywhere in the script. Allows you to jump to any label, anywhere in the script and then continue on down the script line by line as normal (or until it reaches another command to force it to jump elsewhere again).

    In the following example, the bot will read the first line and echo the first message following it, then jump to the third label and echo that message, then jump to the second label and echo that message twice, and then for lack of another jump it will continue down the script to the third label again, echo that message, then jump back to the second label again... thus entering an endless loop of the second and third labels.
    Line 8: Line 11:
    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
    label firstLabel
    1: echo "This is label 1's stuff"
    2: goto thirdLabel
    label secondLabel
    3: echo "This is label 2's stuff"
    4: repeat 2
    label thirdLabel
    5: echo "This is label 3's stuff"
    6: 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)
    Line 20: Line 43:
    CategoryAllScripts CategoryFunctionScripts ----
    ScriptControlStructures

    Usage:

    goto label

    Example:

    goto thirdLabel

    Allows you to jump to any label, anywhere in the script and then continue on down the script line by line as normal (or until it reaches another command to force it to jump elsewhere again).

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

    • label firstLabel
      1: echo "This is label 1's stuff"
      2: goto thirdLabel
      label secondLabel
      3: echo "This is label 2's stuff"
      4: repeat 2
      label thirdLabel
      5: echo "This is label 3's stuff"
      6: 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)



    ScriptControlStructures

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