1 2 3 4 5 |
< define > < variablename >variablevalue</ variablename > <!-- or --> < variablename attribute = "value" /> </ define > |
The <function> tag. Defines a named script function. Contained by <define> tags.
1 2 3 |
< function name = "functionname" > ... function definition ... </ function > |
The <script> tag. Call functions and perform other scripting operations.
1 2 3 4 5 6 |
< script trigger="(delay|proximity|roll on|roll off| <span class = "mark" >click</ span > on|step in|step out|proximity|timer|location| key down|key hold|key up)" delay="seconds" radius="number_of_units" key="keyvalue"> ... script ... </ script > |
// text following double slashes is ignored to end of line /* text between slash-asterix is ignored, even on multiple lines */
A single statement may be spread over multiple lines. All statements must end in a semi-colon.
Addition
1 |
x + y |
1 |
x - y |
1 |
x * y |
1 |
x / y |
1 |
x % y |
1 |
x = y |
Equality
1 |
x = y |
1 |
x != y |
1 |
x gt y |
1 |
x ge y |
1 |
x lt y |
1 |
x le y |
AND
1 |
x and y |
1 |
x or y |
1 |
not x |
1 |
mystring = "my" # "string" |
If-Else
1 2 3 4 5 |
if ( expression ) { do this } else { do that } |
1 2 3 4 5 6 |
switch (x) { case y { do this } case z { do that } default { do default } } |
1 |
while ( expression ) { do this } |
1 |
do { do this } while ( expression ) |
1 |
for loopvar = startval to endval { do this } |
1 |
for loopvar = startval to endval step stepval { do this } |
1 |
for each item in collection { do this with item } |
The vrf object holds miscellaneous information about the vrf. It also holds all of the global variables and functions defined in the stand-alone <define> tag in a vrf.
1 |
vrf.title |
read/write
A string that holds the title of the vrf.
1 |
vrf.time:hour |
read only
The current hour (0-23).
1 |
vrf.time:minute |
read only
The current minute (0-59).
1 |
vrf.time:second |
integer
read only
The current second (0-59).
1 |
vrf.time:millisecond |
integer
read only
The current millisecond (usually measured since the PC was booted, but the start point should be considered undefined).
1 |
vrf.user_can_move |
boolean
read/write
Flag indicating whether the user is permitted to move around via the mouse or keyboard.
1 |
vrf.user_can_look |
boolean
read/write
Flag indicating whether the user is permitted to look around via the mouse or keyboard.
1 |
vrf.new_array() |
array object
Creates a new array object with no elements.
1 |
vrf.free_array( array ) |
Destroys the array object passed in the argument.
1 |
vrf.log(string) |
Writes a string to the log file.
1 |
vrf.start() |
Supplied by the builder of the vrf will be called when the vrf starts, before anything else happens. This function is optional.
1 |
vrf.stop() |
Supplied by the builder of the vrf will be called when the vrf stops. This function is optional.
An array object holds zero or more elements of any type. Note that in the following table, “array” is a placeholder for the name of the variable holding an array object.
1 |
array .elements |
integer
read only
The number of elements in the array.
1 |
array [index] |
any type
read/write
The array element at the given index.
1 |
array .insert(index, value) |
Inserts a new element before the given index.
1 |
array .prepend(value) |
Inserts a new element at the start of the array.
1 |
array .append(value) |
Inserts a new element at the end of the array.
1 |
array . delete (index) |
Deletes the element at the given index.
The math object provides mathematical functions and constants.
1 |
math.pi |
real
read only
Holds the constant p.
1 |
math.random(min,max) |
integer
Returns a random integer between min and max.
1 |
math.sqrt(x) |
real
Returns the square root of x.
1 |
math.sin(x) |
real
Returns the sine of x; x is in radians.
1 |
math. cos (x) |
real
Returns the cosine of x; x is in radians.
1 |
math.tan(x) |
real
Returns the tangent of x; x is in radians.
1 |
math.asin(x) |
real
Returns the arc sine of x in radians.
1 |
math. acos (x) |
real
Returns the arc cosine of x in radians.
1 |
math. atan (x) |
real
Returns the arc tangent of x in radians.
1 |
math.rad(x) |
real
Converts x from degrees to radians.
1 |
math.deg(x) |
real
Converts x from radians to degrees.
1 |
math. abs (x) |
real
Returns the absolute (positive) value of x.
The fog object controls the appearance of the fog in a vrf.
1 |
fog.color:red |
real
read/write
The red component of the fog color (0-255).
1 |
fog.color:green |
real
read/write
The green component of the fog color (0-255).Â
1 |
fog.color:blue |
real
read/write
The blue component of the fog color (0-255).Â
1 |
fog.density |
real
read/write
The density of the fog, as a percentage (0-100).
1 |
fog.startradius |
integer
read/write
The starting distance of the fog, in vrobjs.Â
1 |
fog.endradius |
integer
read/write
The ending distance of the fog, in vrobjs.Â
The sky object controls the look of the sky in a vrf.
1 |
sky.brightness |
real
read/write
The brightness of the sky, as a percentage (0-100).
1 |
sky.color:red |
real
read/write
The red component of the sky color (0-255).
1 |
sky.color:green |
real
read/write
The green component of the sky color (0-255).
1 |
sky.color:blue |
real
read/write
The blue component of the sky color (0-255).
1 |
sky.texture |
string
read/write
The URL of the sky texture.
The atmosphere object controls the behaviour of the atmosphere light in a vrf.
1 |
atmosphere.brightness |
real
read/write
The brightness of the ambient light, as a percentage (0-100).
1 |
atmosphere.color:red |
real
read/write
The red compoent of the ambient light color (0-255).
1 |
atmosphere.color:green |
real
read/write
The green component of the ambient light color (0-255).
1 |
atmosphere.color:blue |
real
read/write
The blue component of the ambient light color (0-255).
The ambience object controls the behaviour of the ambience sound in a vrf.
1 |
ambience.file |
string
read/write
The URL of the wave file.
1 |
ambience.volume |
real
read/write
The volume of the sound, as a percentage (0-100).
1 |
ambience.playback |
string
read/write
The playback mode of the sound, which is one of the following: “looped”, “random”, “single”, “once”.
1 |
ambience.delay:minimum |
real
read/write
The minimum delay between playbacks, in seconds.
1 |
ambience.delay:range |
real
read/write
The maximum additional delay between playbacks, in seconds.
1 |
orb.brightness |
real
read/write
The brightness of the orb light, as a percentage (0-100).
1 |
orb.color:red |
real
read/write
The red component of the orb light color (0-255).
1 |
orb.color:green |
real
read/write
The green component of the orb light color (0-255).
1 |
orb.color:blue |
real
read/write
The blue component of the orb light color (0-255).
1 |
orb.position:angle_x |
real
read/write
The angle of the orb above or below the horizon (90 is directly above, -90 is directly below).
1 |
orb.position:angle_y |
real
read/write
The direction of the orb (0 is north, 180 is south).
1 |
orb.texture |
string
read/write
The URL of the orb texture.
1 |
orb.href |
string
read/write
The URL of the orb hyperlink.
1 |
orb.target |
string
read/write
The target window of the orb hyperlink.
1 |
orb.text |
string
read/write
The popup text of the orb hyperlink.
The player object represents the user's position and viewpoint in the vrf.
1 |
player.location:column |
integer
read only
The column the player is nearest to.
1 |
player.location:row |
integer
read only
The row the player is nearest to.
1 |
player.location:layer |
integer
read only
The layer the player is nearest to.
1 |
player.location:x |
real
read/write
The x coordinate of the player.
1 |
player.location:y |
real
read/write
The y coordinate of the player.
1 |
player.location:z |
real
read/write
The z coordinate of the player.
1 |
player.orientation:look_angle |
real
read/write
The look angle of the player (-90 is up, 90 is down).
1 |
player.orientation:turn_angle |
real
read/write
The turn angle of the player (0 is north, 180 is south).
1 |
player.size:x |
real
read/write
The player size along the X axis.
1 |
player.size:y |
real
read/write
The player size along the Y axis.
1 |
player.size:z |
real
read/write
The player size along the Z axis.
1 |
player.camera:x |
real
read/write
The camera offset along the X axis.
1 |
player.camera:y |
real
read/write
The camera offset along the Y axis.
1 |
player.camera:z |
real
read/write
The camera offset along the Z axis.
1 |
player.move_forward |
string
read/write
The key(s) for moving forward.
1 |
player.move_back |
string
read/write
The key(s) for moving back.
1 |
player.move_left |
string
read/write
The key(s) for turning/sidling left.
1 |
player.move_right |
string
read/write
The key(s) for turning/sidling right.
1 |
player.look_up |
string
read/write
The key(s) for looking up.
1 |
player.look_down |
string
read/write
The key(s) for looking down.
1 |
player.sidle_mode |
string
read/write
The key(s) that when held down change turning to sidling.
1 |
player.fast_mode |
string
read/write
The key(s) that when held down causes the player to move at maximum speed.
1 |
player.go_faster |
string
read/write
The key(s) for increasing speed.
1 |
player.go_slower |
string
read/write
The key(s) for decreasing speed.
The map object provides variables and functions associated with the map.
1 |
map.dimensions:columns |
integer
read only
The number of columns in the map.
1 |
map.dimensions:rows |
integer
read only
The number of rows in the map.
1 |
map.dimensions:layers |
integer
read only
The number of layers in the map.
1 |
map.get_vrobj(column, row, layer) |
vrobj object
Returns the fixed or walkable vrobj at the given map location, or null if there is none. A fixed vrobj takes precedence.
1 |
map.get_vrobj(unit) |
vrobj object
Returns the fixed or walkable vrobj with the given unit.
1 |
map.get_vrobjs(column, row, layer) |
array object
Returns an array of fixed and walkable vrobjs at the given map location. Array is automatically deallocated.
1 |
map.get_vrobjs(unit) |
array object
Returns an array of fixed or walkable vrobjs with the given unit. Array is automatically deallocated.
1 |
map.set_vrobj(column, row, layer, unit) |
1 |
map.move_vrobj(column1, row1, layer1, column2, row2, layer2) |
A vrobj object represents one vrobj on the map, and provides ways to manipulate it. Note that in the following tables, “vrobj” is a placeholder for a variable that is holding the vrobj object. Also note that the variables below are only writable if the vrobj is walkable. Finally, any variables or functions defined in a <define> tag inside of a <create> tag will be associated with the vrobj of that unit.
1 |
vrobj.location:column |
integer
read/write
The column the vrobj is in (or near if walkable).
1 |
vrobj.location:row |
read/write
The row the vrobj is in (or near if walkable).
1 |
vrobj.location:layer |
integer
read/write
The layer the vrobj is in (or near if walkable).
1 |
vrobj.location:x |
real
read/write
The x coordinate of the vrobj, in “pixels”.
1 |
vrobj.location:y |
real
read/write
The y coordinate of the vrobj, in “pixels”.
1 |
vrobj.location:z |
real
read/write
The z coordinate of the vrobj, in “pixels”.
1 |
vrobj.origin:x |
real
read/write
The X coordinate of the origin around which the vrobj rotates, in “pixels”.
1 |
vrobj.origin:y |
real
read/write
The Y coordinate of the origin around which the vrobj rotates, in “pixels”.
1 |
vrobj.origin:z |
real
read/write
The Z coordinate of the origin around which the vrobj rotates, in “pixels”.
1 |
vrobj.bbox:min_x |
real
read only
The minimum x coordinate of the vrobj's bounding box.
1 |
vrobj.bbox:min_y |
real
read only
The minimum y coordinate of the vrobj's bounding box.
1 |
vrobj.bbox:min_z |
real
read only
The minimum z coordinate of the vrobj's bounding box.
1 |
vrobj.bbox:max_x |
real
read only
The maximum x coordinate of the vrobj's bounding box.
1 |
vrobj.bbox:max_y |
real
read only
The maximum y coordinate of the vrobj's bounding box.
1 |
vrobj.bbox:max_z |
real
read only
The maximum z coordinate of the vrobj's bounding box.
1 |
vrobj.vertices |
integer
read only
The number of vertices the vrobj has.
1 |
vrobj.vertex[index]:x |
real
read/write
The x coordinate of vertex index.
1 |
vrobj.vertex[index]:y |
real
read/write
The y coordinate of vertex index.
1 |
vrobj.vertex[index]:z |
real
read/write
The z coordinate of vertex index.
1 |
vrobj.orig_vertex[index]:x |
real
read only
The original x coordinate of vertex index, before it was modified.
1 |
vrobj.orig_vertex[index]:y |
real
read only
The original y coordinate of vertex index, before it was modified.
1 |
vrobj.orig_vertex[index]:z |
real
read only
The original z coordinate of vertex index, before it was modified.
1 |
vrobj.walkable |
boolean
read only
Flag indicating if the vrobj is walkable.
1 |
vrobj.symbol |
string
read only
The symbol of the vrobj.
1 |
vrobj.name |
string
read only
The name of the vrobj.
1 |
vrobj.get_vertices(); |
1 |
vertexarray.set(i,x,y,z); |
1 |
vrobj.set_vertices(); |
1 |
vrobj.reset_vertices(); |
1 |
vrobj.orient(compass_direction, angle); |
1 |
vrobj.orient(y_angle, x_angle, z_angle); |
1 |
vrobj.rotate_x(angle); |
1 |
vrobj.rotate_y(angle); |
1 |
vrobj.rotate_z(angle); |