B LIBRARY SERVICES

These services have the form:

<library_name>::<service>(params)

<library_name> can be one of "Math", "Yagga", "Sys" and any other Java class name given in the LibClasses section of the config file.

In such a case, only the unqualified class name must be used, e.g. if you have registered the class "com.mysoft.lib.Print", you must use "Print" as a library name.

You should avoid name conflicts. Services are listed in alphabetical order.

B.1 YAGGA LIBRARY

object[] getAll(string className);

returns all the object of the game, at the time of the library call, belonging to the specified class.

parameters:
className string containing the class name. Class name ARE case sensitive
return value:
a list of objects reference containing all the objects in the world belonging to the class.

void createIntrospectionViews(object objRef)

creates default "introspective" views of the object passed as a parameter.

Default introspective view for PbML version Alpha 1.5 is just the list of commands available, including commands "emerging" from devices. Please note that the views are sent to the owner of objRef, not the owner of the object who calls this service.

In order to send infos to the caller object simply pass the "self" object reference as a parameter.

There is one view per command (or device's command).

The format of each view is
{
type="introspection"
subtype="command"
name=<command_name>
param_1_type=<first param type>
param_1_name=<first param name>
...
param_N_type=<last param type>
param_N_name=<last param name>
}

parameters:
objRef the object whose introspection views we want to send to the owner of objRef.
return value:
NONE.

void debug(string msg);

print out a debug string in the debug file (if defined) or on the standard error (STDERR).

parameters:
msg the message to be written
return value:
NONE.

int turnNumber();

returns the current turn the server is executing. Usually this information is stored in the filename of the current data file.

return value:
the number of the current turn.

void removePlayer(string player)

removes the given player from the list of active players of the current game. The player will be removed at the end of the current phase. From next phase no views to the player will be generated, no commands will be expected from that player.

parameters:
player the name of the player we want to remove, as it appears in the players table file.
return value:
NONE.

void skipPhase(string phase)

tells Yagga engine to skip the given phase when it should execute it. The phase can occurr any time in the future. If, during the execution of the server following this instruction, the engine should execute such phase, it will instead skip it and continue with the phase following the given one.

parameters:
phase a string containing the name of the phase we want to skip. The name is the one that appears in the phases file. I think that this won't work with sub-passes. Only main phases may be skipped.
return value:
NONE.

void jumpToPhase(string phase)

tells Yagga engine to jump to the given phase at the end of the current phase, skipping the execution of every phase/sub-phase that is specified before the given one.

parameters:
phase a string containing the name of the phase we want to jump to. The name is the one that appears in the phases file. I think that this won't work with sub-passes. Only main phases may be jumped at.
return value:
NONE.

B.2 SYS LIBRARY

string getTurnId(object objRef)

returns the temporary id (guaranteed to be unique in the same turn)

parameters:
objRef the object whose temp id we want.
return value:
a string containing an alphanumeric temporary id.
 
string collateArray(object[] list)

returns a comma separated list of the temporary ids of the objects contained in the list.

parameters:
list a list of object, whose temp id we want.
return value:
a string containing the list (separated by ", ") of the temporary ids of the given objects.

string collateArrayAttrib(object list[], string attribName)

returns a comma separated list of attrib values in an array of objects

parameters:
list a list of objects
attribName the attribute whose value we want to enumerate
return value:
a string containing the list (separated by ", ") of the values the given attriubte has on every object of the list.