1 #ifndef BOT_SCRIPTING_H
2 #define BOT_SCRIPTING_H
4 #define BOT_EXEC_STATUS_IDLE 0
5 #define BOT_EXEC_STATUS_PAUSED 1
6 #define BOT_EXEC_STATUS_WAITING 2
8 #define CMD_STATUS_EXECUTING 0
9 #define CMD_STATUS_FINISHED 1
10 #define CMD_STATUS_ERROR 2
13 // NOTE: New commands should be added here. Do not forget to update BOT_CMD_COUNTER
14 const int BOT_CMD_NULL = 0;
15 const int BOT_CMD_PAUSE = 1;
16 const int BOT_CMD_CONTINUE = 2;
17 const int BOT_CMD_WAIT = 3;
18 const int BOT_CMD_TURN = 4;
19 const int BOT_CMD_MOVETO = 5;
20 const int BOT_CMD_RESETGOAL = 6; // Not implemented yet
21 const int BOT_CMD_CC = 7;
22 const int BOT_CMD_IF = 8;
23 const int BOT_CMD_ELSE = 9;
24 const int BOT_CMD_FI = 10;
25 const int BOT_CMD_RESETAIM = 11;
26 const int BOT_CMD_AIM = 12;
27 const int BOT_CMD_PRESSKEY = 13;
28 const int BOT_CMD_RELEASEKEY = 14;
29 const int BOT_CMD_SELECTWEAPON = 15;
30 const int BOT_CMD_IMPULSE = 16;
31 const int BOT_CMD_WAIT_UNTIL = 17;
32 const int BOT_CMD_MOVETOTARGET = 18;
33 const int BOT_CMD_AIMTARGET = 19;
34 const int BOT_CMD_BARRIER = 20;
35 const int BOT_CMD_CONSOLE = 21;
36 const int BOT_CMD_SOUND = 22;
37 const int BOT_CMD_DEBUG_ASSERT_CANFIRE = 23;
38 const int BOT_CMD_WHILE = 24; // TODO: Not implemented yet
39 const int BOT_CMD_WEND = 25; // TODO: Not implemented yet
40 const int BOT_CMD_CHASE = 26; // TODO: Not implemented yet
42 const int BOT_CMD_COUNTER = 24; // Update this value if you add/remove a command
44 // NOTE: Following commands should be implemented on the bot ai
45 // If a new command should be handled by the target ai(s) please declare it here
46 .float(vector) cmd_moveto;
47 .float() cmd_resetgoal;
50 const int BOT_CMD_PARAMETER_NONE = 0;
51 const int BOT_CMD_PARAMETER_FLOAT = 1;
52 const int BOT_CMD_PARAMETER_STRING = 2;
53 const int BOT_CMD_PARAMETER_VECTOR = 3;
55 float bot_cmds_initialized;
56 int bot_cmd_parm_type[BOT_CMD_COUNTER];
57 string bot_cmd_string[BOT_CMD_COUNTER];
60 entity bot_cmd; // global current command
61 .entity bot_cmd_current; // current command of this bot
63 .float is_bot_cmd; // Tells if the entity is a bot command
64 .float bot_cmd_index; // Position of the command in the queue
65 .int bot_cmd_type; // If of command (see the BOT_CMD_* defines)
66 .float bot_cmd_parm_float; // Field to store a float parameter
67 .string bot_cmd_parm_string; // Field to store a string parameter
68 .vector bot_cmd_parm_vector; // Field to store a vector parameter
70 float bot_barriertime;
73 .float bot_cmd_execution_index; // Position in the queue of the command to be executed
76 void bot_resetqueues();
77 void bot_queuecommand(entity bot, string cmdstring);
78 void bot_cmdhelp(string scmd);
79 void bot_list_commands();
80 float bot_execute_commands();
81 entity find_bot_by_name(string name);
82 entity find_bot_by_number(float number);