Strings / Buffers
50strlen(string s)
ServerClientMenu
DarkPlacesFTE
strlen("text");
Returns length (how many characters) of string.
strcat(string s, string...)
ServerClientMenu
DarkPlacesFTE
strcat("a", "b");
Concatenates two or more strings (for example "abc", "def" would return "abcdef") and returns as a tempstring.
substring(string s, float start, float length)
ServerClientMenu
DarkPlacesFTE
substring("abc", 1, 1);
Returns a section of a string as a tempstring - see FTE_STRINGS for enhanced version.
NOTE: substring is upgraded by FTE_STRINGS extension with negative start/length handling identical to php 5.2.0.
NOTE: substring also exists in FRIK_FILE but this extension adds negative start and length as valid cases (see note above), substring is consistent with the php 5.2.0 substr function (not 5.2.3 behavior). Substring returns a section of a string as a tempstring, if given negative start the start is measured back from the end of the string, if given a negative length the length is the offset back from the end of the string to stop at, rather than being relative to start, if start is negative and larger than length it is treated as 0. Examples of substring:
substring("blah", -3, 3) returns "lah"
substring("blah", 3, 3) returns "h"
substring("blah", -10, 3) returns "bla"
substring("blah", -10, -3) returns "b"
sprintf(string format, ...)
ServerClientMenu
DarkPlacesFTE
sprintf("x = %d", 5);
Formats string with values.
supported stuff:
%
optional: <argpos>$ for the argument to format (the arg counter then is not increased)
flags: #0- +
optional: <width>, *, or *<argpos>$ for the field width (width is read before value and precision)
optional: .<precision>, .*, or .*<argpos>$ for the precision (precision is read before value)
length modifiers: h for forcing a float, l for forcing an entity (by default, %d etc. cast a float to int), ll for forcing an int
conversions:
d takes a float if no length is specified or h is, and an entity if l is specified as length, and an int if ll is specified as length, and cast it to an int
i takes an entity if no length is specified or l is, and a float if h is specified as length, and an int if ll is specified as length, and cast it to an int
ouxXc take a float if no length is specified or h is, and an entity if l is specified as length, and an int if ll is specified as length, and cast it to an unsigned int
eEfFgG take a float if no length is specified or h is, and an entity if l is specified as length, and an int if ll is specified as length, and cast it to a double
s takes a string
vV takes a vector, and processes the three components as if it were a gG for all three components, separated by space
For conversions s and c, the flag # makes precision and width interpreted
as byte count, by default it is interpreted as character count in UTF-8
enabled engines. No other conversions can create wide characters, and #
has another meaning in these. When in character count mode, color codes
are ignored. To get UTF-8 semantics WITHOUT color code parsing, use
the + flag.
strlennocol(string s)
ServerClient
DarkPlacesFTE
strlennocol("^1Red");
String length without color codes.
strdecolorize(string s)
ServerClientMenu
DarkPlacesFTE
strdecolorize("^1Red");
Removes color codes from string.
strtolower(string s)
ServerClientMenu
DarkPlacesFTE
strtolower("ABC");
Converts string to lowercase.
strtoupper(string s)
ServerClientMenu
DarkPlacesFTE
strtoupper("abc");
Converts string to uppercase.
strstrofs(string str, string sub, float startpos)
ServerClientMenu
DarkPlacesFTE
strstrofs("abc", "b", 0);
Returns the offset into a string of the matching text, or -1 if not found, case sensitive.
str2chr(string str, float ofs)
ServerClientMenu
DarkPlacesFTE
str2chr("abc", 0);
Returns the character at the specified offset as an integer, or 0 if an invalid index, or byte value - 256 if the engine supports UTF8 and the byte is part of an extended character.
NOTE: beware that str2chr() could return value bigger than 255 once utf8 is enabled
chr2str(float c, ...)
ServerClientMenu
DarkPlacesFTE
chr2str(65);
Returns a string representing the character given, if the engine supports UTF8 this may be a multi-byte sequence (length may be more than 1) for characters over 127.
strconv(float ccase, float calpha, float cnum, string s, ...)
ServerClientMenu
DarkPlacesFTE
strconv(2, 2, 2, "abc");
Reformat a string with special color characters in the font.
DO NOT USE THIS ON UTF8 ENGINES (if you are lucky they will emit ^4 and such color codes instead), the parameter values are 0=same/1=lower/2=upper for ccase, 0=same/1=white/2=red/5=alternate/6=alternate-alternate for redalpha, 0=same/1=white/2=red/3=redspecial/4=whitespecial/5=alternate/6=alternate-alternate for rednum.
strpad(float chars, string s, ...)
ServerClientMenu
DarkPlacesFTE
strpad("x", 4, "0", 0);
Pad string with spaces to a specified length, < 0 = left padding, > 0 = right padding.
strreplace(string search, string replace, string subject)
ServerClientMenu
DarkPlacesFTE
strreplace("abc", "b", "x");
Replaces all occurrences of 'search' with 'replace' in the string 'subject', and returns the result as a tempstring.
strireplace(string search, string replace, string subject)
ServerClientMenu
DarkPlacesFTE
strireplace("abc", "B", "x");
Replaces all occurrences of 'search' with 'replace' in the string 'subject', and returns the result as a tempstring, but uses case-insensitive matching of the 'search' term.
strcmp(string s1, string s2)
ServerClientMenu
DarkPlacesFTE
strcmp("a", "b");
Compares two strings.
strncmp(string s1, string s2, float len)
ServerClientMenu
DarkPlacesFTE
strncmp("abc", "abd", 2);
Compare two strings up to the specified number of characters, if their length differs and is within the specified limit the result will be negative, otherwise it is the difference in value of their first non-matching character.
strcasecmp(string s1, string s2)
ServerClientMenu
DarkPlacesFTE
strcasecmp("abc", "ABC");
Compare two strings with case-insensitive matching, characters a-z are considered equivalent to the matching A-Z character, no other differences, and this does not consider special characters equal even if they look similar.
strncasecmp(string s1, string s2, float len)
ServerClientMenu
DarkPlacesFTE
strncasecmp("abc", "ABC", 3);
Same as strcasecmp, but with a length limit, see strncmp.
strftime(float uselocaltime, string format, ...)
ServerClientMenu
DarkPlacesFTE
strftime(time, "%Y-%m-%d");
Provides the ability to get the local (in your timezone) or world (Universal Coordinated Time) time as a string using the formatting of your choice:
example: "%Y-%m-%d %H:%M:%S" (result looks like: 2007-02-08 01:03:15)
NOTE: "%F %T" gives the same result as "%Y-%m-%d %H:%M:%S" (ISO 8601 date format and 24-hour time).
For more format codes please do a web search for strftime 3 and you should find the man(3) pages for this standard C function.
strzone(string s, ...)
ServerClientMenu
DarkPlacesFTE
strzone("text");
Makes a copy of a string into the string zone and returns it, this is often used to keep around a tempstring for longer periods of time (tempstrings are replaced often).
NOTE: strzone functionality is partially superseded by DP_QC_UNLIMITEDTEMPSTRINGS when longterm storage is not needed
strunzone(string s)
ServerClientMenu
DarkPlacesFTE
strunzone(str);
Removes a copy of a string from the string zone (you can not use that string again or it may crash).
chr(float ascii)
ServerClientMenu
DarkPlacesFTE
chr("A");
Returns character from ASCII code.
buf_create()
ServerClientMenu
DarkPlacesFTE
buf_create();
Creates a new string buffer object (arbitrary length string arrays that are handled by the engine).
buf_del(float bufhandle)
ServerClientMenu
DarkPlacesFTE
buf_del(buf);
Deletes a string buffer object (arbitrary length string arrays that are handled by the engine).
buf_getsize(float bufhandle)
ServerClientMenu
DarkPlacesFTE
buf_getsize(buf);
Returns string buffer array size.
buf_copy(float bufhandle_from, float bufhandle_to)
ServerClientMenu
DarkPlacesFTE
buf_copy(src, dest);
Copies one buffer to another.
buf_sort(float bufhandle, float sortpower, float backward)
ServerClientMenu
DarkPlacesFTE
buf_sort(buf, sortpower, backward);
Sorts buffer content.
buf_implode(float bufhandle, string glue)
ServerClientMenu
DarkPlacesFTE
buf_implode(buf, ",");
Joins buffer elements into string.
bufstr_get(float bufhandle, float string_index)
ServerClientMenu
DarkPlacesFTE
bufstr_get(buf, index);
Gets string from buffer.
bufstr_set(float bufhandle, float string_index, string str)
ServerClientMenu
DarkPlacesFTE
bufstr_set(buf, index, "val");
Sets buffer string at index.
bufstr_add(float bufhandle, string str, float order)
ServerClientMenu
DarkPlacesFTE
bufstr_add(buf, "val", order);
Adds string to buffer.
bufstr_free(float bufhandle, float string_index)
ServerClientMenu
DarkPlacesFTE
bufstr_free(buf, string_index);
Frees buffer string memory.
buf_cvarlist(float bufhandle, string pattern, string antipattern)
ServerClientMenu
DarkPlacesFTE
buf_cvarlist(buf, pattern, antipattern);
Functions to list cvars and store their names into a stringbuffer cvars that start with pattern but not with antipattern will be stored into the buffer.
bufstr_find(float bufhandle, string match, float matchrule, float startpos, float step)
ServerClientMenu
DarkPlacesFTE
bufstr_find(buf, "needle", matchrule, startpos, step);
Returns string index.
matchpattern(string s, string pattern, float matchrule)
ServerClientMenu
DarkPlacesFTE
matchpattern("text", "t*", matchrule);
Pattern match test. Returns 0/1. Provides a set of functions to manipulate with string buffers
pattern wildcards: * - any character (or no characters), ? - any 1 character
Warning: This extension is work-in-progress, it may be changed/revamped/removed at any time, dont use it if you dont want any trouble
Note: UTF8 is not supported yet.
matchpatternofs(string s, string pattern, float matchrule, float pos)
ServerClientMenu
DarkPlacesFTE
matchpatternofs("text", "t*", matchrule, 1);
Pattern match at offset. Provides a set of functions to manipulate with string buffers
pattern wildcards: * - any character (or no characters), ? - any 1 character
Warning: This extension is work-in-progress, it may be changed/revamped/removed at any time, dont use it if you dont want any trouble
Note: UTF8 is not supported yet
tokenizebyseparator(string s, string separator1, ...)
ServerClientMenu
DarkPlacesFTE
tokenizebyseparator("a,b", ",");
This function returns tokens separated by any of the supplied separator strings, example:
numnumbers = tokenizebyseparator("10.2.3.4", ".");
Returns 4 and the tokens are "10" "2" "3" "4"
Possibly useful for parsing IPv4 addresses (such as "1.2.3.4") and IPv6 addresses (such as "[1234:5678:9abc:def0:1234:5678:9abc:def0]:26000").
tokenize(string s)
ServerClientMenu
DarkPlacesFTE
tokenize("one two");
Splits string into tokens.
infoadd(string info, string key, string value, ...)
ServerClientMenu
DarkPlacesFTE
infoadd("key1\nval1\n", "key2", "val2");
Sets or adds a key/value pair to an infostring - note: forbidden characters are \ and "
infoget(string info, string key)
ServerClientMenu
DarkPlacesFTE
infoget("key\nvalue", "key");
Gets a key/value pair in an infostring, returns value or null if not found.
uri_escape(string in)
ServerClientMenu
DarkPlacesFTE
uri_escape("hello world");
Escapes URI components.
uri_unescape(string in)
ServerClientMenu
DarkPlacesFTE
uri_unescape("hello%20world");
Unescapes URI components.
validstring(string str)
ServerClientMenu
DarkPlacesFTE
validstring("hello");
Checks if string is valid.
altstr_count(string str)
ServerClientMenu
DarkPlacesFTE
altstr_count("listname");
Returns count of entries in altstr.
altstr_prepare(string str)
ServerClientMenu
DarkPlacesFTE
altstr_prepare("listname", size);
Initializes altstr table.
altstr_get(string str)
ServerClientMenu
DarkPlacesFTE
altstr_get("listname", index);
Gets string from altstr index.
altstr_set(string str)
ServerClientMenu
DarkPlacesFTE
altstr_set("listname", index, "value");
Sets string in altstr index.
altstr_ins(string str)
ServerClientMenu
DarkPlacesFTE
altstr_ins("listname", index, "value");
Inserts string into altstr at index.
Entity
37spawn()
ServerClientMenu
WinQuakeDarkPlacesFTE
entity e = spawn();
Creates a new entity, totally empty. You can manually set every field, or just set the origin and call one of the existing entity setup functions
remove(entity e)
ServerClientMenu
WinQuakeDarkPlacesFTE
remove(self);
Removes (deletes) an entity from the world.
copyentity(entity from, entity to)
ServerClientMenu
DarkPlacesFTE
copyentity(from, to);
Copies all data in the entity to another entity.
setorigin(entity e, vector o)
ServerClient
WinQuakeDarkPlacesFTE
setorigin(self, '0 0 0');
Sets an entity's position. Move an entity to a given location. That function is to be used when spawning an entity or when teleporting it. This is the only valid way to move an object without using the physics of the world (setting velocity and waiting). DO NOT change directly e.origin, otherwise internal links and entity clipping may be invalidated.
setsize(entity e, vector min, vector max)
ServerClient
WinQuakeDarkPlacesFTE
setsize(self, mins, maxs);
Sets the bounding box size of an entity.
setattachment(entity e, entity tagentity, string tagname)
Server
DarkPlacesFTE
setattachment(child, parent);
Attachs e entity to a tag on tagentity
NOTE: use "" to attach to entity origin/angles instead of a tag.
entityfieldname(float fieldnum)
ServerClientMenu
DarkPlacesFTE
entityfieldname(ent, fieldIndex);
Returns the name as a string, eg. "origin" or "classname" or whatever.
entityfieldtype(float fieldnum)
ServerClientMenu
DarkPlacesFTE
entityfieldtype(ent, fieldIndex);
Returns a value that the constants represent, but the field may be of another type in more exotic progs.dat formats or compilers. String = 1, Float = 2, Vector = 3, Entity = 4, Function = 6.
putentityfieldstring(float fieldnum, entity ent, string s)
ServerClientMenu
DarkPlacesFTE
putentityfieldstring(ent, fieldName, "value");
Puts the data returned by getentityfieldstring back into the entity.
getentityfieldstring(float fieldnum, entity ent)
ServerClientMenu
DarkPlacesFTE
getentityfieldstring(ent, fieldName);
Returns data as would be written to a savegame, eg... "0.05" (float), "0 0 1" (vector), or "Hello World!" (string). Function names can also be returned.
edict_num(float entnum)
ServerClient
DarkPlacesFTE
edict_num(entnum);
Returns the entity corresponding to a given number, this works even for freed entities, but you should call wasfreed(ent) to see if is currently active.
wasfreed(entity ent)
ServerClient
DarkPlacesFTE
wasfreed(ent);
Returns the entity corresponding to a given number, this works even for freed entities, but you should call wasfreed(ent) to see if is currently active.
num_for_edict(entity num)
ServerClient
DarkPlacesFTE
num_for_edict(num);
Returns the number of an entity.
makestatic(entity e)
ServerClient
WinQuakeDarkPlacesFTE
makestatic(ent);
Make an entity static to the world, by sending a broadcast message to the network. The entity is then removed from the list of dynamic entities in the world, and it cannot be deleted (until the level ends).
nextent(entity e)
ServerClientMenu
WinQuakeDarkPlacesFTE
nextent(e);
Returns entity that is just after e in the entity list. Useful to browse the list of entities, because it skips the undefined ones.
loadfromdata(string s)
ServerClientMenu
DarkPlacesFTE
loadfromdata(data);
Loads entity from a string.
loadfromfile(string s)
ServerClientMenu
DarkPlacesFTE
loadfromfile("state.dat");
Loads entity from file.
writetofile(float fh, entity e)
ServerClientMenu
DarkPlacesFTE
writetofile(file_handle, ent);
Writes entity to file.
parseentitydata(entity e, string s)
ServerClientMenu
DarkPlacesFTE
parseentitydata(entity, "worldspawn { }");
Parses entity data.
setspawnparms(entity client)
Server
WinQuakeDarkPlacesFTE
setspawnparms(client);
Set parm1... to the values at level start for coop respawn. Restore the original spawn parameters of a client entity. Doesn't work if client is not a player.
find(entity start, .string fld, string match)
ServerClientMenu
WinQuakeDarkPlacesFTE
find(start, field, value);
Where: start is the beginning of list to search (world, for the beginning of list); field is the entity field that must be examined (ex: targetname); match is the value that must be matched (ex: other.target). Returns the entity found, or world if no entity was found. Searches the server entity list beginning at start, looking for an entity that has entity.field = match
findradius(vector org, float rad)
ServerClient
WinQuakeDarkPlacesFTE
findradius(origin, radius);
Where: origin is the origin of sphere; radius is the radius of sphere. Returns a chain of entities that have their origins within a spherical area. The entity returned is e, and the next in the chain is e.chain, until e == FALSE. Typical usage: find and harm the victims of an explosion.
findchain(.string fld, string match)
ServerClient
DarkPlacesFTE
findchain(field, match);
Similar to find() but returns a chain of entities like findradius.
findradius_tofield(vector org, float rad, .entity tofield)
ServerClient
DarkPlacesFTE
findradius_tofield(origin, radius, field);
Similar to findchain() etc, but stores the chain into .tofield instead of .chain.
findchain_tofield(.string fld, string match, .entity tofield)
ServerClient
DarkPlacesFTE
findchain_tofield(field, value);
Similar to findchain() etc, but stores the chain into .tofield instead of .chain.
findchainflags_tofield(.float fld, float match, .entity tofield)
ServerClient
DarkPlacesFTE
findchainflags_tofield(field, flags);
Similar to findchain() etc, but stores the chain into .tofield instead of .chain.
findchainfloat_tofield(.float fld, float match, .entity tofield)
ServerClient
DarkPlacesFTE
findchainfloat_tofield(field, value);
Similar to findchain() etc, but stores the chain into .tofield instead of .chain.
findchainflags(.float fld, float match)
ServerClientMenu
DarkPlacesFTE
findchainflags(flags);
Similar to findflags() but returns a chain of entities like findradius.
findchainentity(.entity fld, entity match)
ServerClientMenu
DarkPlacesFTE
findchainentity(type);
Similar to findentity()/findfloat() but returns a chain of entities like findradius.
findchainfloat(.float fld, float match)
ServerClientMenu
DarkPlacesFTE
findchainfloat(field, value);
Similar to findentity()/findfloat() but returns a chain of entities like findradius.
findflags(entity start, .float fld, float match)
ServerClientMenu
DarkPlacesFTE
findflags(start_ent, flag_field, FL_ONGROUND);
Finds an entity with the specified flag set in the field, similar to find().
findentity(entity start, .entity fld, entity match)
ServerClientMenu
DarkPlacesFTE
findentity(world, owner, other);
Finds an entity, similar to find(), but for entity fields.
findfloat(entity start, .float fld, float match)
ServerClientMenu
DarkPlacesFTE
findfloat(world, field, value);
Finds an float field value, similar to find(), but for float fields.
findchainstring(.string field, string match)
ServerClientMenu
DarkPlacesFTE
findchainstring(field, "value");
Similar to findchain(), but for string field. Finds entities by string field match.
getentity(float entitynum, float fldnum)
Client
DarkPlacesFTE
getentity(index, field_num);
Allows to query parms from render entities, especially useful with attaching CSQC ents to server entities networked and interpolated by engine (monsters, players), number of entity is it's SVQC number you can send it via tempentity/CSQC entity message.
NOTE: this builtin doesnt know about entity removing/reallocating so it's meaning to work for short period of time, dont use it on missiles/grenades whatever will be removed next five seconds.
getentityvec(float entitynum, float fldnum)
Client
DarkPlacesFTE
getentityvec(index, fldnum);
Allows to query parms from render entities, especially useful with attaching CSQC ents to server entities networked and interpolated by engine (monsters, players), number of entity is it's SVQC number you can send it via tempentity/CSQC entity message.
NOTE: this builtin doesnt know about entity removing/reallocating so it's meaning to work for short period of time, dont use it on missiles/grenades whatever will be removed next five seconds.
numentityfields()
ServerClientMenu
DarkPlacesFTE
numentityfields(entity);
Gets number of fields on entity.
setcolor(entity ent, float colors)
Server
WinQuakeDarkPlacesFTE
selfcolor(ent, 16);
Sets the color on a client and updates internal color information accordingly (equivalent to stuffing a "color" command but immediate).
entitybyindex(float num)
ServerClient
DarkPlacesFTE
entitybyindex(0);
Returns entity by index.
Networking
35clienttype(entity client)
Server
WinQuakeDarkPlacesFTE
clienttype(self);
Returns type of connected client.
float CLIENTTYPE_DISCONNECTED = 0;
float CLIENTTYPE_REAL = 1;
float CLIENTTYPE_BOT = 2;
float CLIENTTYPE_NOTACLIENT = 3;
dropclient(entity client)
Server
WinQuakeDarkPlacesFTE
dropclient(self);
Disconnects client from server. Causes the server to immediately drop the client, more reliable than stuffcmd(clent, "disconnect\n"); which could be intentionally ignored by the client engine.
spawnclient()
Server
WinQuakeDarkPlacesFTE
spawnclient();
Like spawn, but for client slots (also calls relevant connect/spawn functions), returns world if no clients available.
clientstate()
ServerClientMenu
DarkPlacesFTE
clientstate(self);
Returns the state of a client.
client state constants:
float CS_DEDICATED = 0;
float CS_DISCONNECTED = 1;
float CS_CONNECTED = 2;
clientcount()
ServerClientMenu
DarkPlacesFTE
clientcount();
Returns number of connected clients.
WriteByte(float to, float value)
ServerClientMenu
WinQuakeDarkPlacesFTE
msg_entity = self;
WriteByte(MSG_ONE, SVC_TEMPENTITY);
WriteByte(MSG_ONE, TE_GAMEJOINGRANTED);
Writes a byte to the message buffer. These are some of message types defined in the Quake network protocol. Values are used by the WriteByte() function.
SVC_SETVIEWPORT = 5;
SVC_SETANGLES = 10;
SVC_TEMPENTITY = 23;
SVC_KILLEDMONSTER = 27;
SVC_FOUNDSECRET = 28;
SVC_INTERMISSION = 30;
SVC_FINALE = 31;
SVC_CDTRACK = 32;
SVC_SELLSCREEN = 33;
SVC_UPDATE = 128;
WriteChar(float to, float value)
ServerClientMenu
WinQuakeDarkPlacesFTE
WriteChar(client, str2chr("A", 0));
Writes a character to the message buffer.
WriteShort(float to, float value)
ServerClientMenu
WinQuakeDarkPlacesFTE
WriteShort(client, 300);
Writes a short integer to the buffer.
WriteLong(float to, float value)
ServerClientMenu
WinQuakeDarkPlacesFTE
WriteLong(client, 65536);
Writes a long integer to the buffer.
WriteCoord(float to, float value)
ServerClientMenu
WinQuakeDarkPlacesFTE
// Spawn a brown particle manually
WriteByte(MSG_BROADCAST, 18);
WriteCoord(MSG_BROADCAST, pos.x);
WriteCoord(MSG_BROADCAST, pos.y);
WriteCoord(MSG_BROADCAST, pos.x);
WriteChar(MSG_BROADCAST, vel.x * 16);
WriteChar(MSG_BROADCAST, vel.y * 16);
WriteChar(MSG_BROADCAST, vel.z * 16);
WriteByte(MSG_BROADCAST, 1);
WriteByte(MSG_BROADCAST, 225);
Writes a single map coordinate value to the current network message. Server commands normally expect three of these sequentially to mark the x, y, and z positions for a position argument.
WriteAngle(float to, float value)
ServerClientMenu
WinQuakeDarkPlacesFTE
msg_entity = player;
WriteByte(MSG_ONE, SVC_SETVIEWANGLES);
WriteAngle( MSG_ONE, camera.angles_x);
WriteAngle( MSG_ONE, camera.angles_y);
WriteAngle( MSG_ONE, camera.angles_z);
This function writes a single byte, that represents 256 * (angle / 380). Writes a single angle value to the current network message. Server commands normally expect three of these sequentially to mark the pitch, yaw, and roll angles for an angle argument.
WriteString(float to, string value)
ServerClientMenu
WinQuakeDarkPlacesFTE
// Print a message to a specific player
msg_entity = player;
WriteByte(MSG_ONE, 8);
WriteString(MSG_ONE, "Hello there!");(float to, string value)
Writes a null-terminated string.
WriteUnterminatedString(float to, string value)
Server
DarkPlacesFTE
WriteUnterminatedString(client, "hi");
Like WriteString, but does not write a terminating 0 after the string. This means you can include things like a player's netname in the middle of a string sent over the network. Just be sure to end it up with either a call to WriteString (which includes the trailing 0) or WriteByte(0) to terminate it yourself.
NOTE: this extension was suggested by FrikaC years ago, more recently Shadowalker has been badmouthing LadyHavoc and Spike for stealing 'his' extension writestring2 which does exactly the same thing but uses a different builtin number and name and extension string, this argument hinges on the idea that it was his idea in the first place, which is incorrect as FrikaC first suggested it and used a rough equivilant of it in his FrikBot mod years ago involving WriteByte calls on each character.
WriteEntity(float to, entity e)
ServerClientMenu
WinQuakeDarkPlacesFTE
// Change everyone's view point
WriteByte(MSG_ALL, 5);
WriteEntity(MSG_ALL, cameraEntity);
This function writes an entity reference, taking two bytes. Writes the index for an entity to the current network message. This is used for server commands that expect entity arguments.
WritePicture(float to, string s, float sz)
Server
DarkPlacesFTE
WritePicture(client, "img.tga", size);
Writes a picture to the data stream so CSQC can read it using ReadPicture, which has the definition
string(void) ReadPicture = #501;
The picture data is sent as at most sz bytes, by compressing to low quality JPEG. The data being sent will be equivalent to:
WriteString(to, s);
WriteShort(to, imagesize);
for(i = 0; i < imagesize; ++i) WriteByte(to, [the i-th byte of the compressed JPEG image]);
WriteFloat(float to, float value)
Server
DarkPlacesFTE
WriteFloat(MSG_ALL, 1.23);
Writes a float value.
SendEntity(entity playerent, float changedflags)
ServerClient
DarkPlacesFTE
SendEntity(self);
Sends entity state over network. In this function, the entity which is being sent is self.
The viewer parameter is the client entity to whom the entity is being sent.
The return value should be TRUE if the entity is to be sent to that client, and FALSE if it not to be.
Inside this function, the core builtins WriteCoord, WriteAngle, WriteByte, WriteShort, WriteLong are used with the destination parameter MSG_ENTITY, indicating that the data is part of a CSQC entity update.
uri_get(string url, float id)
ServerClientMenu
DarkPlacesFTE
uri_get("http://example.com", id);
Performs HTTP GET request. Loads text from an URL into a string. Returns 1 on success of initiation, 0 if there are too many concurrent connections already or if the URL is invalid the following callback will receive the data and MUST exist!
void(float id, float status, string data) URI_Get_Callback;
status is either negative for an internal error, 0 for success, or the HTTP response code on server error (e.g. 404).
If 1 is returned by uri_get, the callback will be called in the future.
uri_post(string url, float id, string content_type, string data)
ServerClientMenu
DarkPlacesFTE
uri_post("http://example.com", id, "application/json", "data=1");
Performs HTTP POST request. Loads text from an URL into a string after POSTing via HTTP. Works like uri_get, but uri_post sends data with Content-Type: content_type to the server and uri_post sends the string buffer buf, joined using the delimiter delim.
uri_postbuf(string url, float id, string content_type, string delim, float buf)
ServerClientMenu
DarkPlacesFTE
uri_postbuf("http://example.com", id, "application/json", delim, buf);
POST request with buffer.
getplayerkeyvalue(float playernum, string keyname)
ServerClient
DarkPlacesFTE
getplayerkeyvalue(self, "name");
Gets a player config key.
serverkey(string key)
ServerClient
DarkPlacesFTE
serverkey("version");
Gets server-specific info string.
gethostcachevalue(float type)
Menu
DarkPlacesFTE
gethostcachevalue(0, "name");
Gets host list value.
gethostcachestring(float type, float hostnr)
Menu
DarkPlacesFTE
gethostcachestring();
Gets full host cache as string.
netaddress_resolve(string dnsname, optional float defport)
ServerClientMenu
DarkPlacesFTE
netaddress_resolve("example.com");
Resolves hostname to IP.
ReadByte()
Client
DarkPlacesFTE
ReadByte();
Reads byte from network message, pair with WriteByte.
ReadChar()
Client
DarkPlacesFTE
ReadChar();
Reads char from network message.
ReadShort()
Client
DarkPlacesFTE
ReadShort();
Reads a signed 16-bit value. Paired with WriteShort.
ReadLong()
Client
DarkPlacesFTE
ReadLong();
Reads a signed 32-bit value. Paired with WriteLong or WriteInt.
ReadCoord()
Client
DarkPlacesFTE
ReadCoord();
Reads float coordinate. Reads a value matching the unspecified precision written ONLY by WriteCoord.
ReadAngle()
Client
DarkPlacesFTE
ReadAngle();
Reads float angle.
ReadString()
Client
DarkPlacesFTE
ReadString();
Reads null-terminated string.
ReadFloat()
Client
DarkPlacesFTE
ReadFloat();
Reads a float without any truncation nor conversions. Data MUST have originally been written with WriteFloat.
ReadPicture()
Client
DarkPlacesFTE
ReadPicture();
Reads a picture that was written by ReadPicture, and returns a name that can be used in drawpic and other 2d drawing functions. In FTE, this acts as a readstring-with-downloadcheck - the image will appear normally once it has been downloaded, but its size may be incorrect until then.
Effects (te_)
30effect(vector org, string modelname, float startframe, float endframe, float framerate)
ServerClient
DarkPlacesFTE
effect(origin, "models/explotion.spr", 0, 32, 0.1);
Clientside playback of simple custom sprite effects (explosion sprites, etc).
te_blood(vector org, vector velocity, float howmany)
ServerClient
DarkPlacesFTE
te_blood(origin, velocity, howmany);
Blood spray effect.
vector origin
byte xvelocity (-128 to +127)
byte yvelocity (-128 to +127)
byte zvelocity (-128 to +127)
byte count (0 to 255, how much blood)
te_bloodshower(vector mincorner, vector maxcorner, float explosionspeed, float howmany)
ServerClient
DarkPlacesFTE
te_bloodshower(vec_min, vec_max, speed, howmany);
Creates an exploding shower of blood, for making gibbings more convincing.
te_customflash(vector org, float radius, float lifetime, vector color)
ServerClient
DarkPlacesFTE
te_customflash(origin, radius, lifetime, color);
Creates a customized light flash.
te_explosionrgb(vector org, vector color)
ServerClient
DarkPlacesFTE
te_explosionrgb(origin, rgb);
Colored explosion effect.
te_flamejet(vector org, vector vel, float howmany)
ServerClient
DarkPlacesFTE
te_flamejet(origin, velocity, howmany);
Creates a single puff of flame particles.
te_particlecube(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter)
ServerClient
DarkPlacesFTE
te_particlecube(v_min, v_max, vel, howmany, color, gravityflag, randomveljitter);
Creates a cloud of particles, useful for forcefields but quite customizable.
te_particlerain(vector mincorner, vector maxcorner, vector vel, float howmany, float color)
ServerClient
DarkPlacesFTE
te_particlerain(mins, maxs, vel, howmany, color);
Rain particle effect.
te_particlesnow(vector mincorner, vector maxcorner, vector vel, float howmany, float color)
ServerClient
DarkPlacesFTE
te_particlesnow(mins, maxs, vel, howmany, color);
Snow particle effect.
te_plasmaburn(vector org)
ServerClient
DarkPlacesFTE
te_plasmaburn(origin);
Plasma burn effect.
te_gunshotquad(vector org)
ServerClient
DarkPlacesFTE
te_gunshotquad(origin);
Quad gunshot effect.
te_spikequad(vector org)
ServerClient
DarkPlacesFTE
te_spikequad(origin);
Quad spike impact effect.
te_superspikequad(vector org)
ServerClient
DarkPlacesFTE
te_superspikequad(origin);
Quad superspike effect.
te_explosionquad(vector org)
ServerClient
DarkPlacesFTE
te_explosionquad(origin);
Quad explosion effect.
te_smallflash(vector org)
ServerClient
DarkPlacesFTE
te_smallflash(origin);
Small flash effect.
te_spark(vector org, vector vel, float howmany)
ServerClient
DarkPlacesFTE
te_spark(origin, velocity, howmany);
Spark effect.
te_gunshot(vector org, optional float count)
ServerClient
DarkPlacesFTE
te_gunshot(origin);
Gunshot effect.
te_spike(vector org)
ServerClient
DarkPlacesFTE
te_spike(origin);
Spike impact effect.
te_superspike(vector org)
ServerClient
DarkPlacesFTE
te_superspike(origin);
Superspike impact effect.
te_explosion(vector org)
ServerClient
DarkPlacesFTE
te_explosion(origin);
Standard explosion effect.
te_tarexplosion(vector org)
ServerClient
DarkPlacesFTE
te_tarexplosion(origin);
TAR explosion effect.
te_wizspike(vector org)
ServerClient
DarkPlacesFTE
te_wizspike(origin);
Wizard spike effect.
te_knightspike(vector org)
ServerClient
DarkPlacesFTE
te_knightspike(origin);
Knight spike effect.
te_lavasplash(vector org)
ServerClient
DarkPlacesFTE
te_lavasplash(origin);
Lava splash effect.
te_teleport(vector org)
ServerClient
DarkPlacesFTE
te_teleport(origin);
Teleport flash effect.
te_explosion2(vector org, float colorstart, float colorlength)
ServerClient
DarkPlacesFTE
te_explosion2(origin, color, colorlength);
Alternate explosion effect.
te_lightning1(entity own, vector start, vector end)
ServerClient
DarkPlacesFTE
te_lightning1(owner_ent, start, end);
Lightning bolt type 1.
te_lightning2(entity own, vector start, vector end)
ServerClient
DarkPlacesFTE
te_lightning2(owner_ent, start, end);
Lightning bolt type 2.
te_lightning3(entity own, vector start, vector end)
ServerClient
DarkPlacesFTE
te_lightning3(owner_ent, start, end);
Lightning bolt type 3.
te_beam(entity own, vector start, vector end)
ServerClient
DarkPlacesFTE
te_beam(owner_ent, start, end);
Draws a beam effect.
Math / Vectors
29sin(float a)
ServerClientMenu
DarkPlacesFTE
sin(90);
Sine of angle in degrees.
cos(float a)
ServerClientMenu
DarkPlacesFTE
cos(0);
Cosine of angle in degrees.
sqrt(float a)
ServerClientMenu
DarkPlacesFTE
sqrt(4);
Square root of a number.
fabs(float v)
ServerClientMenu
WinQuakeDarkPlacesFTE
fabs(-1.5);
Returns absolute value of val (like the equivalent function in C).
floor(float v)
ServerClientMenu
WinQuakeDarkPlacesFTE
floor(1.8);
Returns val, rounded up to the integer below (like the equivalent function in C).
ceil(float v)
ServerClientMenu
WinQuakeDarkPlacesFTE
ceil(1.2);
Returns val, rounded up to the integer above (like the equivalent function in C).
rint(float v)
ServerClientMenu
WinQuakeDarkPlacesFTE
rint(1.6);
Rounds to nearest int.
pow(float a, float b)
ServerClientMenu
DarkPlacesFTE
pow(2, 3);
Raises to power.
min(float a, float b, ...)
ServerClientMenu
DarkPlacesFTE
min(1, 2, 3);
Returns the lowest of all the supplied numbers.
max(float a, float b, ...)
ServerClientMenu
DarkPlacesFTE
max(1, 2, 3);
Returns the highest of all the supplied numbers.
log(float a)
ServerClientMenu
DarkPlacesFTE
log(10);
Natural logarithm.
mod(float a, float b)
ServerClientMenu
DarkPlacesFTE
mod(10, 3);
Modulus operation.
bound(float minimum, float val, float maximum)
ServerClientMenu
DarkPlacesFTE
bound(min, val, max);
Clamps the value to the range and returns it.
random()
ServerClientMenu
WinQuakeDarkPlacesFTE
random();
Returns random float (0-1).
randomvec()
ServerClientMenu
DarkPlacesFTE
randomvec();
Returns a vector of length < 1, much quicker version of this QC.
bitshift(float number, float quantity)
ServerClient
DarkPlacesFTE
bitshift(1, 2);
Multiplies number by a power of 2 corresponding to quantity (0 = *1, 1 = *2, 2 = *4, 3 = *8, -1 = /2, -2 = /4x, etc), and rounds down (due to integer math) like other bit operations do (& and | and the like).
normalize(vector v)
ServerClientMenu
WinQuakeDarkPlacesFTE
normalize(v);
Returns a vector of length 1.
vlen(vector v)
ServerClientMenu
WinQuakeDarkPlacesFTE
vlen(v);
Returns vector length.
vectoyaw(vector v)
ServerClientMenu
WinQuakeDarkPlacesFTE
vectoyaw(v);
Returns an angle in degrees. Vector to yaw: calculates the yaw angle (bearing) corresponding to a given 3D direction.
vectoangles(vector v)
ServerClientMenu
WinQuakeDarkPlacesFTE
vectoangles(v);
Vector to angles: calculates the pitch angle (aiming) and yaw angle (bearing) corresponding to a given 3D direction.
vectoangles2(vector forward, vector up)
ServerClient
DarkPlacesFTE
vectoangles2(forward, up);
Variant of vectoangles that takes an up vector to calculate roll angle (also uses this to calculate yaw correctly if the forward is straight up or straight down).
vectorvectors(vector dir)
ServerClient
DarkPlacesFTE
vectorvectors(dir);
Creates v_forward, v_right, and v_up vectors given a forward vector, similar to makevectors except it takes a forward direction vector instead of angles.
makevectors(vector ang)
ServerClient
WinQuakeDarkPlacesFTE
makevectors(self.angles);
Calculates v_forward/v_right/v_up from angles.
asin(float s)
ServerClient
DarkPlacesFTE
asin(0.5);
Returns angle in radians for a given sin() value, the result is in the range -PI*0.5 to PI*0.5
acos(float c)
ServerClient
DarkPlacesFTE
acos(0.5);
Returns angle in radians for a given cos() value, the result is in the range 0 to PI.
atan(float t)
ServerClient
DarkPlacesFTE
atan(1);
Returns angle in radians for a given tan() value, the result is in the range -PI*0.5 to PI*0.5.
atan2(float c, float s)
ServerClient
DarkPlacesFTE
atan2(y, x);
Returns angle in radians for a given cos() and sin() value pair, the result is in the range -PI to PI (this is identical to vectoyaw except it returns radians rather than degrees).
tan(float a)
ServerClient
DarkPlacesFTE
tan(45);
Returns tangent value (which is simply sin(a)/cos(a)) for the given angle in radians, the result is in the range -infinity to +infinity
File I/O
23setmodel(entity e, string m)
ServerClient
WinQuakeDarkPlacesFTE
setmodel(self, "progs/player.mdl");
Assigns a model to an entity.
buf_loadfile(string filename, float bufhandle)
ServerClientMenu
DarkPlacesFTE
buf_loadfile("file.txt", buf);
Append each line of file as new buffer string, return 1 if succesful.
buf_writefile(float filehandle, float bufhandle, float startpos, float numstrings)
ServerClientMenu
DarkPlacesFTE
buf_writefile(file_handle, buf_handle, startpos, numstrings);
Writes buffer strings as lines, returns 1 if succesful
fopen(string filename, float mode)
ServerClientMenu
DarkPlacesFTE
fopen("data.txt", "r");
Opens a file inside quake/gamedir/data/ (mode is FILE_READ, FILE_APPEND, or FILE_WRITE), returns fhandle >= 0 if successful, or fhandle < 0 if unable to open file for any reason.
fclose(float fhandle)
ServerClientMenu
DarkPlacesFTE
fclose(f);
Closes an open file handle.
fgets(float fhandle)
ServerClientMenu
DarkPlacesFTE
fgets(f);
Reads a line of text from the file and returns as a tempstring.
fputs(float fhandle, string s, ...)
ServerClientMenu
DarkPlacesFTE
fputs(f, "text");
Writes a string to file.
fcopy(string src, string dst)
Server
Wrath DarkPlacesFTE
fcopy("a.txt", "b.txt");
Copies one file to another.
frename(string src, string dst)
Server
Wrath DarkPlacesFTE
frename("old.txt", "new.txt");
Renames a file.
fremove(string fname)
Server
Wrath DarkPlacesFTE
fremove("file.txt");
Deletes a file.
fexists(string fname)
Server
Wrath DarkPlacesFTE
fexists("data.txt");
Checks if a file exists.
rmtree(string path)
Server
Wrath DarkPlacesFTE
rmtree("folder");
Deletes directory and contents.
precache_model(string s)
ServerClient
WinQuakeDarkPlacesFTE
precache_model("progs/weapon.mdl");
Preloads a model.
precache_model2(string s)
Server
WinQuakeDarkPlacesFTE
precache_model2("model.mdl");
Preloads model only for purchased Quake.
precache_file(string s)
ServerClientMenu
WinQuakeDarkPlacesFTE
precache_file("maps/test.bsp");
Preloads a file.
precache_file2(string s)
Server
WinQuakeDarkPlacesFTE
precache_file2("file.txt", 1);
Preloads file for purchased Quake.
whichpack(string filename, optional enumflags:float{WP_REFERENCEPACKAGE,WP_FULLPACKAGEPATH} flags)
ServerClientMenu
DarkPlacesFTE
whichpack("maps/start.bsp");
For files in a pak/pk3, returns the pack's file name in FRIK_FILE name space.
search_packfile_begin(string pattern, float caseinsensitive, float quiet, string packfile)
ServerClientMenu
DarkPlacesFTE
search_packfile_begin("id1/pak0.pak", "*.mdl");
Extension to search_begin (DP_QC_FS_SEARCH), performs a filename search with the specified pattern (for example "maps/*.bsp") and stores the results in a search slot (minimum of 128 supported by any engine with this extension), the other functions take this returned search slot number, be sure to search_free when done (they are also freed on progs reload).
search_begin(string pattern, float caseinsensitive, float quiet)
ServerClientMenu
DarkPlacesFTE
search_begin("maps/*.bsp");
Performs a filename search with the specified pattern (for example "maps/*.bsp") and stores the results in a search slot (minimum of 128 supported by any engine with this extension), the other functions take this returned search slot number, be sure to search_free when done (they are also freed on progs reload).
search_end(float handle)
ServerClientMenu
DarkPlacesFTE
search_end();
Frees a search slot (also done at progs reload).
search_getsize(float handle)
ServerClientMenu
DarkPlacesFTE
search_getsize();
Returns how many filenames were found.
search_getfilename(float handle, float num)
ServerClientMenu
DarkPlacesFTE
search_getfilename();
Returns a filename from the search.
Console / Commands
18stuffcmd(entity client, string s, ...)
ServerClient
WinQuakeDarkPlacesFTE
stuffcmd(self, "cmd");
Send a command to a given player, as if it had been typed on the player's console.
localcmd(string s, ...)
ServerClient
WinQuakeDarkPlacesFTE
localcmd("sv_gravity 800\n");
Execute a command on the server, as if it had been typed on the server's console.
registercommand(string cmdname)
Server
DarkPlacesFTE
registercommand("mycmd");
Registers new command.
registercvar(string name, string value, float flags)
ServerClientMenu
DarkPlacesFTE
registercvar("sv_test", "1", 0);
Adds a new console cvar to the server console (in singleplayer this is the player's console), the cvar exists until the mod is unloaded or the game quits.
cvar(string name)
ServerClientMenu
WinQuakeDarkPlacesFTE
cvar("sv_gravity");
Gets cvar value.
cvar_set(string var, string val)
ServerClientMenu
WinQuakeDarkPlacesFTE
cvar_set("sv_gravity", "800");
Sets cvar value.
cvar_defstring(string s)
ServerClientMenu
DarkPlacesFTE
cvar_defstring("name");
Returns the default value of a cvar, as a tempstring.
cvar_description(string name)
ServerClientMenu
DarkPlacesFTE
cvar_description("name");
Returns the description of a cvar.
cvar_string(string s)
ServerClientMenu
DarkPlacesFTE
cvar_string("name");
Returns the value of a cvar, as a tempstring.
cvar_type(string name)
ServerClientMenu
DarkPlacesFTE
cvar_type("name");
Gets cvar type (exists, saved, private, engine, hasdescription, readonly).
str_cvar(string name)
ServerClientMenu
DarkPlacesFTE
str_cvar("sv_gravity");
Gets string value of a cvar.
tokenize_console(string s)
ServerClientMenu
DarkPlacesFTE
tokenize_console(str);
This function returns tokens separated just like the console does.
argv_start_index(float i)
ServerClientMenu
DarkPlacesFTE
argv_start_index(i);
Returns the index of the first character of each token in the original string.
argv_end_index(float i)
ServerClientMenu
DarkPlacesFTE
argv_end_index(i);
Returns the index of the last character of each token in the original string.
clientcommand(entity e, string s)
ServerMenu
DarkPlacesFTE
clientcommand(self, "say hi");
Sends command to client.
argv(float n)
ServerClientMenu
DarkPlacesFTE
argv(0);
Gets argument from tokenized input.
cmd(string command, ...)
ServerClientMenu
DarkPlacesFTE
cmd("say", "hello");
Gets the input command name.
Input
16keynumtostring(float keynum)
ClientMenu
DarkPlacesFTE
keynumtostring(13);
Gets key name from key code.
stringtokeynum(string keyname)
ClientMenu
DarkPlacesFTE
stringtokeynum("ENTER");
Gets key code from key name.
getkeybind(float keynum)
Client
DarkPlacesFTE
getkeybind(K_F1);
Gets binding for key.
setcursormode(float usecursor, optional string cursorimage, optional vector hotspot, optional float scale)
Client
DarkPlacesFTE
setcursormode(1);
Sets mouse cursor mode.
getmousepos()
ClientMenu
DarkPlacesFTE
getmousepos();
Gets mouse position.
getinputstate(float inputsequencenum)
Client
DarkPlacesFTE
getinputstate(servercommandframe);
Gets key/button input state.
setsensitivityscale(float sens)
Client
DarkPlacesFTE
setsensitivityscale(0.5);
Scales mouse sensitivity.
getkeybind_bindmap(float key, float bindmap)
ClientMenu
DarkPlacesFTE
getkeybind_bindmap(K_F1, 0);
Gets bind from specific bindmap.
setkeybind_bindmap(float key, string bind, float bindmap)
ClientMenu
DarkPlacesFTE
setkeybind_bindmap(K_F1, "+show", 0);
Binds key in specific bindmap.
getbindmaps()
ClientMenu
DarkPlacesFTE
getbindmaps();
Gets active bindmaps.
setbindmaps(vector bm)
ClientMenu
DarkPlacesFTE
setbindmaps(bm);
Sets active bindmaps.
findkeysforcommand(string command, optional float bindmap)
ClientMenu
DarkPlacesFTE
findkeysforcommand("toggleconsole", 0);
Finds keys bound to a command.
setkeydest(float dest)
ClientMenu
DarkPlacesFTE
setkeydest(KEY_MENU);
Sets input destination.
getkeydest()
ClientMenu
DarkPlacesFTE
getkeydest();
Gets current key destination.
setmousetarget(float trg)
ClientMenu
DarkPlacesFTE
setmousetarget(MT_MENU);
Sets mouse target entity.
getmousetarget()
ClientMenu
DarkPlacesFTE
getmousetarget();
Gets current mouse target.
Skeleton / Bones
15skel_create(float modlindex)
ServerClient
DarkPlacesFTE
skel_create(modlindex);
Create a skeleton (be sure to assign this value into .skeletonindex for use), returns skeleton index (1 or higher) on success, returns 0 on failure (for example if the modelindex is not skeletal), it is recommended that you create a new skeleton if you change modelindex, as the skeleton uses the hierarchy from the model.
skel_build(float skel, entity ent, float modlindex, float retainfrac, float firstbone, float lastbone)
ServerClient
DarkPlacesFTE
skel_build(skel, ent, modlindex, retainfrac, firstbone, lastbone);
Blend in a percentage of standard animation, 0 replaces entirely, 1 does nothing, 0.5 blends half, etc, and this only alters the bones in the specified range for which out of bounds values like 0,100000 are safe (uses .frame, .frame2, .frame3, .frame4, .lerpfrac, .lerpfrac3, .lerpfrac4, .frame1time, .frame2time, .frame3time, .frame4time), returns skel on success, 0 on failure.
skel_get_numbones(float skel)
ServerClient
DarkPlacesFTE
skel_get_numbones(skel);
Returns how many bones exist in the created skeleton, 0 if skeleton does not exist.
skel_get_bonename(float skel, float bonenum)
ServerClient
DarkPlacesFTE
skel_get_bonename(skel, index);
Returns name of bone (as a tempstring), "" if invalid bonenum (< 1 for example) or skeleton does not exist.
skel_get_boneparent(float skel, float bonenum)
ServerClient
DarkPlacesFTE
skel_get_boneparent(skel, bonenum);
Returns parent num for supplied bonenum, 0 if bonenum has no parent or bone does not exist (returned value is always less than bonenum, you can loop on this).
skel_find_bone(float skel, string tagname)
ServerClient
DarkPlacesFTE
skel_find_bone(skel, "Bone");
Get number of bone with specified name, 0 on failure, bonenum (1-based) on success, same as using gettagindex but takes modelindex instead of entity.
skel_get_bonerel(float skel, float bonenum)
ServerClient
DarkPlacesFTE
skel_get_bonerel(skel, bonenum);
Get matrix of bone in skeleton relative to its parent - sets v_forward, v_right, v_up, returns origin (relative to parent bone).
skel_get_boneabs(float skel, float bonenum)
ServerClient
DarkPlacesFTE
skel_get_boneabs(skel, bonenum);
Get matrix of bone in skeleton in model space - sets v_forward, v_right, v_up, returns origin (relative to entity).
skel_set_bone(float skel, float bonenum, vector org)
ServerClient
DarkPlacesFTE
skel_set_bone(skel, bonenum, org);
Set matrix of bone relative to its parent, reads v_forward, v_right, v_up, takes origin as parameter (relative to parent bone).
skel_mul_bone(float skel, float bonenum, vector org)
ServerClient
DarkPlacesFTE
skel_mul_bone(skel, bonenum, org);
Transform bone matrix (relative to its parent) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bone).
skel_mul_bones(float skel, float startbone, float endbone, vector org)
ServerClient
DarkPlacesFTE
skel_mul_bones(skel, startbone, endbone, org);
Transform bone matrices (relative to their parents) by the supplied matrix in v_forward, v_right, v_up, takes origin as parameter (relative to parent bones).
skel_copybones(float skeldst, float skelsrc, float startbone, float endbone)
ServerClient
DarkPlacesFTE
skel_copybones(skeldst, skelsrc, startbone, endbone);
Copy bone matrices (relative to their parents) from one skeleton to another, useful for copying a skeleton to a corpse
skel_delete(float skel)
ServerClient
DarkPlacesFTE
skel_delete(skel);
Deletes skeleton at the beginning of the next frame (you can add the entity, delete the skeleton, renderscene, and it will still work).
frameforname(float modlindex, string framename)
ServerClient
DarkPlacesFTE
frameforname(modlindex, "idle");
Finds number of a specified frame in the animation, returns -1 if no match found.
frameduration(float modlindex, float framenum)
ServerClient
DarkPlacesFTE
frameduration(modlindex, framenum);
Returns the intended play time (in seconds) of the specified framegroup, if it does not exist the result is 0, if it is a single frame it may be a small value around 0.1 or 0.
Rendering
15clearscene()
Client
DarkPlacesFTE
clearscene();
CSQC builtin to clear the scene of all entities / reset our view properties.
addentities(float mask)
Client
DarkPlacesFTE
addentities(MASK_NORMAL | MASK_ENGINE | MASK_ENGINEVIEWMODELS);
Adds entities with these rendermask field var's to our view.
addentity(entity ent)
Client
DarkPlacesFTE
addentity(self);
Adds a single entity to the scene.
setproperty(float property, ...)
Client
DarkPlacesFTE
setproperty(VF_DRAWWORLD, 1);
Sets a render property on entity.
getproperty(float property)
Client
DarkPlacesFTE
getproperty(VF_DRAWWORLD);
Gets a scalar render property.
getpropertyvec(float property)
Client
DarkPlacesFTE
getpropertyvec(VF_ORIGIN);
Gets a vector render property.
renderscene()
Client
DarkPlacesFTE
renderscene();
Renders the composed client scene.
adddynamiclight(vector org, float radius, vector lightcolours)
Client
DarkPlacesFTE
adddynamiclight(pos, radius, color);
Renders a dynamic light at this frame.
adddynamiclight2(vector org, float radius, vector lightcolours, float style, string cubemapname, float pflags)
Client
DarkPlacesFTE
adddynamiclight2(pos, radius, color, style, cubemap, pflags);
Renders a dynamic light with more parameters.
R_BeginPolygon(string texturename, optional float flags, optional float is2d)
Client
DarkPlacesFTE
R_BeginPolygon("texture.tga", DRAWFLAG_NORMAL);
Starts a polygon definition.
R_PolygonVertex(vector org, vector texcoords, vector rgb, float alpha)
Client
DarkPlacesFTE
R_PolygonVertex(pos, texcoord, color, alpha);
Adds a vertex to the polygon.
R_EndPolygon()
Client
DarkPlacesFTE
R_EndPolygon();
Finishes polygon definition.
cs_unproject(vector v)
Client
DarkPlacesFTE
cs_unproject(screenpos);
Converts screen to world coordinates (S2W).
cs_project(vector v)
Client
DarkPlacesFTE
cs_project(pos);
Converts world to screen coordinates (W2S).
V_CalcRefdef(entity e, float refdefflags)
Client
DarkPlacesFTE
V_CalcRefdef();
Use this on the player entity after performing prediction.
Drawing / 2D
15drawline(float width, vector pos1, vector pos2, vector rgb, float alpha, optional float drawflag)
ClientMenu
DarkPlacesFTE
drawline(width, pos1, pos2, color, alpha, flag);
Draws a 2D line on screen.
iscachedpic(string name)
ClientMenu
DarkPlacesFTE
iscachedpic("pic.tga");
Checks if image is loaded in memory.
precache_pic(string name, optional float flags)
ClientMenu
DarkPlacesFTE
precache_pic("image.tga");
Preloads an image for drawing.
precache_cubemap(string name)
Client
DarkPlacesFTE
precache_cubemap("cubemaps/237nx.tga");
Preloads a cubemap texture.
draw_getimagesize(string picname)
ClientMenu
DarkPlacesFTE
draw_getimagesize("pic.tga");
Gets dimensions of an image.
freepic(string name)
ClientMenu
DarkPlacesFTE
freepic("pic.tga");
Frees cached image.
drawcharacter(vector position, float character, vector size, vector rgb, float alpha, optional float drawflag)
ClientMenu
DarkPlacesFTE
drawcharacter(pos, char, scale, color, alpha, flag);
Draws a single character.
drawstring(vector position, string text, vector size, vector rgb, float alpha, float drawflag)
ClientMenu
DarkPlacesFTE
drawstring(pos, "text", scale, color, alpha, flag);
Draws a string on screen.
drawpic(vector position, string pic, vector size, vector rgb, float alpha, optional float drawflag)
ClientMenu
DarkPlacesFTE
drawpic(pos, "image.tga", size, color, alpha, flag);
Draws an image.
drawfill(vector position, vector size, vector rgb, float alpha, optional float drawflag)
ClientMenu
DarkPlacesFTE
drawfill(pos1, size, color, alpha, flag);
Draws a filled box.
drawsetcliparea(float x, float y, float width, float height)
ClientMenu
DarkPlacesFTE
drawsetcliparea(x, y, w, h);
Sets a screen clip area.
drawresetcliparea()
ClientMenu
DarkPlacesFTE
drawresetcliparea();
Clears clip area restriction.
drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag)
ClientMenu
DarkPlacesFTE
drawcolorcodedstring(pos, "^1Red", scale, alpha, flag);
Draws colored string with ^ codes.
drawcolorcodedstring2(vector position, string text, vector scale, vector rgb, float alpha, float flag)
ClientMenu
DarkPlacesFTE
drawcolorcodedstring2(pos, "^2Green", scale, color, alpha, flag);
Draws colored string with clipping.
drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag)
ClientMenu
DarkPlacesFTE
drawsubpic(pos, size, "pic.tga", srcPos, srcSize, color, alpha, flag);
Draws a portion of an image.
Engine / System
13getextresponse()
ServerClientMenu
DarkPlacesFTE
getextresponse("key");
Gets a response from engine extension.
addstat(float index, float type, ...)
Server
DarkPlacesFTE
addstat(1, value);
Sets stat index for client.
getstatf(float stnum, optional float firstbit, optional float bitcount)
Client
DarkPlacesFTE
getstatf(stat_number);
Gets float from a stat.
getstati(float stnum, optional float firstbit, optional float bitcount)
Client
DarkPlacesFTE
getstati(stat_number);
Gets integer from a stat.
getstats(float firststnum)
Client
DarkPlacesFTE
getstats(stat_number);
Gets string from a stat.
setpause(float pause)
Server
DarkPlacesFTE
setpause(TRUE);
Pauses the game.
changelevel(string s)
ServerMenu
WinQuakeDarkPlacesFTE
changelevel("start");
Changes to another level.
callfunction(string s)
ServerClientMenu
DarkPlacesFTE
callfunction(func);
Calls a function by pointer.
isfunction(string s)
ServerClientMenu
DarkPlacesFTE
isfunction(function_name);
Checks if value is a function pointer.
gettime(optional float timetype)
ServerClientMenu
DarkPlacesFTE
gettime();
Gets the current time.
checkextension(string s)
ServerClientMenu
DarkPlacesFTE
checkextension("DP_SV_SETCOLOR");
Checks for engine extension.
getlight(vector org)
ServerClient
DarkPlacesFTE
getlight(position);
Returns the color of lighting at the requested location.
getlight2(vector org, float lpflags)
ServerClient
DarkPlacesFTE
getlight2(position, LP_RTWORLD);
Same as getlight, but you may specify what type of lights you want.
isdemo()
ServerClientMenu
DarkPlacesFTE
isdemo();
Returns true if demo is playing.
isserver()
ServerClientMenu
DarkPlacesFTE
isserver();
Returns true if client is also server.
getresolution(float vidmode, optional float forfullscreen)
ServerClientMenu
DarkPlacesFTE
getresolution(0);
Gets screen resolution.
getgamedirinfo(float n, float prop)
ServerClientMenu
DarkPlacesFTE
getgamedirinfo(0, GGDI_DESCRIPTION);
Retrieves metadata about the current game/mod directory.
Debug
11crash()
ServerClientMenu
DarkPlacesFTE
crash();
Intentionally crashes (debug).
stackdump()
ServerClientMenu
DarkPlacesFTE
stackdump();
Prints current stack trace.
dprint(string s, ...)
ServerClientMenu
WinQuakeDarkPlacesFTE
dprint("Debug info");
Debug print.
eprint(entity e)
ServerClientMenu
WinQuakeDarkPlacesFTE
eprint(self);
Print details about a given entity (for debug purposes).
coverage()
ServerClientMenu
DarkPlacesFTE
coverage();
Returns code coverage percent.
error(string e, ...)
ServerClientMenu
WinQuakeDarkPlacesFTE
error("Something went wrong");
Triggers a fatal error.
objerror(string e, ...)
ServerClientMenu
WinQuakeDarkPlacesFTE
objerror("Invalid use");
Aborts current object with error.
coredump()
ServerClientMenu
WinQuakeDarkPlacesFTE
coredump();
Triggers a coredump for debugging.
traceon()
ServerClientMenu
WinQuakeDarkPlacesFTE
traceon();
Enables function tracing.
traceoff()
ServerClientMenu
WinQuakeDarkPlacesFTE
traceoff();
Disables function tracing.
UI / Menu
11findfont(string s)
ClientMenu
DarkPlacesFTE
findfont("conchars");
Finds font by fontname and return it's index.
loadfont(string fontname, string fontmaps, string sizes, float slot, optional float fix_scale, optional float fix_voffset)
ClientMenu
DarkPlacesFTE
loadfont("fontname", fontmaps, sizes, slot, fix_scale, fix_voffset);
Loads a font into memory.
stringwidth(string text, float usecolours, optional vector fontsize)
ClientMenu
DarkPlacesFTE
stringwidth("text", FALSE, size);
Get a width of string with given font and char size.
gecko_create(string name, optional string initialURI)
ServerClientMenu
DarkPlacesFTE
gecko_create("id", "about:blank");
Creates a Gecko web control.
gecko_destroy(string name)
ServerClientMenu
DarkPlacesFTE
gecko_destroy("id");
Destroys a Gecko control.
gecko_keyevent(string name, float key, float eventtype, optional float charcode)
ServerClientMenu
DarkPlacesFTE
gecko_keyevent("id", K_ENTER, 1);
Sends key input to Gecko.
gecko_mousemove(string name, float x, float y)
ServerClientMenu
DarkPlacesFTE
gecko_mousemove("id", x, y);
Moves cursor within Gecko.
gecko_resize(string name, float w, float h)
ServerClientMenu
DarkPlacesFTE
gecko_resize("id", width, height);
Resizes a Gecko window.
gecko_get_texture_extent(string name)
ServerClientMenu
DarkPlacesFTE
gecko_get_texture_extent("id");
Gets dimensions of Gecko texture.
Physics / Tracing
10droptofloor()
ServerClient
WinQuakeDarkPlacesFTE
droptofloor();
Drops self to the floor, if the floor is less than -256 coordinates below. Returns TRUE if landed on floor.
checkbottom(entity e)
ServerClient
WinQuakeDarkPlacesFTE
checkbottom(self);
Rturns TRUE if on the ground. Used only for jumping monsters that need to jump randomly not to get hung up.
traceline(vector v1, vector v2, float nomonsters, entity forent)
ServerClient
WinQuakeDarkPlacesFTE
traceline(start, end, FALSE, self);
Performs a line trace (raycast).
tracebox(vector v1, vector min, vector max, vector v2, float nomonsters, entity forent)
ServerClient
DarkPlacesFTE
tracebox(start, end, mins, maxs, self);
Similar to traceline but much more useful, traces a box of the size specified (technical note: in quake1 and halflife bsp maps the mins and maxs will be rounded up to one of the hull sizes, quake3 bsp does not have this problem, this is the case with normal moving entities as well).
tracetoss(entity e, entity ignore)
ServerClient
DarkPlacesFTE
TraceToss(self, goal);
Simulates movement of the entity as if it is MOVETYPE_TOSS and starting with it's current state (location, velocity, etc).
pointcontents(vector v)
ServerClient
WinQuakeDarkPlacesFTE
pointcontents(self.origin);
Returns the contents of the area situated at position pos. Used to know if an area is in water, in slime or in lava. Makes use of the BSP tree, and is supposed to be very fast.
checkpvs(vector viewpos, entity viewee)
ServerClient
DarkPlacesFTE
checkpvs(vec_viewpos, viewe_ent);
Returns true if viewee can be seen from viewpos according to PVS data.
movetypesteplandevent(vector vImpactVelocity)
Server
DarkPlacesFTE
self.movetypesteplandevent = my_landed;
This field function, when provided, is triggered on a MOVETYPE_STEP entity when it experiences "land event".
contentstransition(float nOriginalContents, float nNewContents)
Server
DarkPlacesFTE
self.contentstransition = my_content_transition;
Handles transition between content types.
runstandardplayerphysics(entity ent)
Server
DarkPlacesFTE
runstandardplayerphysics(self);
Executes standard movement logic.
Sound / Audio
10sound(entity e, float chan, string samp, float vol, float atten)
ServerClient
WinQuakeDarkPlacesFTE
sound(self, CHAN_BODY, "weapons/shot.wav", 1, ATTN_NORM);
Plays sound on an entity.
precache_sound(string s)
ServerClientMenu
WinQuakeDarkPlacesFTE
precache_sound("misc/hit.wav");
Preloads a sound file.
precache_sound2(string s)
Server
WinQuakeDarkPlacesFTE
precache_sound2("sound.wav", 1);
Same as precache_sound, but only for registered Quake.
ambientsound(vector pos, string samp, float vol, float atten)
ServerClient
WinQuakeDarkPlacesFTE
ambientsound(self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC);
An ambient sound is emitted, from the given position.
sound7(entity e, float chan, string samp, float vol, float atten, float speed, float flags)
Server
DarkPlacesFTE
sound7(self, CHAN_AUTO, "sound.wav", 1, ATTN_NORM, 0, 0);
Advanced sound function.
getsoundtime(entity e, float channel)
Client
DarkPlacesFTE
getsoundtime(self, CHAN_AUTO);
Get currently sound playing position on entity channel, -1 if not playing or error.
soundlength(string sample)
Client
DarkPlacesFTE
soundlength("sound.wav");
Returns length of sound sample in seconds, -1 on error (sound not precached, sound system not initialized, etc).
pointsound(vector origin, string sample, float volume, float attenuation)
Server
DarkPlacesFTE
pointsound("sound.wav", '0 0 0');
Plays sound at position.
localsound(string soundname, optional float channel, optional float volume)
ServerClientMenu
DarkPlacesFTE
localsound("misc/menu.wav");
Plays sound locally.
SetListener(vector origin, vector forward, vector right, vector up, optional float reverbtype)
Client
DarkPlacesFTE
SetListener('0 0 64', '1 0 0', '0 1 0', '0 0 1');
Sets the audio listener entity.
Surface / Model
9getsurfacepoint(entity e, float s, float n)
ServerClient
DarkPlacesFTE
getsurfacepoint(entity, surfIndex, pointIndex);
Gets a point on a surface by index.
getsurfacenumpoints(entity e, float s)
ServerClient
DarkPlacesFTE
getsurfacenumpoints(entity, surfIndex);
Returns number of points on a surface.
getsurfacetexture(entity e, float s)
ServerClient
DarkPlacesFTE
getsurfacetexture(entity, surfIndex);
Gets texture name of a surface.
getsurfacenormal(entity e, float s)
ServerClient
DarkPlacesFTE
getsurfacenormal(entity, surfIndex);
Gets normal vector of a surface.
getsurfaceclippedpoint(entity e, float s, vector p)
ServerClient
DarkPlacesFTE
getsurfaceclippedpoint(entity, surfIndex, point);
Gets clipped point on surface.
getsurfacetriangle(entity e, float s, float n)
ServerClient
DarkPlacesFTE
getsurfacetriangle(entity, surfIndex, triIndex);
Gets triangle data from a surface.
getsurfacenumtriangles(entity e, float s)
ServerClient
DarkPlacesFTE
getsurfacenumtriangles(entity, surfIndex);
Returns number of triangles on surface.
getsurfacepointattribute(entity e, float s, float n, float a)
ServerClient
DarkPlacesFTE
getsurfacepointattribute(entity, surfIndex, pointIndex, "texcoord");
Gets attribute (e.g. texcoord) of a surface point.
getsurfacenearpoint(entity e, vector p)
ServerClient
DarkPlacesFTE
getsurfacenearpoint(entity, position);
Finds nearest point on surface to given position.
Server Browser
9resethostcachemasks
Menu
DarkPlacesFTE
resethostcachemasks();
Clears all filters/masks on the server browser host cache.
sethostcachemaskstring
Menu
DarkPlacesFTE
sethostcachemaskstring("map", "dm6");
Sets a string-based filter on the host cache.
sethostcachemasknumber
Menu
DarkPlacesFTE
sethostcachemasknumber("ping", 100);
Sets a numeric filter on the host cache.
resorthostcache
Menu
DarkPlacesFTE
resorthostcache();
Resorts the host cache list using active filters and sorting mode.
sethostcachesort
Menu
DarkPlacesFTE
sethostcachesort("ping");
Sets the sort key for the host cache list.
refreshhostcache(optional float dopurge)
Menu
DarkPlacesFTE
refreshhostcache();
Requests a refresh of the server browser host list.
gethostcachenumber
Menu
DarkPlacesFTE
gethostcachenumber();
Returns the number of servers in the cache.
gethostcacheindexforkey
Menu
DarkPlacesFTE
gethostcacheindexforkey("name", "My Server");
Gets the index of the server that has a given key/value.
addwantedhostcachekey
Menu
DarkPlacesFTE
addwantedhostcachekey("mod");
Adds a custom key to track in the server list.
Cryptography
8crc16(float caseinsensitive, string s, ...)
ServerClientMenu
DarkPlacesFTE
crc16(caseinsensitive, str, ...);
Some hash function to build hash tables with. This has to be be the CRC-16-CCITT that is also required for the QuakeWorld download protocol.
digest_hex(string digest, string data, ...)
ServerClientMenu
DarkPlacesFTE
string EncodePassword(string username, string password)
{
return digest_hex("SHA2-256", username, ":somethingsalty:", password);
};
Returns a given hex digest of given data.
crypto_getkeyfp(string serveraddress)
ServerClientMenu
DarkPlacesFTE
crypto_getkeyfp("key");
Retrieves the cached host key's CA fingerprint of a server given by IP address.
crypto_getidfp(string serveraddress)
ServerClientMenu
DarkPlacesFTE
crypto_getidfp("127.0.0.1:26000");
Retrieves the cached host key fingerprint of a server given by IP address.
crypto_getidstatus(string serveraddress)
ServerClientMenu
DarkPlacesFTE
crypto_getidstatus("id");
Retrieves the cached host key's key status. See below for CRYPTO_IDSTATUS_ defines.
crypto_getencryptlevel(string serveraddress)
ServerClientMenu
DarkPlacesFTE
crypto_getencryptlevel("127.0.0.1:26000");
0 if never encrypting, 1 supported, 2 requested, 3 required, appended by list of allowed methods in order of preference ("AES128"), preceded by a space each.
crypto_getmykeyfp(float i)
ServerClientMenu
DarkPlacesFTE
crypto_getmykeyfp();
Retrieves the CA key fingerprint of a given CA slot, or "" if slot is unused but more to come, or string_null if end of list.
crypto_getmyidfp(float i)
ServerClientMenu
DarkPlacesFTE
crypto_getmyidfp();
Retrieves the ID fingerprint of a given CA slot, or "" if slot is unused but more to come, or string_null if end of list.
crypto_getmyidstatus(float i)
ServerClientMenu
DarkPlacesFTE
crypto_getmyidstatus();
Retrieves the ID's status of a given CA slot, or 0 if slot is unused but more to come, or -1 if end of list.
crypto_uri_postbuf(string url, float id, string content_type, string delim, float buf, float keyid)
ServerClientMenu
DarkPlacesFTE
crypto_uri_postbuf(uri, data);
Encrypts and posts a URI buffer using crypto. Use -1 as buffer handle to justs end delim as postdata
Type Conversion
7etos(entity ent)
ServerClientMenu
DarkPlacesFTE
etos(self);
Prints "entity 1" or similar into a string. (this was a Q2 builtin).
stof(string s)
ServerClientMenu
DarkPlacesFTE
stof("1.5");
Get numerical value from a string.
etof
ServerClientMenu
DarkPlacesFTE
etof(self);
Entity to float (edict index).
ftoe(float num)
ServerClientMenu
DarkPlacesFTE
ftoe(1);
Float to entity (edict).
stov(vector v)
ServerClientMenu
DarkPlacesFTE
stov("1 2 3");
String to vector.
ftos(float f)
ServerClientMenu
WinQuakeDarkPlacesFTE
ftos(3.14);
Float to string.
vtos(vector v)
ServerClientMenu
WinQuakeDarkPlacesFTE
vtos('1 2 3');
Vector to string.
AI / Navigation
6movetogoal(float step)
Server
WinQuakeDarkPlacesFTE
movetogoal(self, dist);
Moves entity toward goal entity.
changepitch(entity ent)
Server
DarkPlacesFTE
changepitch();
Changes entity's pitch toward goal.
ChangeYaw
Server
WinQuakeDarkPlacesFTE
ChangeYaw();
Change the horizontal orientation of self. Turns towards self.ideal_yaw at self.yaw_speed, and sets the global variable current_yaw.
walkmove(float yaw, float dist)
Server
WinQuakeDarkPlacesFTE
walkmove(self.angles_y, speed);
Moves self in the given direction. Returns FALSE if could not move (used to detect blocked monsters).
checkclient()
Server
WinQuakeDarkPlacesFTE
checkclient();
Returns client (or object that has a client enemy) that would be a valid target. If there are more than one valid options, they are cycled each frame. If (self.origin + self.viewofs) is not in the PVS of the target, 0 (FALSE) is returned.
aim(entity e, float speed)
Server
WinQuakeDarkPlacesFTE
aim(e, missilespeed);
Returns a vector along which the entity e can shoot. Usually, e is a player, and the vector returned is calculated by auto aiming to the closest enemy entity.
Print / Output
4centerprint(entity client, string s, ...)
ServerMenu
WinQuakeDarkPlacesFTE
centerprint(self, "Hello");
Sends center print to client.
bprint(string s, ...)
ServerMenu
WinQuakeDarkPlacesFTE
bprint("Hello all");
Broadcast a message to all players on the current server.
sprint(entity client, string s, ...)
ServerMenu
WinQuakeDarkPlacesFTE
sprint(self, "Hi");
Single client print.
print(string s, ...)
ServerClientMenu
DarkPlacesFTE
print("Hello World!\n");
Generic print.
Particles
4pointparticles(float effectnum, vector org, vector vel, float howmany)
Client
DarkPlacesFTE
pointparticles(effectnum, origin);
Spawns particles at point.
trailparticles(entity ent, float effectnum, vector start, vector end)
Client
DarkPlacesFTE
trailparticles(entity, effectnum, start, end);
Spawns trail particles.
particle(vector origin, vector dir, float color, float count)
ServerClient
WinQuakeDarkPlacesFTE
particle(origin, velocity, color, alpha, scale);
Creates basic particle effect.
particleeffectnum(string effectname)
Client
DarkPlacesFTE
particleeffectnum("effectname");
Gets numeric ID of particle effect.
Model / Precache
4gettagindex(entity ent, string tagname)
ServerClient
DarkPlacesFTE
gettagindex(model, "tag");
Gets model tag index.
gettaginfo(entity ent, float tagindex)
ServerClient
DarkPlacesFTE
gettaginfo(entity, tag);
Gets model tag transform.
setmodelindex(entity e, float mdlindex)
Client
DarkPlacesFTE
setmodelindex(entity, index);
Sets model index.
modelnameforindex(float mdlindex)
Client
DarkPlacesFTE
modelnameforindex(1);
Gets model name by index.