• 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


    command "command [parameters]"


    command "invite NewDude"

    This script will allow you to utilize the in-line commands in the scripting window. The in-line command plus all arguments for it should be encased in quotation marks. In the example above, instead of typing \invite NewDude in the commands window, you could use it via script with the line command "invite NewDude".

    You can mix variables into the command script, exclude them from the quotes as you would any other expression. For example:

    var = "SomeDude"
    command "who " + var

    Don't let the +s and "s throw you off. They're not as complicated as they look. Try it in color:

    You can find a list of all the In-Line Commands here: InLineCommands.

    If the command succeeds, the results returned will be stored in $result, which you can echo or set to a variable or process with the various functions in the bot. If the command fails for some reason, it will return the results in $error.

    Simple example using Command and $result:

    command "quickarmyreport"
    echo $result
    16:17:10 Page: 1/53
    [42666]ATT Attack Reports from City1(111,111) to Target(111,333) on Sun Nov 17 2013 01:15:10 PM
    [42555]ATT Scout Reports from City2(111,222) to Barbarian's city(111,444) on Sun Nov 17 2013 01:01:28 PM
    [42444]ATT Scout Reports from City2(111,222) to Barbarian's city(111,455) on Sun Nov 17 2013 12:57:48 PM
    [42333]ATT Scout Reports from City2(111,222) to Barbarian's city(111,466) on Sun Nov 17 2013 12:54:09 PM
    [42222]ATT Scout Reports from City2(111,222) to Barbarian's city(111,477) on Sun Nov 17 2013 12:48:58 PM
    [42111]ATT Scout Reports from City2(111,222) to Barbarian's city(111,488) on Sun Nov 17 2013 12:45:15 PM

    Here's another, more complicated example of using both $error and $result along with Command. This will find and attack all inactive (0 population/1 city) accounts around you. Script is written by jay777:

    distance = 20
    troops = 'c:1k,s:1k'
    heroes = 'any:level<200'
    execute "scanrec "+(city.x-distance)+","+(city.y-distance)+" "+(city.x+distance)+","+(city.y+distance)
    castles = AllCastles(GetFieldId(city.x - distance, city.y - distance), GetFieldId(city.x + distance, city.y + distance))
    label next
    @command "who " + castles[i].userName
    if $error goto next
    if $result.split(',')[2].split(" ")[2] = 1 if $result.split(',')[8].split(" ")[2] = 0 echo "Found " + castles[i].userName + " at " + FieldIdToCoords(castles[i].id)
    if $result.split(',')[2].split(" ")[2] = 1 if $result.split(',')[8].split(" ")[2] = 0 execute "attack " + FieldIdToCoords(castles[i].id) + " " + heroes + " " + troops
    i = i + 1
    if i < castles.length goto next
    echo "All done"


    Command (last edited 2014-06-30 20:39:22 by Inanna)