• 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 "Gosub"
    Differences between revisions 11 and 12
    Revision 11 as of 2012-10-24 20:30:31
    Size: 1573
    Editor: Romulus
    Comment:
    Revision 12 as of 2012-10-24 20:31:07
    Size: 1575
    Editor: Romulus
    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;">gosub 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;">gosub medalfarm ||
    ||<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;">gosub 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;">gosub medalfarm ||
    Line 30: Line 30:
    Do not forget to add the GosubReturn at the end of each subroutine to avoid errors. Do not forget to add the [[Return]] at the end of each subroutine to avoid errors.

    Usage:

    gosub label

    Example:

    gosub medalfarm

    Allows you to jump to a subroutine, perform the actions there, and then return to continue to the next scripted line.

    In the following example, the bot will read line 1, jump to label medalfarm, perform the attack there, return to the original place and read line 2, jump to label trainarch, queue up the archers, return to the original place and read line 3, jump to label upgradecot, upgrade the cottage twice, return to the original place and read line 4, sleep 30 seconds, and then loop back to line 1 where it will begin the process again with label medalfarm.

    • gosub medalfarm
      gosub trainarch
      gosub upgradecot
      sleep 30
      loop 0
      
      label medalfarm
      attack 123,300 !Bubba,!Xavier,any t:400,b:400
      return
      
      label upgradecot
      upgrade house
      repeat 2
      return
      
      label trainarch
      train arch:2500 Hero
      return

    Do not forget to add the Return at the end of each subroutine to avoid errors.



    ScriptControlStructures

    Gosub (last edited 2012-10-24 20:31:07 by Romulus)