Xonotic
scripting.qh
Go to the documentation of this file.
1 #pragma once
2 
3 #define BOT_EXEC_STATUS_IDLE 0
4 #define BOT_EXEC_STATUS_PAUSED 1
5 #define BOT_EXEC_STATUS_WAITING 2
6 
7 #define CMD_STATUS_EXECUTING 0
8 #define CMD_STATUS_FINISHED 1
9 #define CMD_STATUS_ERROR 2
10 
11 
12 // NOTE: New commands should be added here. Do not forget to update BOT_CMD_COUNTER
13 const int BOT_CMD_NULL = 0;
14 const int BOT_CMD_PAUSE = 1;
15 const int BOT_CMD_CONTINUE = 2;
16 const int BOT_CMD_WAIT = 3;
17 const int BOT_CMD_TURN = 4;
18 const int BOT_CMD_MOVETO = 5;
19 const int BOT_CMD_RESETGOAL = 6; // Not implemented yet
20 const int BOT_CMD_CC = 7;
21 const int BOT_CMD_IF = 8;
22 const int BOT_CMD_ELSE = 9;
23 const int BOT_CMD_FI = 10;
24 const int BOT_CMD_RESETAIM = 11;
25 const int BOT_CMD_AIM = 12;
26 const int BOT_CMD_PRESSKEY = 13;
27 const int BOT_CMD_RELEASEKEY = 14;
28 const int BOT_CMD_SELECTWEAPON = 15;
29 const int BOT_CMD_IMPULSE = 16;
30 const int BOT_CMD_WAIT_UNTIL = 17;
31 const int BOT_CMD_MOVETOTARGET = 18;
32 const int BOT_CMD_AIMTARGET = 19;
33 const int BOT_CMD_BARRIER = 20;
34 const int BOT_CMD_CONSOLE = 21;
35 const int BOT_CMD_SOUND = 22;
37 //const int BOT_CMD_WHILE = 24; // TODO: Not implemented yet
38 //const int BOT_CMD_WEND = 25; // TODO: Not implemented yet
39 //const int BOT_CMD_CHASE = 26; // TODO: Not implemented yet
40 
41 const int BOT_CMD_COUNTER = 24; // Update this value if you add/remove a command
42 
43 // NOTE: Following commands should be implemented on the bot ai
44 // If a new command should be handled by the target ai(s) please declare it here
45 .float(entity, vector) cmd_moveto;
46 .float(entity) cmd_resetgoal;
47 
48 //
49 const int BOT_CMD_PARAMETER_NONE = 0;
53 
57 
58 // Bots command queue
59 entity bot_cmd; // global current command
60 .entity bot_cmd_current; // current command of this bot
61 
62 .float bot_cmd_index; // Position of the command in the queue
63 .int bot_cmd_type; // If of command (see the BOT_CMD_* defines)
64 .float bot_cmd_parm_float; // Field to store a float parameter
65 .string bot_cmd_parm_string; // Field to store a string parameter
66 .vector bot_cmd_parm_vector; // Field to store a vector parameter
67 
69 .float bot_barrier;
70 
71 .float bot_cmd_execution_index; // Position in the queue of the command to be executed
72 
73 
74 bool bot_ispaused(entity this);
75 
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(entity this);
string bot_cmd_string[BOT_CMD_COUNTER]
Definition: scripting.qh:56
string bot_cmd_parm_string
Definition: scripting.qh:65
void bot_cmdhelp(string scmd)
Definition: scripting.qc:331
entity bot_cmd_current
Definition: scripting.qh:60
const int BOT_CMD_MOVETOTARGET
Definition: scripting.qh:31
const int BOT_CMD_SOUND
Definition: scripting.qh:35
const int BOT_CMD_ELSE
Definition: scripting.qh:22
float bot_cmd_index
Definition: scripting.qh:62
int int number
Definition: impulse.qc:89
const int BOT_CMD_AIMTARGET
Definition: scripting.qh:32
const int BOT_CMD_AIM
Definition: scripting.qh:25
int bot_cmd_parm_type[BOT_CMD_COUNTER]
Definition: scripting.qh:55
entity() spawn
float bot_barriertime
Definition: scripting.qh:68
vector bot_cmd_parm_vector
Definition: scripting.qh:66
const int BOT_CMD_RESETAIM
Definition: scripting.qh:24
void bot_list_commands()
Definition: scripting.qc:444
const int BOT_CMD_MOVETO
Definition: scripting.qh:18
const int BOT_CMD_CC
Definition: scripting.qh:20
const int BOT_CMD_CONTINUE
Definition: scripting.qh:15
entity find_bot_by_name(string name)
Definition: scripting.qc:235
entity find_bot_by_number(float number)
Definition: scripting.qc:246
const int BOT_CMD_FI
Definition: scripting.qh:23
bool bot_ispaused(entity this)
Definition: scripting.qc:1003
float bot_cmd_parm_float
Definition: scripting.qh:64
const int BOT_CMD_PAUSE
Definition: scripting.qh:14
int bot_cmd_type
Definition: scripting.qh:63
float bot_cmd_execution_index
Definition: scripting.qh:71
const int BOT_CMD_PRESSKEY
Definition: scripting.qh:26
entity bot_cmd
Definition: scripting.qh:59
const int BOT_CMD_DEBUG_ASSERT_CANFIRE
Definition: scripting.qh:36
const int BOT_CMD_CONSOLE
Definition: scripting.qh:34
void bot_queuecommand(entity bot, string cmdstring)
Definition: scripting.qc:30
const int BOT_CMD_PARAMETER_VECTOR
Definition: scripting.qh:52
const int BOT_CMD_RESETGOAL
Definition: scripting.qh:19
const int BOT_CMD_WAIT_UNTIL
Definition: scripting.qh:30
vector(float skel, float bonenum) _skel_get_boneabs_hidden
const int BOT_CMD_IMPULSE
Definition: scripting.qh:29
const int BOT_CMD_COUNTER
Definition: scripting.qh:41
void bot_resetqueues()
Definition: scripting.qc:1165
const int BOT_CMD_RELEASEKEY
Definition: scripting.qh:27
const int BOT_CMD_PARAMETER_NONE
Definition: scripting.qh:49
float bot_execute_commands(entity this)
Definition: scripting.qc:1350
float bot_barrier
Definition: scripting.qh:69
const int BOT_CMD_IF
Definition: scripting.qh:21
const int BOT_CMD_BARRIER
Definition: scripting.qh:33
const int BOT_CMD_PARAMETER_FLOAT
Definition: scripting.qh:50
const int BOT_CMD_SELECTWEAPON
Definition: scripting.qh:28
float bot_cmds_initialized
Definition: scripting.qh:54
const int BOT_CMD_WAIT
Definition: scripting.qh:16
const int BOT_CMD_TURN
Definition: scripting.qh:17
const int BOT_CMD_PARAMETER_STRING
Definition: scripting.qh:51
const int BOT_CMD_NULL
Definition: scripting.qh:13