From Quake Wiki

Builtin definitions:

float() numentityfields = #496;
string(float fieldnum) entityfieldname = #497;
float(float fieldnum) entityfieldtype = #498;
string(float fieldnum, entity ent) getentityfieldstring = #499;
float(float fieldnum, entity ent, string s) putentityfieldstring = #500;

Constants (Returned by entityfieldtype):

float FIELD_STRING   = 1;
float FIELD_FLOAT    = 2;
float FIELD_VECTOR   = 3;
float FIELD_ENTITY   = 4;

DP_QC_ENTITYDATA provides versatile functions intended for storing and retrieving field data without hard coding all the field names, in a versatile way. It was originally intended for automatically dumping entities to make them persist between levels, but was designed to be as versatile as possible. The data can be filtered by type or other criteria, and saved to file or sent to a database in combination with other functions.

WARNING: .entity fields cannot be saved and restored between map loads as they will leave dangling pointers. Entity fields might still be useful, for example if you wish to dump entities straight to a web server for inspection there, in the event of an error.

  • numentityfields returns the number of entity fields. NOT offsets. Vectors comprise 4 fields: v, v_x, v_y and v_z.
  • entityfieldname returns the name as a string, eg. "origin" or "classname" or whatever.
  • entityfieldtype returns a value that the constants represent, but the field may be of another type in more exotic progs.dat formats or compilers.
  • getentityfieldstring 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.
  • putentityfieldstring puts the data returned by getentityfieldstring back into the entity.