Size: 2158
Comment:
|
Size: 3341
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 16: | Line 16: |
The results returned from these commands will be stored in $result, which you can echo or set to a variable or process with the various functions in the bot. For example: | 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: |
Line 22: | Line 24: |
Echos: 16:17:10 (Wrindel) - Page: 1/53 [42957]ATT Attack Reports from City1(111,111) to Target(111,333) on Sun Nov 17 2013 01:15:10 PM [42914]ATT Scout Reports from City2(111,222) to Barbarian's city(111,444) on Sun Nov 17 2013 01:01:28 PM [42905]ATT Scout Reports from City2(111,222) to Barbarian's city(111,455) on Sun Nov 17 2013 12:57:48 PM [42898]ATT Scout Reports from City2(111,222) to Barbarian's city(111,466) on Sun Nov 17 2013 12:54:09 PM [42891]ATT Scout Reports from City2(111,222) to Barbarian's city(111,477) on Sun Nov 17 2013 12:48:58 PM [42885]ATT Scout Reports from City2(111,222) to Barbarian's city(111,488) on Sun Nov 17 2013 12:45:15 PM |
Echoes: 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 |
Line 32: | Line 34: |
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' //------------------------------ // NO USER ENTRY BELOW //------------------------------ 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)) i=0 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" }}} |
Usage: |
command "command [parameters]" |
Example: |
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
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 Echoes: 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' //------------------------------ // NO USER ENTRY BELOW //------------------------------ 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)) i=0 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"