These are the various built-in command categories used with NeatBot's scripting language.
Basics of Scripting
Scripting allows you to enter commands to the bot that will be performed immediately line by line, as opposed to goals which are gradually worked towards. For instance, the directive troop a:5000 in the goals window tells the bot to build archers until you have 5000 then move to the next goal. If you already have 5000 or more archers, it is disregarded. The script command train a:5000 will immediately queue 5000 archers in your barracks regardless of how many you have already, provided of course you have the population and resources needed.
The Script window is similar to the Goals window, and is found by selecting the Script tab on the upper left hand window. There are 10 individual script 'saves' per city, allowing you to build up to 10 command sets per city, that will be saved (provided you select the save button) along with your goals. Each script save is selected by way of the Load button. Scripts are executed from the top down, beginning at the line number specified in the Run box. If no number is entered, or the number is greater than the number of lines in the script, you can make the script begin at line #1 by checking Always start scripts line 1 in Global Settings.
The commands available give you the ability to perform all of the the same functions the bot works towards in the goals window, as well as add to or alter those goals. Any goal can be used in the script window, for example "config npc:5" typed in the script window will set your bot to farm npcs up to lvl 5 just as it would in the goals window. Note that goals modified or added in the script window will not be reflected in the goals window, or saved with them. Scripts, however, give you the ability to do so much more than goals are capable of.
All of the following can be found individually in the various script description pages, but for those that need it more in a flowing.. do this.. then that.. then some of this.. layout, this page is for you. Note that the text in blue are links to the script command page to explain that particular script command in better detail.
To begin, a script can be as simple as:
attack 111,222 any,!Goliath s:100k
This tells the bot to Attack 111,222 with any hero other than Goliath using 100k scouts. But let's say you want to attack it 8 times. Rather than typing the same line eight times, you can tell it to Repeat 8 times:
attack 111,222 any,!Goliath s:100k repeat 8
Now let's say you want to plan this attack with your buddy, so you want the bot to wait till 10AM your time to begin executing the script. Rather than sitting around waiting to hit start, you could tell the bot to Sleep until a certain time:
sleep @:10:00:00 attack 111,222 any,!Goliath s:100k repeat 8
Of course, in the example above it would be better to use the landing time in the attack line itself so that the scouts arrive at 10 rather than get sent at 10.. but I'm just giving examples of how to use different types of script commands here. Now, let's say you want to make sure you have at least 1mil scouts on hand before your bot suicides 800k of them with your script, but since you won't be home when it launches at 10AM you need the bot to check and warn your buddy if it's not gonna attack. You can do all of this like so:
// First let's wait till it's 10AM before we check or do anything 1: sleep @:10:00:00 // This line is checking to see if you have 1mil+ scouts and if so goes to label scoutem 2: ifgoto ( city.troop.scouter >= 1m ) scoutem // If you didn't go to label scoutem, then this next line will run instead 3: goto warnbuddy // Here is label scoutem, you'll go here if you have 1mil+ scouts 4: label scoutem 5: attack 111,222 any,!Goliath s:100k 6: repeat 8 7: stop // Here is label warnbuddy, you'll go here if you don't have 1mil+ scouts 8: label warnbuddy 9: whisper Buddy I don't have enough scouts, I'm not sending the attacks!
Still with me? Brain explode yet? The //Blah blah blah lines are called Comments. That means I'm just sticking notes for you to read in there. The bot will ignore them completely. The Label lines are just little street signs in the bot to tell it where a certain group or section of lines starts, so that you can tell it to jump to them back and forth as needed. The Whisper line is just that, it whispers buddy your message. You hopefully already know what Attack and Sleep and Repeat are doing. Stop is pretty self-explanitory. It tells the script to stop right there and don't run anymore lines.
Let's discuss the rest...
In the above script you see Goto lines. These tell the bot to jump to a label. Remember I just said labels are like street signs? Well consider the goto command as driving directions. You also see an IfGoto line. This is exactly the same thing as goto, except it checks if something is true first. Line 2 above reads something like this: "if (this stuff is true) then go to thislabelhere", or in this case, if you have at least 1mil scouts, then go to label scoutem. If an IfGoto or IfGosub line are not true, then they're skipped and the bot hops down to the next line. In our example above, if line 2 is not true (you have under 1mil scouts) then it will drop down to line 3 which tells it to go to label warnbuddy (so we can whisper Buddy instead). You can find all these helpful type commands in the Control Structures section.
Now.. that big ole city.troop.scouter thing probably looks pretty scary doesn't it? That's ok, it did to me too for a very long time. Maybe after I write 10 more wiki's and use the bot another 2 years I'll memorize all of them. Until then, I'll use this wiki to find them like you should too. All those things (Objects) do is check something on your account or in your city in a language the bot can understand. You don't have to remember them all, you can reference the wiki like I do.
Ok.. so you have the above script but now Buddy tells you that he wants to do this same thing every day with a different target each day. Normally you would just scroll down and change 111,222 in the coordinates to a new target, but for the sake of teaching you, we're gonna do it using a simple replacement variable. This is just temporary storage for some value, that you can use somewhere else. In this example at the very top of our script we're gonna set it:
set target 111,222
That's all, now "target" is a variable who's value is set to 111,222. Later in the script we can reference it by adding % in front and behind it, like so:
attack %target% any,!Goliath s:100k
Not so brain exploding, right? Replace the 111,222 in your attack line in the example script to %target% and you're all set. Now instead of scrolling down to the attack line each day you change targets, you can change it right up at the top nice and easily. Your bot still reads it as attack 111,222 any,!Goliath s:100k because it replaces %target% with the value as it reads it. The bot can do true variables as well, but since this is an intro to scripting, I won't scare you off with more than necessary
Ok so, you now know how to write a simple script and even one with the more complicated stuff in it. It's up to you to go from here and figure out how to write out that ultimate script you've been longing for.