DarwinBotsManual
Open the app EspañolES

.setaim

Turns the bot to an absolute heading: you write which way you want it to point and the engine puts it there in the same cycle.

Facts

Address
19
Name
.setaim
Kind
Command: the bot writes it and the engine reads it and usually consumes it
Group
Movement
Written by
Your DNA. The engine seeds it at birth with the bot's heading. In Player Bot mode, the heading toward the mouse overrides what your DNA wrote.
Cleared
The engine, in the movement phase, after turning: it does not set it to 0, it copies the current heading into it.
Range
−32000 to 32000; the remainder of dividing by 1256 is taken. It turns the bot only if it differs from the current heading.
Mutations
picked as a store target

.setaim is the absolute turn: you write the heading you want, on the same scale as .aim (0 to the right of the screen, 314 up, 1256 a full turn), and the bot ends the cycle pointing there, however big the turn. Any number works: its remainder when divided by 1256 is taken, so -314 is 942 and 1570 is 314. The turn costs energy, but the cost depends not on the angle swept but on the number you wrote: 1200 .setaim costs much more than -56 .setaim, even though both leave the same heading (see Physics).

The engine doesn't clear it to 0: after turning the bot, it copies the current heading into it. That is why *.setaim can always be read as the bot's heading, and in the first cycle of life it is more reliable than *.aim, which still reads 0.

The classic use is to turn relative to the current heading by adding something to it, or to aim at what it sees by combining .refxpos and .refypos with its own position. This bot turns by 100 per cycle, reading the heading from .setaim itself:

cond
start
*.setaim 100 add .setaim store
stop