Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!

Editing EXT CSQC System Globals Fields and Builtins List

From Quake Wiki

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
 
==System Globals==
 
==System Globals==
<pre>
+
<code>
entity self;
+
entity self;<br>
entity other;
+
entity other;<br>
entity world;
+
entity world;<br>
float time;
+
float time;<br>
float frametime;
+
float frametime;<br>
 
+
<br>
float player_localentnum;    //the entnum
+
float player_localentnum;    //the entnum<br>
float player_localnum;        //the playernum
+
float player_localnum;        //the playernum<br>
float maxclients;            //a constant filled in by the engine
+
float maxclients;            //a constant filled in by the engine<br>
 
+
<br>
float clientcommandframe;    //player movement
+
float clientcommandframe;    //player movement<br>
float servercommandframe;    //clientframe echoed off the server
+
float servercommandframe;    //clientframe echoed off the server<br>
string mapname;
+
string mapname;<br>
 
+
<br>
//
+
//<br>
// global variables set by built in functions
+
// global variables set by built in functions<br>
//
+
//<br>
vector v_forward, v_up, v_right;  // set by makevectors()
+
vector v_forward, v_up, v_right;  // set by makevectors()<br>
 
+
<br>
// set by traceline / tracebox
+
// set by traceline / tracebox<br>
float trace_allsolid;
+
float trace_allsolid;<br>
float trace_startsolid;
+
float trace_startsolid;<br>
float trace_fraction;
+
float trace_fraction;<br>
vector trace_endpos;
+
vector trace_endpos;<br>
vector trace_plane_normal;
+
vector trace_plane_normal;<br>
float trace_plane_dist;
+
float trace_plane_dist;<br>
entity trace_ent;
+
entity trace_ent;<br>
float trace_inopen;
+
float trace_inopen;<br>
float trace_inwater;
+
float trace_inwater;<br>
 
+
<br>
//
+
//<br>
// required prog functions
+
// required prog functions<br>
//
+
//<br>
void() CSQC_Init;
+
void() CSQC_Init;<br>
void() CSQC_Shutdown;
+
void() CSQC_Shutdown;<br>
float(float f, float t, float n) CSQC_InputEvent;
+
float(float f, float t) CSQC_InputEvent;<br>
void() CSQC_UpdateView;
+
void() CSQC_UpdateView;<br>
float(string s) CSQC_ConsoleCommand;
+
float(string s) CSQC_ConsoleCommand;<br>
 
+
<br>
//these fields are read and set by the default player physics
+
//these fields are read and set by the default player physics<br>
vector pmove_org;
+
vector pmove_org;<br>
vector pmove_vel;
+
vector pmove_vel;<br>
vector pmove_mins;
+
vector pmove_mins;<br>
vector pmove_maxs;
+
vector pmove_maxs;<br>
//retrieved from the current movement commands (read by player physics)
+
//retrieved from the current movement commands (read by player physics)<br>
float input_timelength;
+
float input_timelength;<br>
vector input_angles;
+
vector input_angles;<br>
vector input_movevalues;  //forwards, right, up.
+
vector input_movevalues;  //forwards, right, up.<br>
float input_buttons;    //attack, use, jump (default physics only uses jump)
+
float input_buttons;    //attack, use, jump (default physics only uses jump)<br>
 
+
<br>
float movevar_gravity;
+
float movevar_gravity;<br>
float movevar_stopspeed;
+
float movevar_stopspeed;<br>
float movevar_maxspeed;
+
float movevar_maxspeed;<br>
float movevar_spectatormaxspeed;  //used by NOCLIP movetypes.
+
float movevar_spectatormaxspeed;  //used by NOCLIP movetypes.<br>
float movevar_accelerate;
+
float movevar_accelerate;<br>
float movevar_airaccelerate;
+
float movevar_airaccelerate;<br>
float movevar_wateraccelerate;
+
float movevar_wateraccelerate;<br>
float movevar_friction;
+
float movevar_friction;<br>
float movevar_waterfriction;
+
float movevar_waterfriction;<br>
float movevar_entgravity; //the local player's gravity field. Is a multiple
+
float movevar_entgravity; //the local player's gravity field. Is a multiple (1 is the normal value)<br>
                        //(1 is the normal value)
+
</code>
</pre>
 
 
 
 
==System Fields==
 
==System Fields==
<pre>
+
<code>
.float modelindex;    // *** model index in the precached list
+
.float modelindex;    // *** model index in the precached list<br>
.vector absmin, absmax; // *** origin + mins / maxs
+
.vector absmin, absmax; // *** origin + mins / maxs<br>
 
+
<br>
.float entnum;        // *** the ent number as on the server
+
.float entnum;        // *** the ent number as on the server<br>
.float drawmask;
+
.float drawmask;<br>
.void() predraw;
+
.void() predraw;<br>
.float movetype;
+
.float movetype;<br>
.float solid;
+
.float solid;<br>
 
+
<br>
.vector origin;        // ***
+
.vector origin;        // ***<br>
.vector oldorigin;      // ***
+
.vector oldorigin;      // ***<br>
.vector velocity;
+
.vector velocity;<br>
.vector angles;
+
.vector angles;<br>
.vector avelocity;
+
.vector avelocity;<br>
 
+
<br>
.string classname;      // spawn function
+
.string classname;      // spawn function<br>
.string model;
+
.string model;<br>
.float frame;
+
.float frame;<br>
.float skin;
+
.float skin;<br>
.float effects;
+
.float effects;<br>
 
+
<br>
.vector mins, maxs;    // bounding box extents reletive to origin
+
.vector mins, maxs;    // bounding box extents reletive to origin<br>
.vector size;          // maxs - mins
+
.vector size;          // maxs - mins<br>
 
+
<br>
.void() touch;
+
.void() touch;<br>
.void() use;
+
.void() use;<br>
.void() think;
+
.void() think;<br>
.void() blocked;        // for doors or plats, called when can't push other
+
.void() blocked;        // for doors or plats, called when can't push other<br>
 
+
<br>
.float nextthink;
+
.float nextthink;<br>
.entity chain;
+
.entity chain;<br>
.string netname;
+
.string netname;<br>
.entity enemy;
+
.entity enemy;<br>
.float flags;
+
.float flags;<br>
.float colormap;
+
.float colormap;<br>
.entity owner;
+
.entity owner;<br>
</pre>
+
</code>
 
==Builtins==
 
==Builtins==
 
CSQC implements all the core quake functions except for:
 
* checkclient
 
* stuffcmd
 
* bprint
 
* sprint (use 'print' instead)
 
* aim
 
* writebyte
 
* writechar
 
* writeshort
 
* writelong
 
* writecoord
 
* writeangle
 
* writestring
 
* writeentity
 
* precache_file
 
* changelevel
 
* logfrag (qw)
 
* infokey (qw)
 
* multicast (qw)
 
 
<pre>
 
// core functions from standard quake
 
void(vector ang) makevectors = #1;
 
void(entity e, vector o) setorigin = #2;
 
void(entity e, string m) setmodel = #3;
 
void(entity e, vector min, vector max) setsize = #4;
 
void(entity e, vector min, vector max) setabssize = #5;
 
void() break = #6;
 
float() random = #7;
 
void(entity e, float chan, string samp) sound = #8;
 
vector(vector v) normalize = #9;
 
void(string e) error = #10;
 
void(string e) objerror = #11;
 
float(vector v) vlen = #12;
 
float(vector v) vectoyaw = #13;
 
entity() spawn = #14;
 
void(entity e) remove = #15;
 
float(vector v1, vector v2, float tryents) traceline = #16;
 
entity() checkclient = #17;
 
entity(entity start, .string fld, string match) find = #18;
 
void(string s) precache_sound = #19;
 
void(string s) precache_model = #20;
 
entity(vector org, float rad) findradius = #22;
 
 
string(float f) ftos = #26;
 
string(vector v) vtos = #27;
 
void() coredump = #28;
 
void() traceon = #29;
 
void() traceoff = #30;
 
void(entity e) eprint = #31;
 
float(float yaw, float dist) walkmove = #32;
 
 
float() droptofloor = #34;
 
void(float style, string value) lightstyle = #35;
 
float(float v) rint = #36;
 
float(float v) floor = #37;
 
float(float v) ceil = #38;
 
 
float(entity e) checkbottom = #40;
 
float(vector v) pointcontents = #41;
 
 
float(float f) fabs = #43;
 
float(string s) cvar = #45;
 
void(string s) localcmd = #46;
 
entity(entity e) nextent = #47;
 
void(vector o, vector d, float color, float count) particle = #48;
 
void() ChangeYaw = #49;
 
 
vector(vector v) vectoangles = #51;
 
 
string(string s) precache_file = #68;
 
void(entity e) makestatic = #69;
 
 
void(string var, string val) cvar_set = #72;
 
 
void(vector pos, string samp, float vol, float atten) ambientsound = #74;
 
string(string s) precache_model2 = #75;
 
string(string s) precache_sound2 = #76;
 
string(string s) precache_file2 = #77;
 
 
 
 
// core ext_csqc functions
 
void() R_ClearScene = #300;
 
void(float mask) R_AddEntities = #301;
 
void(entity ent) R_AddEntity = #302;
 
float(float property, ...) R_SetView = #303;
 
void() R_RenderScene = #304;
 
void(vector org, float radius, vector lightcolours) R_AddDynamicLight = #305;
 
void(string texturename, float flag[, float is2d, float lines]) R_BeginPolygon = #306;
 
void(vector org, vector texcoords, vector rgb, float alpha) R_PolygonVertex = #307;
 
void() R_EndPolygon = #308;
 
 
vector (vector v) cs_unproject = #310;
 
vector (vector v) cs_project = #311;
 
 
void(float width, vector pos1, vector pos2, float flag) drawline = #315;
 
float(string name) iscachedpic = #316;
 
string(string name) precache_pic = #317;
 
vector(string picname) draw_getimagesize = #318;
 
void(string name) freepic = #319;
 
float(vector position, float character, vector scale, vector rgb, float alpha, float flag) drawcharacter = #320;
 
float(vector position, string text, vector scale, vector rgb, float alpha, float flag) drawstring = #321;
 
float(vector position, string pic, vector size, vector rgb, float alpha, float flag) drawpic = #322;
 
float(vector position, vector size, vector rgb, float alpha, float flag) drawfill = #323;
 
void(float x, float y, float width, float height) drawsetcliparea = #324;
 
void(void) drawresetcliparea = #325;
 
float drawcolorcodedstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #326;
 
 
float (float statnum) getstat_float = #330;
 
float (float statnum) getstat_float_truncated = #331;
 
string (float statnum) getstat_string = #332;
 
 
void(entity e, float mdlindex) setmodelindex = #333;
 
string(float mdlindex) modelnameforindex = #334;
 
float(string effectname) particleeffectnum = #335;
 
void(entity ent, float effectnum, vector start, vector end) trailparticles = #336;
 
void(float effectnum, vector origin [, vector dir, float count]) pointparticles = #337;
 
void(string s, ...) centerprint = #338;
 
void(string s, ...) print = #339;
 
string(float keynum) keynumtostring = #340;
 
float(string keyname) stringtokeynum = #341;
 
string(float keynum) getkeybind = #342;
 
void(float usecursor) setcursormode = #343;
 
vector() getmousepos = #344;
 
float(float framenum) getinputstate = #345;
 
void(float sens) setsensitivityscaler = #346;
 
void() runstandardplayerphysics = #347;
 
string(float playernum, string keyname) getplayerkeyvalue = #348;
 
float() isdemo = #349;
 
float() isserver = #350;
 
void(vector origin, vector forward, vector right, vector up) SetListener = #351;
 
void(string cmdname) registercommand = #352;
 
float(entity ent) wasfreed = #353;
 
string(string key) serverkey = #354;
 
 
float() ReadByte = #360;
 
float() ReadChar = #361;
 
float() ReadShort = #362;
 
float() ReadLong = #363;
 
float() ReadCoord = #364;
 
float() ReadAngle = #365;
 
string() ReadString = #366; //warning: this returns a temporary!
 
float() ReadFloat = #367;
 
</pre>
 
 
==Constants==
 
<pre>
 
// add-entity mask bits
 
float MASK_ENGINE          = 1;
 
float MASK_ENGINEVIEWMODELS = 2;
 
float MASK_NORMAL          = 4;
 
 
// renderflag bits
 
float RF_VIEWMODEL          = 1;
 
float RF_EXTERNALMODEL      = 2;
 
float RF_DEPTHHACK          = 4;
 
float RF_ADDITIVE          = 8;
 
float RF_USEAXIS            = 16;
 
 
// flags for 2d drawing
 
float DRAWFLAG_NORMAL      = 0;
 
float DRAWFLAG_ADDITIVE    = 1;
 
float DRAWFLAG_MODULATE    = 2;
 
float DRAWFLAG_2XMODULATE  = 3;
 
 
// setview parameter
 
float VF_MIN                = 1;    //(vector)
 
float VF_MIN_X              = 2;    //(float)
 
float VF_MIN_Y              = 3;    //(float)
 
float VF_SIZE              = 4;    //(vector) (viewport size)
 
float VF_SIZE_X            = 5;    //(float)
 
float VF_SIZE_Y            = 6;    //(float)
 
float VF_VIEWPORT          = 7;    //(vector, vector)
 
float VF_FOV                = 8;    //(vector)
 
float VF_FOVX              = 9;    //(float)
 
float VF_FOVY              = 10;  //(float)
 
float VF_ORIGIN            = 11;  //(vector)
 
float VF_ORIGIN_X          = 12;  //(float)
 
float VF_ORIGIN_Y          = 13;  //(float)
 
float VF_ORIGIN_Z          = 14;  //(float)
 
float VF_ANGLES            = 15;  //(vector)
 
float VF_ANGLES_X          = 16;  //(float)
 
float VF_ANGLES_Y          = 17;  //(float)
 
float VF_ANGLES_Z          = 18;  //(float)
 
float VF_DRAWWORLD          = 19;  //(float)
 
float VF_DRAWENGINESBAR    = 20;  //(float)
 
float VF_DRAWCROSSHAIR      = 21;  //(float)
 
 
float VF_CL_VIEWANGLES      = 33;  //(vector)
 
float VF_CL_VIEWANGLES_X    = 34;  //(float)
 
float VF_CL_VIEWANGLES_Y    = 35;  //(float)
 
float VF_CL_VIEWANGLES_Z    = 36;  //(float)
 
 
float VF_PERSPECTIVE        = 200;  //(float)
 
 
// stats
 
// 0 - 31 are reserved for standard engine stats
 
// 32 - 128 are for QuakeC modders
 
float STAT_HEALTH          = 0;
 
float STAT_WEAPONMODEL      = 2;
 
float STAT_AMMO            = 3;
 
float STAT_ARMOR            = 4;
 
float STAT_WEAPONFRAME      = 5;
 
float STAT_SHELLS          = 6;
 
float STAT_NAILS            = 7;
 
float STAT_ROCKETS          = 8;
 
float STAT_CELLS            = 9;
 
float STAT_ACTIVEWEAPON    = 10;
 
float STAT_TOTALSECRETS    = 11;
 
float STAT_TOTALMONSTERS    = 12;
 
float STAT_SECRETS          = 13; // bumped on client side by svc_foundsecret
 
float STAT_MONSTERS        = 14; // bumped by svc_killedmonster
 
float STAT_ITEMS            = 15; // self.items bitmask from server
 
float STAT_VIEWHEIGHT      = 16;
 
 
// buttons for input_buttons
 
float BUTTON_ATTACK        = 1;
 
float BUTTON_JUMP          = 2;
 
float BUTTON_3              = 4;
 
float BUTTON_4              = 8;
 
float BUTTON_5              = 16;
 
float BUTTON_6              = 32;
 
float BUTTON_7              = 64;
 
float BUTTON_8              = 128;
 
// supported by DarkPlaces
 
float BUTTON_USE            = 256;
 
float BUTTON_CHAT          = 512;
 
float BUTTON_PRYDONCURSOR  = 1024;
 
float BUTTON_9              = 2048;
 
float BUTTON_10            = 4096;
 
float BUTTON_11            = 8192;
 
float BUTTON_12            = 16384;
 
float BUTTON_13            = 32768;
 
float BUTTON_14            = 65536;
 
float BUTTON_15            = 131072;
 
float BUTTON_16            = 262;
 
</pre>
 
 
==Non-System Fields and Globals==
 
<pre>
 
float  intermission; // initially FALSE, set to TRUE when the server sends the SVC_INTERMISSION command
 
</pre>
 
[[Category:DarkPlaces]]
 

Please note that all contributions to Quake Wiki are considered to be released under the GNU Free Documentation License 1.3 or later (see Quake Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel | Editing help (opens in new window)