# Actuators

## Topics

1. What Is an Actuator?
2. How To Call Actuators
3. What Happens If an Actuator's Value Is Not Set During a Think Cycle?

What Is an Actuator?

An actuator is the mechanism by which the user can control a specific aspect of the bot's movement or actions. For example, the programmer can instruct the bot to turn at a certain speed by making a call to the do_rotation() actuator while passing the desired turning speed as an argument. On every think cycle, the programmer has an opportunity to call any or all of the available actuators, thereby affecting the bot's in-game actions.

How To Call Actuators

The following actuators are available to the user:

• do_translation(int speed)

The bot will translate (i.e. move forward or backwards) at the given speed. The speeds are the predefined speed constants and the actuator must take one of the following values or risk unpredictable behavior:

0 = "stand still"
1 = "walk"
2 = "run"

Negating these constants will cause the bot to move backwards (e.g. -2 = "run backwards").

• do_rotation(int speed)

The bot will rotate (spin) at the given speed. The speed is defined in units of 1/10 degree per second. Recommended reasonable values range from (-1000 <= speed <= 1000), although no integer value is an invalid speed. Positive speeds rotate the bot clockwise and negative speeds rotate the bot counter-clockwise. See the diagram of directions in FlexBot for more information. If given a rotate speed of zero, the bot does not rotate. The bot's view-angle and its body angle are adjusted to match each other when do_rotation is called (the bot moves the same direction that it looks).

• do_strafe(int speed)

The bot will "strafe" (side-step) at the given speed. The speeds are the predefined speed constants and the actuator must take one of the following values or risk unpredictable behavior:

0 = "stand still"
1 = "walk"
2 = "run"

• do_pitch(int speed)

The bot will change pitch (whether it is looking up or down) at the given speed. The speed is defined in units of 1/10 degree per second. Recommended reasonable values range from (-600 <= speed <= 600), although no integer value is invalid. Negative speeds will cause the player to adjust pitch down. Positive speeds will cause the player to adjust pitch up. A pitch adjustment of zero has no effect on the bot's pitch.

• do_shoot(bool shoot)

When shoot is true, the bot will hold down the attack button. This will generally cause the bot to fire its gun, swing its crowbar, etc. (whatever the fire button would normally do in the bot's present situation).

• do_duck(bool duck)

When duck is true, the bot will press the duck button. Note that to remain crouched, the button must be held down for the duration of the crouch.

• do_jump(bool jump)

When jump is true, the bot will press the jump button. There is no need to hold the button down for the duration of the jump - a jump button-press duration of one think cycle will cause a normal jump to occur.

• do_secondary(bool shoot)

When shoot is true, the bot will use the secondary-attack button. This generally causes the bot to fire its weapon using the second trigger. Note that not all weapons have second triggers available for use. As a result, this actuator may not always have any discernable effect on the bot.

• do_weapon(int weapon)

Tells the bot which weapon to use (or carry as the active weapon.) Passing a value of -1 will result in no weapon change. Values for weapon correspond to the following weapon-identifier constants:

0. No weapon
1. Crowbar
2. 9mm handgun
3. 357-magnum handgun
4. Assault-rifle
5. Chain-gun (doesn't seem to be used)
6. Crossbow
7. Shotgun
8. RPG rocket launcher
9. Gauss gun
10. Egon gun
11. Hornet gun
13. Trip mines
14. Satchel charges
15. Snarks

When reload is true, the bot will be forced to reload its weapon if possible. Note that bots (just like human players) have their weapons automatically reloaded by the game if the clip is empty and no triggers are depressed.

Adds a waypoint at the bot's current position and stores it in the bot's waypoint memory. If debug mode is on, a blue beam will indicate the location of the waypoint. Further discussion of waypoints can be found in the Complex Navigational Aids section of the documentation.

Adds an infopoint of the specified type at the bot's current position and stores it in the bot's waypoint memory. If debug mode is on, a green beam will indicate the location of the waypoint. The infopoint will cease to exist after the specified lifespan (given in seconds). Further discussion of infopoints can be found in the Complex Navigational Aids section of the documentation.

What Happens If an Actuator's Value Is Not Set During a Think Cycle?

In the implementation provided by the BotBehavior workspace, if an actuator is not called during a think cycle the FlexBot will continue the action from the previous think cycle. That is to say, if do_shoot(TRUE) is called in one think cycle but do_shoot() is never called in the next think cycle, the bot will continue to depress the trigger until do_shoot(FALSE) is called. This is not a requirement, but simply a detail of the implementation provided in the BotBehavior workspace. There are ten actuators available to the user.