Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   Compound Members   Related Pages  

SE_ Story Engine System Calls


Strings

int SE_StringLen (string str)
int SE_StringReadChar (string str, int index)
void SE_StringWriteChar (string str, int ch, int index)
int SE_StringStr (string str, string matchstr)
string SE_StringSub (string str, int index,...)
int SE_StringToInt (string str)
array SE_StringSplit (string str, string sep)
string SE_StringSubst (string str, string str1, string str2)
string SE_SPrintf (string fmt,...)
string SE_VSPrintf (string fmt, array args)
int SE_strcmp (string str1, string str2)
int SE_stricmp (string str1, string str2)
string SE_TimeString (string format,...)

Arrays

array SE_ArrayAlloc (int size)
int SE_ArraySize (array arr)
vartype SE_ArrayRead (array arr, int index)
void SE_ArrayWrite (array arr, int index, vartype element)
void SE_ArrayCopy (array dst, int dstidx, array src, int startidx, int endidx)
array SE_ArrayClone (array src)
array SE_ArraySubClone (array src, int startidx, int endidx)
void SE_ArrayInsert (array arr, int idx, vartype element)
void SE_ArrayAppend (array arr, vartype element)
void SE_ArrayRemove (array arr, int idx)
void SE_ArrayResize (array arr, int newsize)

Tables

table SE_TableAlloc ()
int SE_TableSize (table t)
int SE_TableNew (table t, vartype value)
BOOL SE_TableAdd (table t, vartype key,...)
int SE_TableFind (table t, vartype key)
BOOL SE_TableExists (table t, vartype key)
vartype SE_TableNext (table t,...)
vartype SE_TableRemove (table t, vartype key)
array SE_TableKeys (table t)
array SE_TableData (table t)

TextDB

string SE_ReadText (int textpage, int textid)
string SE_ExistsText (int textpage, int textid)

Tasks

int SE_GetTaskID ()
void SE_KillTask (int taskid)

Objects and Datatypes

BOOL SE_ObjectExists (GALOBJ obj)
BOOL SE_ObjectFunctionExists (GALOBJ obj, string fname)
int SE_GetExprType (...)

Math

int SE_LinFunc (int x1, int x2, int y1, int y2, int x)
int SE_LogFunc (int x, int x1, int x2, int y1, int y2)
int SE_LinFuncSum (int x1, int x2, int y1, int y2, int v1, int v2)
int SE_CubicPoly (int x0, int y0, int xd, int yd, int xt, int yt, int x)
int SE_GGT (...)
int SE_KGV (...)
int SE_Distance3 (int dx, int dy, int dz)
FIXED SE_MulFix (FIXED x1, FIXED x2)
FIXED SE_DivFix (FIXED x1, FIXED x2)
FIXED SE_MulDivFix (FIXED x1, FIXED x2, FIXED x3)
int SE_Sqrt (int x)
int SE_Random (int range)

Story Debugging

int SE_DMprintf (int debugmask, string fmt,...)
int SE_Dprintf (string fmt,...)

Detailed Description

These "low-level" system calls are closely tied to the story engine itself. Most of these calls provide functionality like the system calls of an operating system like Unix and the standard run-time library of C.

Function Documentation

array SE_ArrayAlloc int    size
 

Allocates an array with all elements initialized to 0. Since the arrays are dynamic, size can be zero.

void SE_ArrayAppend array    arr,
vartype    element
 

Adds element to the end of the array.

array SE_ArrayClone array    src
 

Clones the array src and returns the newly allocated array.

void SE_ArrayCopy array    dst,
int    dstidx,
array    src,
int    startidx,
int    endidx
 

Copies the array src from startidx to endidx to the array dst at position dstidx.

void SE_ArrayInsert array    arr,
int    idx,
vartype    element
 

Inserts the element into arr at position idx and shifts up all elements above it.

vartype SE_ArrayRead array    arr,
int    index
 

Reads an element from the array (use [] syntax instead!).

void SE_ArrayRemove array    arr,
int    idx
 

Removes an element at the index idx and shifts down all elements above it.

void SE_ArrayResize array    arr,
int    newsize
 

Sets the size of the array to newsize.

int SE_ArraySize array    arr
 

Returns size of array (number of elements).

array SE_ArraySubClone array    src,
int    startidx,
int    endidx
 

Returns a newly allocated array from an excerpt of src from startidx to endidx.

void SE_ArrayWrite array    arr,
int    index,
vartype    element
 

Writes an element to the array (use [] syntax instead!).

int SE_CubicPoly int    x0,
int    y0,
int    xd,
int    yd,
int    xt,
int    yt,
int    x
 

Compute y between two extremes y0 - yd and y0 + yd for x between x0 - xd and x0 + xd, with the tanget of slope yt / xt at x0.<BR> y = y0 - yd for x < x0 - xd
y = y0 + yd for x > x0 + xd

int SE_Distance3 int    dx,
int    dy,
int    dz
 

Gets length of a 3D vector.

FIXED SE_DivFix FIXED    x1,
FIXED    x2
 

Divide two fixed (16.16) values.

int SE_DMprintf int    debugmask,
string    fmt,
...   
 

Prints a debug message to the debug output. The message is printed if (debugmask & debugflags) == debugmask.

int SE_Dprintf string    fmt,
...   
 

Prints an important debug message. This should be only used for real errors.

string SE_ExistsText int    textpage,
int    textid
 

Same as SE_ReadText(), but does not ring an alarm if the string does not exist.

int SE_GetExprType ...   
 

Returns the datatype of the given expression. Possible values:
VARTYPE_NULL Null type, variables of all types can be NULL.
VARTYPE_INTEGER Integer number
VARTYPE_STRING Static string
VARTYPE_DSTRING Dynamic string
VARTYPE_ARRAY Array reference
VARTYPE_TABLE Table reference
VARTYPE_OBJECT Class instance reference
VARTYPE_TASK Task ID

int SE_GetTaskID  
 

Returns ID of current task.

int SE_GGT ...   
 

Returns the greatest common divisor of all given numbers.

int SE_KGV ...   
 

Returns the least common multiple of all given numbers.

void SE_KillTask int    taskid
 

Kills task with given ID.

int SE_LinFunc int    x1,
int    x2,
int    y1,
int    y2,
int    x
 

Linear interpolation between two points (x1, y1) and (x2, y2), according to this formula:
y = (y2-y1) * (x-x1) / (x2-x1) + y1 for x1 < x < x2
y = y1 for x <= x1
y = y2 for x >= x2
It is required that x2 > x1.

int SE_LinFuncSum int    x1,
int    x2,
int    y1,
int    y2,
int    v1,
int    v2
 

Sum of SE_LinFunc().

int SE_LogFunc int    x,
int    x1,
int    x2,
int    y1,
int    y2
 

Similar to SE_LinFunc(), but logarithmic scaling of the value range. The formula that is computed is:
y = (y2-y1) * log(x/x1) / log(x2/x1) + y1 for x1 < x < x2
y = y1 for x <= x1
y = y2 for x >= x2

FIXED SE_MulDivFix FIXED    x1,
FIXED    x2,
FIXED    x3
 

Compute x1 * x2 / x3, using intermediate 64 bit precision.

FIXED SE_MulFix FIXED    x1,
FIXED    x2
 

Multiply two fixed (16.16) values.

BOOL SE_ObjectExists GALOBJ    obj
 

Checks if the galaxy object obj exists.

BOOL SE_ObjectFunctionExists GALOBJ    obj,
string    fname
 

Checks if the function named fname exists in obj.

int SE_Random int    range
 

Returns a random value between 0 and range - 1.

string SE_ReadText int    textpage,
int    textid
 

Returns the text specified by textpage and textid from the loaded TextDB XML file. If the text does not exist, 0 is returned.

string SE_SPrintf string    fmt,
...   
 

Like sprintf in C, accepts all usual format strings.

int SE_Sqrt int    x
 

Square root.

int SE_strcmp string    str1,
string    str2
 

Compares two strings like the C function strcmp(). Use the == operator instead.

int SE_stricmp string    str1,
string    str2
 

Compares two strings (case insensitive) like the C function stricmp().

int SE_StringLen string    str
 

Returns the length of a string.

int SE_StringReadChar string    str,
int    index
 

Reads a character from the string.

array SE_StringSplit string    str,
string    sep
 

Split a string into an array of partial strings by using a separator string.

int SE_StringStr string    str,
string    matchstr
 

Return index of pattern matchstr in a string.

string SE_StringSub string    str,
int    index,
...   
 

Returns a partial string, starting from index and with length len (optional third parameter).

string SE_StringSubst string    str,
string    str1,
string    str2
 

Substitute all occurences of str1 with str2.

int SE_StringToInt string    str
 

Converts a number string to an integer.

void SE_StringWriteChar string    str,
int    ch,
int    index
 

Writes a character to the string.

BOOL SE_TableAdd table    t,
vartype    key,
...   
 

Adds a new entry to the table with given key. The third parameter (entry) is optional.

table SE_TableAlloc  
 

Allocates a table.

array SE_TableData table    t
 

Returns the data of a table as array.

BOOL SE_TableExists table    t,
vartype    key
 

Check if entry with given key exists in table.

int SE_TableFind table    t,
vartype    key
 

Finds an entry in table from given key.

array SE_TableKeys table    t
 

Returns the keys of a table as array.

int SE_TableNew table    t,
vartype    value
 

Adds a new entry to the table and returns a new key.

vartype SE_TableNext table    t,
...   
 

Gets key of next entry. Give the last key as second parameter. If the second parameter is 0 or not specified, the first entry in the table is returned. 0 is returned if there is no further entry.

vartype SE_TableRemove table    t,
vartype    key
 

Removes entry with given key from table and returns value.

int SE_TableSize table    t
 

Returns number of entries in table.

string SE_TimeString string    format,
...   
 

Returns current or given time as a formatted string. Format strings:
%a Abbreviated weekday name
%A Full weekday name
%b Abbreviated month name
%B Full month name
%c Date and time representation appropriate for locale
%d Day of month as decimal number (01 - 31)
%H Hour in 24-hour format (00 - 23)
%I Hour in 12-hour format (01 - 12)
%j Day of year as decimal number (001 - 366)
%m Month as decimal number (01 - 12)
%M Minute as decimal number (00 - 59)
%p Current locale’s A.M./P.M. indicator for 12-hour clock
%S Second as decimal number (00 - 59)
%U Week of year as decimal number, with Sunday as first day of week (00 - 53)
%w Weekday as decimal number (0 - 6; Sunday is 0)
%W Week of year as decimal number, with Monday as first day of week (00 - 53)
%x Date representation for current locale
%X Time representation for current locale
%y Year without century, as decimal number (00 - 99)
%Y Year with century, as decimal number
%z %Z Time-zone name or abbreviation; no characters if time zone is unknown
%% Percent sign

string SE_VSPrintf string    fmt,
array    args
 

Like SE_SPrintf(), but uses an array of arguments.


Generated on Mon Aug 26 18:26:36 2002 for X˛ KC by doxygen1.2.17