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 it in better detail.

To begin, a script in NeatBot is just a command to tell the bot to do something "now" as opposed to goals which tell the bot to "work towards this finish line". A script can be as simple as:

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:

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:

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:

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. 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 is driving directions. You also see an IfGoto line. This is exactly the same thing as goto, except it checks something first. Line 2 above reads something like this: "if (this stuff is true) goto 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).

Now.. that big ole m_city.cityManager.troop.scouter thing probably looks pretty scary doesn't it? That's ok, it does to me too. Maybe after I write 10 more wiki's and use the bot another 2 years I'll memorize a couple of them. Until then, I'll use the Variables page like you should too. All those things 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 list like I do.

Ok so, you now know how to write a simple script and even one with complicated references and conditional statements 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.


CategoryHowTo

Scr1ptingForDummies (last edited 2012-09-18 16:27:21 by Inanna)