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