DarwinBotsManual
Open the app EspañolES

Shots

The sysvars for shooting (.shoot, .shootval, .backshot, .aimshoot) and the ones that tell you when a shot hits you (.shflav, .shang and the four direction ones).

AddressSysvarKindSummary
7.shootCommandThe order to fire: the number picks the shot type (−1 steals energy, −2 gives it away, −3 venom, −6 steals body, positive writes to the other bot's memory).
8.shootvalCommandThe adjustment for the next shot: the power or range of a −1 or −6, how much you give with a −2, or the value that a memory shot writes.
202.shflavSenseThe type of the shot that hit you in the previous cycle (−1, −2, −3…, or the address of a memory shot); 0 if nothing hit you.
209.shangSenseThe angle the shot that hit you came from, measured from your front toward the right: write it to .aimdx and you end up facing the shooter.
210.shupSenseThe type of the shot that hit you head-on in the previous cycle; 0 if nothing hit you from the front.
211.shdnSenseThe type of the shot that hit you from behind in the previous cycle; 0 if nothing hit you from behind.
212.shdxSenseThe type of the shot that hit you from the right in the previous cycle; 0 if nothing hit you from that side.
213.shsxSenseThe type of the shot that hit you from the left in the previous cycle; 0 if nothing hit you from that side.
900.backshotCommandWith a value other than 0, the next shot goes out backward instead of forward.
901.aimshootCommandOffsets the next shot by an angle from your front, without turning: positive to the right, negative to the left.

Shooting is how almost every bot that isn't a vegetable eats, and also how it attacks, gifts energy or writes into another bot's memory. This group has two halves.

For shooting. .shoot is the command: the number you write picks the shot type, and the engine fires it in that same cycle. The most common is −1, which takes energy from whoever receives the hit and brings it back to you. .shootval tunes the shot: the power, the range, the amount you gift or the value you write. .backshot shoots backward and .aimshoot offsets the shot by an angle, without you having to turn.

For sensing the shots that hit you. .shflav says what type it was, .shang from what angle it came, and .shup, .shdn, .shdx and .shsx repeat the type in the one matching the side of the hit (front, back, right or left). They arrive one cycle late and last a single cycle. Watch out: they also register the shots that favor you, such as the energy that comes back from your own attacks.

A classic combination joins the two halves: the one under attack turns toward the attacker and returns fire.

' if something hits me that isn't my own energy coming back, I turn and shoot
cond
*.shflav 0 !=
*.shflav -2 !=
start
*.shang .aimdx store
-1 .shoot store
stop

How a shot flies, how far it reaches and what each type does on impact is covered in Shots; the step-by-step walkthrough for a hunter bot, in A bot that shoots.