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

Difference between revisions of "QuakeC Simple Types"

From Quake Wiki

m (QuakeC Types moved to QuakeC Simple Types: Defining simple and field types as separate pages... makes things a little clearer.)
m (The simple Types)
 
(One intermediate revision by one other user not shown)
Line 49: Line 49:
 
Used to indicate file names, or messages to be broadcast to players.
 
Used to indicate file names, or messages to be broadcast to players.
 
<br>
 
<br>
Valid syntax: <b>"maps/jrwiz1.bsp"</b> or <b>"ouch!\
+
Valid syntax: <b>"maps/jrwiz1.bsp"</b> or <b>"ouch!\n"</b>
"</b>
 
  
 
<br>
 
<br>
Use <b>\
+
Use <b>\n</b> for newline.
</b> for newline.
 
 
</p>
 
</p>
 
<p>Note: that character strings cannot be modified, or concatenated.
 
<p>Note: that character strings cannot be modified, or concatenated.
 
Because they are stored at fixed locations in memory, and if
 
Because they are stored at fixed locations in memory, and if
would be postentially troublesome to allow modification.
+
would be potentially troublesome to allow modification.
 
</p>
 
</p>
  

Latest revision as of 02:15, 5 April 2013

The simple Types[edit]

void type

An empty result, mostly used for definition of procedures (i.e. functions that return no result at all).

Float type

A floating point value.

Floats are also used to store booleans (TRUE, FALSE) or integer values link counters, or bit flags.

    Valid syntax: 12  1.6  0.5  -100
  
    Invalid syntax: .5  -.50  .690

A parsing ambiguity is present with negative constants. "a-5" will be parsed as "a", then "-5", causing an error. Separate the - from the digits with a space "a - 5" to get the proper behavior.

Vector type

A vector, made of 3 float coordinates.
Used to represent positions or directions in 3D space.
Valid syntax: '0 0 0' or '20.5 -10 0.00001'

Note the simple quotes around the vector. Do not use double quotes, they are reserved for strings.

If you declare a vector foobar, then you can access it's x, y and z fields with: foobar_x, foobar_y,foobar_z.

String type

This is used to store character string.
Used to indicate file names, or messages to be broadcast to players.
Valid syntax: "maps/jrwiz1.bsp" or "ouch!\n"
Use \n for newline.

Note: that character strings cannot be modified, or concatenated. Because they are stored at fixed locations in memory, and if would be potentially troublesome to allow modification.

entity type

The reference of an entity in the game, like things, players, monsters.
For instance, this is the type of the entities self and other.

The entity type is a structured type, made of fields.
A description of each field is available.