1059
Comment:
|
4735
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
*** WORK IN PROGRESS *** | 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. |
Line 3: | Line 3: |
All of this 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. To begin, a script in !NeatBot is just a command to tell the bot do to "now" as opposed to goals which tell the bot to "work towards this finish line". A script can be as simple as: |
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: |
Line 11: | Line 9: |
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: | 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: |
Line 18: | Line 16: |
Now let's say you want to plan this attack with your buddy, so you want the bot to wait till a certain 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: | 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: |
Line 21: | Line 19: |
sleep @10:00:00 | sleep @:10:00:00 |
Line 25: | Line 23: |
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 ( m_city.cityManager.troop.scouter >= 1000000 ) 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. goto done // 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! 10. goto done // Here is label done, you'll go here after sending the attacks or whispering your buddy. // Label done doesn't actually do anything, we just don't want the script to keep going from line 6 (the repeat 8 line) into label warnbuddy, which it will do if we don't stop it elsewhere. 11. label done }}} 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 |
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:
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 ( m_city.cityManager.troop.scouter >= 1000000 ) 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. goto done // 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! 10. goto done // Here is label done, you'll go here after sending the attacks or whispering your buddy. // Label done doesn't actually do anything, we just don't want the script to keep going from line 6 (the repeat 8 line) into label warnbuddy, which it will do if we don't stop it elsewhere. 11. label done
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.