Botbattle Commands

How to program a bot:


The code of a bot looks like this:
main:

:main

end
A procedure is a piece of code that can be called by name to do stuff.
It starts with the name of the procedure followed by ":". To exit the procedure you use the keyword "return".
saycool:
say This is cool!
return
The "main:" procedure is a special one. It ends in ":main" and gets called repeatedly until the bot is dead.
You don't need to call main, you call other procedures from within main or other procedures.
main:
saycool
:main
The "end" keyword ends the entire botcode. While you can write stuff after "end", it will not be taken into consideration.

"If" blocks:


If you want to succesfully write a bot program, you must know how to use "if" blocks, or decisional blocks.
Basically, an if block tells the bot to do one thing or another depending on a certain condition.
An "if" block looks like this:
if
condition
do stuff
elseif
condition2
do something else
else
do whatever
endif
Complex conditions can be created from simple ones by using the "not","or","xor","and" keywords, like this:
if
abot too close
or
not
abot health low
set direction away from abot
endif
Remember that the "not" keyword applies to the simple condition that follows, while the "or","xor","and" operators are applied from bottom up.
condition1
or
condition2
and
condition3
means condition1 or (condition2 and condition 3)
If blocks can be "nested", or in other words, you can use one if inside another, without problems.

Commands:


Commands are really easy to understand, they are almost in English. Stuff like "set direction to powerup", which moves the bot to the powerup.
Here is a list of basic commands and conditions. With them you can create a wide variety of bots. There are a lot more commands. Learn the basic ones, then get to the rest of them.
Good luck!

NEW stuff:

The plasma burst now repells less than the repeller
The flamethrower does only 2 damage to unshielded bots, but sets them on fire
The deimos bolts are very slowly moving towards the set target
The attractor, repeller and plasma burst push and pull can be countered by the bot engine. If you move towards an attractor, you will move very fast, move away from it and you will be pulled slowly towards it.
The gauss gun is now harder to reload when:
    - being shot at
    - using some other item
"match abots speed" now tries to match the actual speed of the bot and works sharper, but it doesn't do anything if abot is cloaked or camoed
Added the pv variables. They work just like the v variables, but they are public (readable by other bots).
You can now display v and pv variables inside the say command using $v1-9 or $pv1-9. ex: say My health is $v1
Changed the way interpreted commands are computed.
Added "zone" and "abot zone" to assignable variables. Ex: "set v1 to zone".
Camoarmor bots are now visible in the moment someone hits or bumps them.
The gauss takes 2 botseconds to charge (before firing) and fires less precise when the target is moving fast enough.
The turbo now makes your bot faster with 4!! and it lasts longer, too.

NEW commands:

i am (not) in flames - tests if your bot is in flames (from flamethrower)
abot (not) in flames - tests if abot is in flames (from flamethrower)
if / target moves left,right,up,down
if / target, abot, bullet, powerup ul,dl,ur,dr
if / target, abot, bullet moves ul,dl,ur,dr
set v1-9 to distance to target
set v1-9 to distance to abot
set v1-9 to distance to powerup
set v1-9 to zone
set v1-9 to abot zone
set v1-9 to abot pv1-9
set abot to highest health,energy,ammo bot
set abot to lowest rating bot
set abot to highest rating bot
set abot to farthest bot
set abot to bot number X - sets abot to bot with index X. (1 top-left, 4 bottom-right)
if / got target - checks if the target was aquired or not (due to cloak or camoarmor)
clear got target - clears the got target flag. use it before targeting.
set auto to on (special variable affecting shield and p90)
- the shield (not deflector) will auto fire just before being hit.
- the p90 will fire twice as far and accurate, but has only 25% chances of firing.
set auto to off
set v1-9 to index - sets the v or pv variable to the index of your bot (a number between 1 and 4)
set v1-9 to abot index
if / target, bullet, abot moves towards me - if the object in question if moving in your general direction
if / closest wall is left, right, top, bottom - checks which wall is closest to you
if / abots closest wall is left, right, top, bottom - checks which wall is closest to abot

Basic commands:

set direction to ... (abot, target, powerup, center)
set direction away from ... (abot, target)
move ... (random, left, right, down, up, ul, ur, dl, dr)
set abot to ... (closest bot, random bot, lowest health bot, lowest energy bot, lowest ammo bot)
set leading to ... (on, off)
set target to ... (abot, powerup, bullet, zone 1-9, center, random position)
fire... (item1, item2, item3, item4)

Basic conditions (if...):

abot... (too close, sector range, close range, medium range, long range)
target... (too close, sector range, close range, medium range, long range)
bullet... (too close, sector range, close range, medium range, long range)
powerup ... (on, off)
health... (empty, low, ok, full)
energy... (empty, low, ok, full)
ammo... (empty, low, ok, full)
abot health, energy,ammo... (empty, low, ok, full)
i have more,less health, energy, ammo than abot
i am (not) closest to powerup
abot (not) closest to powerup
powerup is health, ammo, energy

Values:

In the descriptions of some commands you will see something like [value].
That means it can be replaced with any integer (non-zecimal) number or a special string that gets translated into a number.
These are the strings that can be used as values:
- random - a random number between 1 and 10
- random7 - a random number between 1 and 7
- random9 - a random number between 1 and 9
- random100 - a random number between 1 and 100
- state - the state variable
- v1-9 - one of the v1, v2..., v9
- timer - the game timer
- health - your bots health
- energy - your bots energy
- ammo - your bots ammo
- speed - your bots maximum speed
- abot health - abots health
- abot energy - abots energy
- abot ammo - abots ammo
- abot speed - abots maximum speed

Full list of commands:


SPECIAL COMMANDS:
return - ends the current procedure and all the if blocks opened in that procedure and returns to the point in which the procedure was called.
return from [value] - returns from [value] procedures simultaneously


MOVEMENT COMMANDS:
move - obsolete command - does nothing
move faster - maximum speed at current direction
move left - moves your bot left
move right - moves your bot right
move up - moves your bot up
move down - moves your bot down
move ul - move bot up & left
move ur - move bot up & right
move dl - move bot down & left
move dr - move bot down & right
move random - Set direction to a random direction
move target - Sets direction to target
move center - Sets direction to center (same as "set direction to zone 5")
match abots speed - set your speed to match that of abots
stop moving
set direction to target
set direction away from target
set direction to abot, bot1, bot2 or bot3
set direction away from abot, bot1, bot2, bot3
set direction to center
set direction to powerup
set direction to zone [value] (number between 1 and 9)
match abots speed - set your direction and speed to match that of abots


TARGETING COMMANDS:
set target to powerup
set target to random bot
set target to random position
set target to closest bot
set target to bullet
set target radius to [value] - (aim fire inside radius of [value] from target - default 0 means fire exactly at target)
set target to abot
set target to bot1,2,3 (bot1, bot2 and bot3 are set intiatially to the other three bots in the arena)
set target to zone [value]
set leading to on (fire in front of bots path)
set leading to off

WEAPON COMMANDS:
fire item1 (Fires item1 at target)
fire item2 (Fires item2 at target)
fire item3 (Fires item3 at target)
fire item4 (Fires item4 at target)

BOT TRACKING COMMANDS:
set abot to bot with name ... (good for team play)
set abot to bot with imagename ... (make dog chase any cat for example)
set abot to bot with botmaster ...
set abot to closest bot
set abot to lowest health bot
set abot to lowest energy bot
set abot to lowest ammo bot
set abot,bot1,2,3 to bot1,2,3
set bot1,2,3 to abot
set abot to random bot
set abot,bot1,2,3 to last bot bumped
set abot,bot1,2,3 to who shot me
set abot,bot1,bot2,bot3 to bullet owner
set abot to bot who said ...

TALKING COMMANDS:
say stuff - bot says something
if / abot said - activated when what abot said CONTAINS
if / any bot said - activated when what a bot said CONTAINS
set abot to bot who said - sets abot to the bot that said
clear say - silences your bot


MY STATE COMMANDS:
set state to [value] (a number between 1 and 7. state starts out set to 1)
state++ (add 1 to state, if state is 7, state++ makes it 1)
state-- (subtract 1 from state, if state is 1, state-- makes it 7)
clear hit by bullet
clear bumped a bot
clear got powerup
set sector size to [value] - size of a sector


V COMMANDS:
set v1-9 to [value]
v1-9++ (add 1 to v1-9)
v1-9-- (substract 1 from v1-9)

IF STATEMENTS:
Note: Ifs inside ifs WORK!! Use of "return" inside ifs WORKS!!
Note: Now "and" "or" and "xor" can be used.

bullet in zone [value]
target in zone [value]
any bot in zone [value]
target left, right, up, down
target too close, close range, medium range, long range
i am (not) closest to target
abot (not) closest to target
close to any wall
abot close to any wall
bullet close range
bullet medium range
bullet long range
any bot in sector [value] (number between 1 and 9)
abot in sector [value]
any bullets in sector [value]
no bullets in sector [value]
bullet in sector [value]
absorber on,off
abot absorber on,off
abot health, energy, ammo empty - they equal to 0 that is
health, energy, ammo empty - they equal to 0 that is

ABOT:
abot in zone [value]
abots name is
abots imagename is
abots botmaster is
abot up, down, left right
abot moves up, down, left right
abot closest to powerup
abot not closest to powerup
abot too close (within sawing distance)
abot stopped
abot in zone [value]
abot shield on, off - also true when deflector is on
abot deflector on, off
abot saw on,off - if abot has saw or absorber on,off
abot attractor on,off
abot repeller on,off
abot active drones equals ... - checks for a certain number of enemy active drones
abot drones on, off - if enemy has any drones.
abot (not) cloaked
abot has ... - checks for an installed item in abot (laser, shield, etc)
abot close range
abot medium range
abot long range
abot health low, abot energy low, abot ammo low
abot health ok, abot energy ok, abot ammo ok
abot health full, abot energy full, abot ammo full
abot alive
abot dead
abot close to top, bottom, left, right wall
i have more health than abot
i have less health than abot
i have more energy than abot
i have less energy than abot
i have more ammo than abot
i have less ammo than abot

ANY BOT:
any bots name is
any bots imagename is
any bot is cloaked
any bots botmaster is ...
any bot up
any bot down
any bot left
any bot right
any bot too close
bots alive equals [value] - if bots alive equals 1, then you are victorious.
bot1,2,3 dead
bot1,2,3 alive

POWERUP:
powerup on
powerup off
powerup is health
powerup is not health
powerup is energy
powerup is not energy
powerup is ammo
powerup is not ammo
got powerup - true when your bot got a powerup. clear with "clear got powerup".
powerup left,right,up,down

BULLETS:
any bullets in zone [value] (zone number from 1 to 9)
no bullets in zone [value]
bullet left,right,up,down (closest bullet)
any bullets left,right,up,down
if bullet is ... - checks for the type of the closest bullet (laser, shocker, etc)

V:
v1-9 equals [value]
v1-9 not equals [value]
v1-9 bigger than [value]
v1-9 smaller than [value]

CLOAKING:
Engaging cloak makes bots not know where you are. They can set abot, but cannot target or find out range or anything else except the zone your bot is in. Firing anything or getting hit will remove the cloak.
stop cloak - disengage cloaking device
rob abot - when cloaked, in close range and abot has no shield your bot can steal ammo and energy from abot
i am (not) cloaked
abot (not) cloaked
any bot cloaked

MY STATES:
state equals [value] (state ranges from 1 to 7)
state not equals [value]
health ok, energy ok, ammo ok
health low, energy low, ammo low
close to top, bottom, left, right wall
shield on,off - also true when deflector is on
deflector on,off
saw on,off- if saw or absorber on,off
repeller on,off
attractor on,off
active drones equals ... - checks for YOUR drones.
drones on, off - checks if YOU have any defensive drones.
got powerup
bullet too close
hit by bullet
bumped a bot
I am at target (if within 10 pixels of target)
I am not at target
I am in zone [value] (zones from 1 to 9)
I am not in zone [value]
I am in same zone as abot
I am not in same zone as abot
I have more energy than abot
I have less energy than abot
I have more/less ammo than abot
i am closest to powerup
i am not closest to powerup
i am (not) closest to abot
i am (not) cloaked

Various stuff:
Add comments to a line with //. Everything after // will be ignored by the command interpreter.
Armor slows your bot down with 2. Chaingun slows your bot with 1. Empty slots increase your max speed. use debug mode to find out your speed.
Bullets hitting deflector become yours. Any kill from them is yours as well.
Access the game menu by pressing the right mouse button in the arena
Switch between bots using the TAB key or from within the menu.
The debug information only refers to the bot the game has focus on.