The Controller Section


The Controller section allows you to create dispatch controllers for your elevators.  Controllers support both Destination Dispatch routes, and Standard routes.  Controllers are numbered, starting with 1.  When Call Buttons are created, they automatically create controllers.

The section headers and footers are similar to the ones in the Floor section.
To specify a single controller, you would type something like:
<Controller 1>
and end it with:
<EndController>

For a range of controllers, you would use something like:
<Controllers 2 to 10>
and end with:
<EndControllers>

All parameters in a controller section are optional.

Variables:

%controller% - number of the current controller

Parameters:

1. Name - sets the name of the controller
Example: Name = Dispatch Controller %controller%

2. DestinationDispatch - enables or disables DestinationDispatch for this controller.  Right now this is used only by a few elevator functions for checks, and the controller doesn't make much use of it, since it processes routes on a type basis.  The default is false.
Example: DestinationDispatch = true

3. Hybrid - enables hybrid mode for this controller.  When true, allows elevators to both operate in Destination Dispatch and Standard modes.  When this is false and DestinationDispatch is enabled, standard elevator floor selections no longer will work.  The default is False.
Example: Hybrid = false

4. Range - specifies the range of floors that dispatches will handle for a single elevator for Destination Dispatch mode.  The default is 5.
Example: Range = 5

5. MaxPassengers - the maximum number of requests for a route this controller will handle for a single elevator, before selecting another elevator for the route, in Destination Dispatch mode.  The default is 5.
Example: MaxPassengers = 10

6 Elevators - list of elevators to assign to the dispatch controller
Example: Elevators = 1, 2, 3, 4
Example: Elevators = 1 - 4

7. Reprocess - enables or disables the reprocessing of routes if an elevator becomes unavailable.  Note that this only affects DestinationDispatch mode.  The default is false.
Example: Reprocess = true


9. The CallStation Section

The CallStation section allows you to create call stations for your elevators.  This is used for both Destination Dispatch and ordinary call buttons, especially to create advanced call button panels.  This must be created within a Floor section, in order to specify what floor the call station is on.  Call Stations are numbered, starting with 1, this is a global number, not per-floor, even though call stations are created individually on each floor.

The section headers and footers are similar to the ones in the Floor section.
To specify a single call station, you would type something like:
<CallStation 1>
and end it with:
<EndCallStation>

For a range of call stations, you would use something like:
<CallStations 2 to 10>
and end with:
<EndCallStations>

All parameters in a CallStation section are optional.

For Actions, here's the available action command names that can be used for custom controls:
(Floor number) (select floor)
Off
FireOff (set fire service phase 1 to Off for all elevators serviced by this call station)
FireOn (set fire service phase 1 to On for all elevators serviced by this call station)
FireBypass (set fire service phase 1 to Bypass for all elevators service by this call station)
Input1 (number 1 on keypad)
Input2 (number 2 on keypad)
Input3 (number 3 on keypad)
Input4 (number 4 on keypad)
Input5 (number 5 on keypad)
Input6 (number 6 on keypad)
Input7 (number 7 on keypad)
Input8 (number 8 on keypad)
Input9 (number 9 on keypad)
Input0 (number 0 on keypad)
InputMinus (minus on keypad)
InputStar (star on keypad)
InputBackspace (extra feature with character "<")
Up (call elevator up)
Down (call elevator down)

Variables:

%callstation% - number of the current call station, on the current floor
%floor% - the current floor

Parameters:

1. Name - sets the name of the call station
Example: Name = Call Station %callstation%

2. Controller - used to specify the controller this call station will be assigned to.
Example: Controller = 1

3. TimerDelay - specifies the key input timer delay, for keypads, in seconds.  The default is 2 seconds.
Example: TimerDelay = 1

4. InvalidInput - specifies keypad input values that should be treated as invalid.
Example: InvalidInput = 13, 23


Commands:

1. SetPosition - sets the position of this call station, relative to the floor it's on.
Syntax: SetPosition X, Y, Z
Example: SetPosition -3, 4, 0

2. CreatePanel - creates a button panel
Syntax: CreatePanel texturename, rows, columns, direction, buttonwidth, buttonheight, spacingX, spacingY, tw, th
Example: CreatePanel Wall1, 5, 5, right, 0.15, 0.15, 0.3, 0.45, 0, 0

The CreatePanel command creates a button panel for the call station, similar to the elevator car section's CreatePanel command. Rows and Columns define the grid size of the panel. Direction is either "front", "back", "left" or "right", defining which direction the panel faces. SpacingX is the space (percent of a button's width) horizontally between each button, and spacingY is the space (percent of a button's height) vertically between each button. Not all positions need to be used; this is simply to provide a grid layout for the panel. This command also determines the width and height of the panel based on the spacing and button sizes. A simple formula for determining panel width or height is this - for width, it's (columns * buttonwidth) + (spacingX * (columns + 1)); for height, just swap columns with rows and spacingX with spacingY. If a texture is not specified, the back portion of the panel will not be shown.

3. AddControl - command for creating buttons, switches and knobs on the panel
Syntax: AddControl sound, row, column, width, height, hoffset, voffset, selection_position, command_name(s), texture_name(s)
Example 1: AddControl switch.wav, 2, 2, 1, 1, 0, 0, 1, 7, Button7

The AddControl command creates a control on the specified button panel (created with CreatePanel). The command_name(s) and texture_name(s) parameters allow you to specify a list of commands, and a list of textures to go along with those commands. A texture needs to be specified for every command; if you specify 3 commands and only 2 textures, you will get an error. The example shows a Destination Dispatch floor button for floor 7.  Leave the sound field blank for no sound to be played. The selection_position parameter specifies the starting selection position, which is normally 1.  For more examples, see the AddControl command in the Elevator Car section.

Available command names for call stations:

[floor number] (specify only the floor number to select the floor with the Dispatch Controller)

When this command is used, actions are created using the specified commands. The resulting names of the actions are the floor name, followed by a colon, then the CallStation name followed by another colon, and then the command name, in order to be unique to each floor and callstation. So the "7" command for Floor 1 Call Station 1 is created as an action named "Floor 1:Call Station 1:7", and you can specify more actions with that name to run multiple actions when that floor is selected.

4. AddIndicator - creates a destination indicator for this call station
Syntax: AddIndicator sound, texture_prefix, blank_texture, direction, CenterX, CenterZ, width, height, voffset, timer_duration
Example: AddIndicator mechchime9.wav, Button, Black, right, 0, 0, 0.5, 0.5, 1, 5

The AddIndicator command creates a destination indicator for the associated call station.  Sound is the sound played when displaying the elevator's ID, and if an asterisk is specified, the asterisk is replaced with the elevator's ID (in this case, "A"), so "Sound*.wav" would change to "SoundA.wav".  Texture_prefix specifies the base name of the texture used, so if "Button" is specified, an elevator ID of "A" would load the texture "ButtonA".  Blank_texture is the texture to use when off.  CenterX and CenterZ are relative to the call station center.  Timer_duration specifies how long the elevator's ID should be displayed, in seconds.  The error text used is both "??" and "XX", so make sure to load textures for those (such as "Button??").  The "??" value is displayed when a floor entry is invalid, and the "XX" entry means "error".  For error sounds, since the "??" characters sometimes can't be used in filenames, the simulator will expand it to "Invalid", and "XX" to "Error", so as an example the sounds will be "SoundInvalid.wav" and "SoundError.wav", if "Sound*.wav" is used for the sound parameter. 


10. Global Commands/Functions

These commands and functions can be used anywhere in the script.

In this section, Destobject refers to the destination object to create other objects in, which can be:
Floor (only available within a Floor section),
Interfloor (Floor section only),
ColumnFrame (Floor section only),
Shaft [number] (Floor section only),
Stairwell [number] (Floor section only),
Elevator (Elevator section only),
ElevatorCar (Car section only),
External,
Landscape,
Buildings,
(custom model name),
Shaft [number]:[model name] (Floor section only), or
Stairwell [number]:[model name] (Floor section only)
When a command is used inside a Floor section, the Y values specified in these commands will be offsets (relative) of the floor's base, except for interfloor and columnframe names, which use the floor's altitude instead, and custom model names, which are relative of the model's position. A stairwell or shaft can be specified as "Shaft 1", and a custom model, such as one named "Test", can either be specified directly as "Test", or as part of a Shaft or Stairwell object, as "Shaft 1:Test".


a. AddTriangleWall - adds a textured triangular wall. This is the same as AddCustomWall, but with only 3 coordinates used. If specified in a floor section, the Y values are then relative to the floor base.
Syntax: AddTriangleWall destobject, name, texturename, x1, y1, z1, x2, y2, z2, x3, y3, z3, tw, th
Example: AddTrianglewall external, My Triangle, Brick, 0, 0, 0, 0, 10, 0, 0, 0, 10, 0, 0

b. AddWall - adds a textured wall
Syntax: AddWall destobject, name, texturename, thickness, x1, z1, x2, z2, height1, height2, altitude1, altitude2, tw, th
Example: AddWall buildings, Wall1, Brick, 0.5, -10, -10, 10, 10, 15, 15, Floor(2).Altitude, Floor(2).Altitude, 0, 0

The command's parameters are the same as the Floor section's AddWall command. This command is not available inside sections, due to section-specific AddWall commands.

c. AddFloor - adds a textured floor
Syntax: AddFloor destobject, name, texturename, thickness, x1, z1, x2, z2, altitude1, altitude2, reverse_axis, texture_direction, tw, th

The command's parameters are the same as the Floor section's AddFloor command. This command is not available inside sections, due to section-specific AddFloor commands.

d. AddGround - adds a tile-based ground
Syntax: AddGround name, texturename, x1, z1, x2, z2, altitude, tile_x, tile_y
Example: AddGround AddGround Ground, Downtown, -158400, -158400, 158400, 158400, 0, 7920, 7920

This command is mainly for creating large ground sections, since using the AddFloor function with a large amount of texture tiling causes interference problems. The X and Z values specify the total size of the ground, and the tile_x and tile_y specify the size of each tile square to create. For example, if the ground is 10,000 feet wide, and tile_x and tile_y are both 1000, then 100 total tiles will be created; 10 wide and 10 deep. In the example above 7920 is 1/40 of the total width (316800 which is 158400 * 2), so the tile grid will be 40x40 tiles.

e. CreateWallBox - creates 4 walls (box) at the specified coordinate locations
Syntax: CreateWallBox destobject, name, texturename, x1, x2, z1, z2, height, voffset, tw, th, inside, outside, top, bottom
Example: CreateWallBox external, My Box, Brick, -10, 10, -10, 10, 15, 0, 0, 0, true, true, true, true

The parameters in this command are very similar to the ones in the AddWall command shown below in the Floor section, except that a box is created instead of a single wall. Inside and outside determine if the wall should be visible from the inside/outside, and top and bottom determine if the top and bottom walls should be drawn.

f. CreateWallBox2 - creates 4 walls (box) at a specified central location
Syntax: CreateWallBox2 destobject, name, texturename, centerx, centerz, widthx, lengthz, height, voffset, tw, th, inside, outside, top, bottom
Example: CreateWallBox2 external, My Box, Brick, 0, 0, 10, 10, 15, 0, 0, 0, false, true, false, false

The parameters are the same as the above command, except that centerx and centerz define the center of the box, and widthx and lengthz specify the width and length off of the center.

g. AddCustomWall - creates a custom polygon (wall, floor, etc) with any number of vertex points. For example, a triangular wall has 3 vertex points, and a standard wall has 4. This function allows at least 3 vertices. The polygon will be two-sided if the DrawWalls command's MainNegative and MainPositive parameters are true. The RelativeY parameter is optional, and if not specified, when in a floor section, the Y values are always absolute (not relative of the a floor), for compatibility. If the RelativeY parameter is true, and in a floor section, the Y values are relative of the floor's base.
Syntax: AddCustomWall destobject, name, texturename[, RelativeY], x1, y1, z1, x2, y2, z2, x3, y3, z3, ..., tw, th
Example 1: AddCustomWall external, My Wall, Brick, 0, 0, 0, 0, 10, 0, 10, 10, 0, 15, 5, 0, 10, 0, 0, 0, 0
Example 2: AddCustomWall external, My Wall, Brick, true, 0, 0, 0, 0, 10, 0, 10, 10, 0, 15, 5, 0, 10, 0, 0, 0, 0

h. AddCustomFloor - the same as AddCustomWall, but with only one vertical parameter. If specified while in a floor section, the altitude is relative to the current floor's base.
Syntax: AddCustomFloor destobject, name, texturename, x1, z1, x2, z2, x3, z3, ..., altitude, tw, th
Example: AddCustomFloor external, My Wall, Brick, 0, 0, 0, 10, 10, 10, 10, 0, 0, 0, 0

i. AddShaft - creates a shaft at a specified location and floor range
Syntax: AddShaft number, centerx, centerz, startfloor, endfloor
Example: AddShaft 1, 10, 10, 0, 9

The number parameter specifies the shaft number to create. This command just tells the simulator the area that the shaft will take up, and does not create the actual shaft walls. Later on when you create the walls/floors for the shaft, make sure that you make a floor at the very bottom and very top of the shaft (they can extend beyond the walls).

j. CreateStairwell - creates a stairwell at a specified location and floor range
Syntax: CreateStairwell number, centerx, centerz, startfloor, endfloor
Example: CreateStairwell 1, 10, 10, 0, 9

The number parameter specifies the stairwell number to create. This command just tells the simulator the area that the stairwell will take up, and does not create the actual walls.

k. WallOrientation - changes the internal wall orientation parameter, which is used for determining the wall thickness boundaries in relation to their coordinates.
Syntax: WallOrientation = direction
Example: WallOrientation = left

The direction parameter can either be left, center, or right. Center is default. For example, if center is used, than half of the wall's thickness is to the right (positive) of it's x1/x2 or z1/z2 coordinates, and half is to the left (negative) of the coordinates. If left is used, than the coordinates define the wall's left (negative) edge, and the full thickness is to the right (positive) of those. If right is used, then again the coordinates define the wall's right (positive) edge, and the full thickness is to the left (negative) of those. See this graphic for a good example:

In the graphic above, the large box at the top shows what the X and Z coordinates correspond to. The lower examples show the wall orientation as left or right, and if either the difference in x values or z values is larger.

l. FloorOrientation - changes the internal floor orientation parameter, which is used for determining the floor thickness boundaries in relation to their coordinates.
Syntax: FloorOrientation = direction
Example: FloorOrientation = bottom

The direction parameter can either be bottom, center, or top. Top is default. For example, if center is used, than half of the floor's thickness is above (positive) it's x1/x2 or z1/z2 coordinates, and half is below (negative) the coordinates. If bottom is used, than the coordinates define the floor's bottom edge, and the full thickness is the top (positive). If top is used, then again the coordinates define the floor's top edge, and the full thickness is the bottom (negative).

m. DrawWalls - specifies which parts of a wall or floor should be drawn.
Syntax: DrawWalls = MainNegative, MainPositive, SideNegative, SidePositive, Top, Bottom
Example: DrawWalls = true, true, false, false, false, false

The example shown is the default setting. MainNegative is the main (that makes up the front of a wall lengthwise, or the top area of a floor) face on the negative side, MainPositive is the main face on the positive side (back of a wall, or the bottom area of a floor), SideNegative is the side (the part that is along the thickness) face on the negative side, SidePositive is the side face on the positive side; Top refers to either the top side if a wall, or to the front face if a floor; Bottom refers to either the bottom side if a wall, or the back face if a floor. The following graphic explains the sides in detail:

n. SetPlanarMapping - sets the planar texture mapper's parameters.
Syntax: SetPlanarMapping Flat, FlipX, FlipY, FlipZ, Rotate
Example: SetPlanarMapping false, false, false, true, false

FlipX, FlipY and FlipZ reverse the texture mapping per axis, and Flat has it ignore depth., Skyscraper by default uses a simple planar texture mapper, which in simple terms draws the texture in a box around the object. With a basic wall, the top-left of the texture image is mapped to the top left of the wall, the top-right is mapped to the top-right of the wall, etc. If you want the top-right of the texture mapped to the top-left of the wall for example (to flip or change alignment), you'd set FlipX to false. This command is mainly used to change alignment - since the top-left of the texture is mapped to the top-left of the object, that means that textures have a left/top alignment by default. If you change FlipX to true, it'll be right-aligned. If you change FlipY to true, it'll be bottom-aligned. Rotate has it rotate the texture mapping 90 degrees counterclockwise, so instead of the texture being mapped from the top left to bottom right, if Rotate is true, it'll be mapped from the bottom left to top right. See this picture for an example:

In the above picture, I tiled a texture (a black box with yellow around it) 2.5 times on width and height. The bottom floor shows the default texture mapping (SetPlanarMapping false, false, false, false, false); you'll notice that it's aligned to the top-left. In the middle one, I set the FlipX value to true (SetPlanarMapping false, true, false, false, false). In the top one, I set the FlipY value to true (SetPlanarMapping false, false, true, false, false).

o. SetTextureMapping - manually sets UV texture mapping for all polygons generated after this command; ResetTextureMapping restores the values to the defaults or previous
Syntax: SetTextureMapping vertex1, u1, v1, vertex2, u2, v2, vertex3, u3, v3
Example: SetTextureMapping 0, 0, 0, 1, 1, 0, 2, 1, 1

The example shown above is the default value used by the simulator. This command maps the texture coordinates to the specified 3 vertex indices - normally a side of a wall will have 4 vertices/sets of coordinates (0 to 3), and by default the first three are used (top left, top right and bottom right respectively), with the UV coordinates representing the size percentage of the texture (with 1 being 100%, 0.5 being 50%, etc; normally this would relate to absolute texture coordinates) - so in the example, texture coordinate 0,0 (top left) is mapped at the first vertex (top left); texture coordinate 1,0 (really "width, 0") being mapped at the second vertex (top right), and texture coordinate 1,1 (really "width, height") being mapped to the bottom right. For a standard wall, the valid vertex values are from 0 to 3. If a wall or floor is created with AddCustomWall, and if it has for example 7 vertex points, the valid values for this command would then be 0 to 6 (but only 3 vertices can be used for mapping purposes). One caveat with manual texture mapping is that sometimes the simulator will automatically reverse the vertices to keep the wall faces oriented properly, so if you set your texture mapping this way and notice issues, try reversing the coordinates (u3 would be u1 for a 3-point triangular wall, etc) and see if that helps. Textures can also be cropped with this command - for example, to map only a central square of a texture, you'd use:
SetTextureMapping 0, 0.25, 0.25, 1, 0.75, 0.25, 2, 0.75, 0.75

Here's an easier way to see the example above:

0 -> 0, 0
1 -> 1, 0
2 -> 1, 1

The following diagram shows the mapping described above. Texture location 0,0 is mapped to wall vertex 0, location 1,0 is mapped to vertex 1, etc:

p. SetTextureMapping2 - advanced version of SetTextureMapping - manually sets UV texture mapping for all polygons generated after this command; ResetTextureMapping restores the values to the defaults or previous
Syntax: SetTextureMapping2 v1x, v1y, v1z, u1, v1, v2x, v2y, v2z, u2, v2, v3x, v3y, v3z, u3, v3
Example: SetTextureMapping2 x0, y0, z0, 0, 0, x1, y1, z1, 1, 0, x2, y2, z2, 1, 1

See the above description of SetTextureMapping for a detailed description on texture mapping in general. This command mostly does the same as that command, and the example given is the default command (and is equivalent to the SetTextureMapping example). Instead of just choosing which vertex indices to use like SetTextureMapping, this command lets you create your own texture vertices (sets of coordinates) using coordinates of already-existing vertices. The vertex values that can be used start with an "x", "y" or "z", followed by the vertex index. In the example, the X, Y and Z values of the first vertex are mapped to UV coordinate 0,0 - this is because "x0, y0, z0" was specified. A specification of "x0, y2, z0" will use the X and Z values from vertex 0, but the Y value from vertex 2. This way you can specify coordinates outside of the wall/polygon's range. Here's an easier way to see the example:

x0, y0, z0 -> 0, 0
x1, y1, z1 -> 1, 0
x2, y2, z2 -> 1, 1

q. ResetTextureMapping - resets the texture mapping parameters to either the default or previous values
Syntax: ResetTextureMapping = default
Example: ResetTextureMapping = true

If default is true, the texture mapping values are reset to the default, which is shown above in the SetTextureMapping's example. If default is false, the previous values will be loaded and used.

r. ReverseAxis - this command is deprecated, and only used for older versions of the AddFloor commands, since the current ones have this option built-in. This reverses the axis that the difference in altitude/voffset for floors corresponds to. In the AddFloor command, there are parameters for specifying two different altitudes. By default, if the altitudes are different, the floor will angle upward/downward along the Z axis (front/back), but if this is set to true, the floor will angle along the X axis (left/right).
Syntax: ReverseAxis = value

s. ShaftCut - used in conjunction with a shaft object - performs a vertical box cut on all floor objects (floors, ceilings, interfloor, etc) in the specified range.
Syntax: ShaftCut number, startx, startz, endx, endz, start_voffset, end_voffset
Example: ShaftCut 1, -4, -3.5, 4, 3.5, 0, 5

Number is the number of the shaft object to work with. Startx, startz, endx, and endz are two sets of coordinates that specify the cut box's start position and end position, relative to the shaft's central position. Start_voffset is the position above the starting floor's altitude to start the cut at, and end_voffset is the position above the ending floor's altitude to end the cut at. The example cuts a box for shaft 1, with a width from -4 to 4, and a length from -3.5 to 3.5, starting at the starting floor's altitude, and ending at 5 feet above the ending floor's altitude.

t. CutStairwell - used in conjunction with a stairwell object - performs a vertical box cut on all floor objects (floors, ceilings, interfloor, etc) in the specified range. For the parameters, see the ShaftCut command.
Syntax: CutStairwell number, startx, startz, endx, endz, start_voffset, end_voffset
Example: CutStairwell 1, -4, -3.5, 4, 3.5, 0, 5

u. Isect - the Isect function calculates the position that a line intersects with a certain object, such as a floor. Since this is a function, it can be used in-line anywhere.
Syntax: isect(destobject, objectname, startx, starty, startz, endx, endy, endz)
Example: isect(external, wall1, 10, 10, 0, -10, 10, 0)

Destobject is the destination object to get the object from (see the top of this section for more info). Startx, starty, and startz make up the position of the starting position, and endx, endy and endz make up the ending position. The first intersection of the named object is the return value, in "X, Y, Z" format (for example, "10, 1, 3").

For an example, start up the Simple building and enter this into the console:
print isect(external, front, 0, 5, -60, 0, 5, 0)

This command will do a line intersection from the camera's starting position, forward, and will print out the position that it intersects with the External mesh's "Front" wall, the one visible in front of you.

v. SetAutoSize - enables or disables texture autosizing
Syntax: SetAutoSize = AutoWidth, AutoHeight
Example: SetAutoSize = true, true

This command will determine if the simulator should automatically size texture appropriately when applied to an object, such as a wall or floor. By default, both are enabled. The AutoWidth and AutoHeight parameters correspond to the "tw" and "th" parameters of the AddWall, AddFloor, etc commands. If any are false, then the parameters specified in the AddWall etc commands multiply the texture values stored with with the Load or LoadRange commands (see below); those values relate to the number of times a texture is tiled; so if AutoHeight is set to False, "2" is specified in the "th" value of AddWall, and the texture's stored "th" value is 1, then the texture will be tiled twice vertically. If either are true, the specified value will me multiplied by the related stored texture value and then autoadjusted.

w. TextureOverride - overrides textures for the next command. Currently works with the different AddWall, AddFloor, AddInterFloor and CreateWallBox/CreateWallBox2 commands.
Syntax: TextureOverride MainNegativeTex, MainPositiveTex, SideNegativeTex, SidePositiveTex, TopTex, BottomTex
Example: TextureOverride Metal1, ElevFloor, Metal1, Metal1, Metal1, Metal1

This command will allow you to specify multiple textures for a single command such as AddWall. It will only work on the command immediately after this one. In the above example, the Main Positive side of the object will have the texture "ElevFloor", but all other sides will use "Metal1".

x. ShaftShowFloors - allows a range of floors to be shown in an elevator or shaft, primarily for glass elevators.
Syntax: ShaftShowFloors ShaftNumber = range/list[, full]
Example: ShaftShowFloors 1 = 1 - 10
Example 2: ShaftShowFloors 1 = 1 - 10, true

The full parameter is optional, and if it is false or not specified (the default), only a range of floors are shown at a time (by default 3 at a time, and only the ones specified), while the elevator is moving, and is normally used in conjunction with the Group command for atriums. If full is true, all the floors in the list or range are shown at a time, while the user is in the shaft, regardless of if the elevator is moving or not, and are disabled when the user exits the shaft. In the first example above, let's say the user is in an elevator in shaft 1, and is moving upwards from the 2nd floor. In this situation, floors 1 to 10 will be displayed, either a few at a time or the whole set (depending on the Group command), but after they go beyond the range, those floors will be disabled. In the second example, when the user enters the shaft or elevator, floors 1 to 10 will all be enabled, and when they exit the elevator/shaft, those floors will be disabled. For a basic glass elevator, the second example would be used, along with the Group command to group floors 1 to 10 together.

y. ShaftShowInterfloors - display specific interfloors while inside a shaft. This is primarily for pipe/utility shafts.
Syntax: ShaftShowInterfloors ShaftNumber = range/list
Example: ShaftShowInterfloors 1 = 1 - 10

z. ShaftShowOutside - allows objects outside the building (sky, landscape, etc) to be enabled while the user is both inside the specified shaft and on one of the specified floors - primarily for glass elevators.
Syntax: ShaftShowOutside ShaftNumber = range/list
Example: ShaftShowOutside 1 = 1 - 10

In the above example, if a user is riding an elevator in shaft 1, the outside (sky, landscape, etc) will be enabled while the elevator is on any of the floors from 1 to 10. Once the elevator reaches the 11th floor, the outside will be disabled. This command can be mixed with ShaftShowFloors for mixed atrium/external glass elevators such as the ones in the Glass Tower, where the elevator moves upwards through an indoor atrium, and eventually outside above the atrium. In that situation, the floors that comprise the lower (atrium) section would be specified using ShaftShowFloors (such as 1-10), while the upper (outdoor) floors would be specified using ShaftShowOutside (such as 11-20).

aa. ShowFullShaft - determines if an entire shaft should always be shown, such as a glass elevator track.
Syntax: ShowFullShaft ShaftNumber = value
Example: ShowFullShaft 1 = true

ab. StairsShowFloors - allows a range of floors to be shown while inside the specified stairwell.
Syntax: StairsShowFloors StairwellNumber = range/list
Example: StairsShowFloors 1 = 1 - 10
In the above example, let's say the user is in stairwell 1, and is walking upwards from the 2nd floor. In this situation, the 2nd floor will be visible/enabled while they're walking up (since it was in the range specified with this command), but when they reach the 11th floor, that floor will be invisible/disabled.

ac. ShowFullStairs - determines if an entire stairwell should be shown. If set to "true" or "inside", the full stairwell is shown only when the user is inside the stairwell. If set to "always", the full stairwell is always shown. Setting this to true is useful for stairwells that have a gap in the center between the actual stairs.
Syntax: ShowFullStairs StairwellNumber = value
Example: ShowFullStairs 1 = inside

ad. TextureFlip - flips specified textures for the next command.. Currently only works with the different AddWall, AddFloor and AddInterFloor commands. The values available are 0 for no flipping, 1 for horizontal flip, 2 for vertical flip, and 3 for both horizontal and vertical.
Syntax: TextureFlip MainNegative, MainPositive, SideNegative, SidePositive, Top, Bottom
Example: TextureFlip 1, 1, 0, 0, 0, 0

This command will allow you to flip textures on specific parts of a wall or floor created with a command such as AddWall. It will only work on the command immediately after this one. In the above example, the Main Positive and Main Negative sides of the object will have their textures flipped horizontally.

ae. Cut - performs a manual box cut on an object
Syntax: Cut destobject, x1, y1, z1, x2, y2, z2, cutwalls, cutfloors
Example: Cut external, -5, -5, -5, 5, 5, 5, false, true

The x, y and z values specify the start and end coordinates of the box cut. If cutwalls is true, the function will cut walls; if cutfloors is true, it'll cut floors.

af. Mount - mounts a zip file in the data directory into a virtual path.
Syntax: Mount filename, path
Example: Mount myfile.zip, mydirectory

In this example, the file myfile.zip located in Skyscraper's data directory will be mounted as "mydirectory", and so a file such as test.jpg inside that zip file will appear as "mydirectory/test.jpg".

ag. AddFloorAutoArea - defines an area that will automatically enable and disable floors when the user moves within it, similar to a stairwell
Syntax: AddFloorAutoArea x1, y1, z1, x2, y2, z2
Example: AddFloorAutoArea -100, 0, -100, 100, 100, 100

ah. AddSound - creates a user-defined sound at the specified position
Syntax: AddSound name, filename, x, y, z, loop[, volume, speed, min_distance, max_distance, doppler_level, cone_inside_angle, cone_outside_angle, cone_outside_volume, direction_x, direction_y, direction_z]
Example 1: AddSound MySound, sound.wav, 10, 100, 5, true
Example 2: AddSound MySound, ambient.ogg, 10, 100, 5, true, 1, 100, 1, -1, 0, 360, 360, 1, 0, 0, 0

This command creates a custom sound in the specified position, and has a number of optional parameters - the defaults for the optional parameters are shown in Example 2. Loop specifies if the sound should loop and play on startup. If you're going to use any of the optional parameters, you must specify them all. X, Y and Z specify the location in 3D space that the sound will be at, volume specifies the volume percentage (with 1.0 being 100%) of the sound, speed determines the playback speed of the sound in percent, min_distance and max_distance set the minimum and maximum distances that the sound can be heard at full volume - by default, minimum is 1 and maximum is -1. Doppler_level specifies the doppler scale for the sound (0 means off, the default, 1 is normal, 5 is max). Cone_inside_angle is the angle within which the sound is at it's normal volume (default 360), cone_outside_angle is the outside angle that the sound is at it's normal volume (default 360, shouldn't be less than the inside angle), and cone_outside_volume is the volume level of the sound outside (0.0 to 1.0, default 1.0). Direction_x, direction_y and direction_z specify the direction of the sound cone.

ai. AddReverb - creates a reverb object at the specified position
Syntax: AddReverb name, type, x, y, z, min_distance, max_distance
Example: AddReverb MyReverb, ConcertHall, 0, 0, 0, 0, 100

Reverb objects apply a certain type of reverb in a sphere.  All sounds within this sphere are then heard with the reverb.  Min_distance and max_distance determine the distance from the center (X, Y, Z values) that the reverb can be heard.

Type specifies the type of reverb:

Generic
PaddedCell
Room
Bathroom
LivingRoom
StoneRoom
Auditorium
ConcertHall
Cave
Arena
Hangar
CarpetedHallway
Hallway
StoneCorridor
Alley
Forest
City
Mountains
Quarry
Plain
ParkingLot
SewerPipe
Underwater

aj. GetWallExtents - the GetWallExtents command returns the X and Z extents (minimum and maximum values) of a wall, at the specified altitude. The command will return the results in the MinX, MinZ, MaxX and MaxZ variables.
Syntax: GetWallExtents destobject, wallname, altitude
Example: GetWallExtents external, wall1:front, 10

Then to use the values:
Example: Set 2 = %minz%

Destobject is the destination object to get the object from (see the top of this section for more info). Wallname specifies the name of the wall to get the extents from. Generally this should be in the form of "name:side", but if you leave out the "side" parameter, it'll choose one of the sides from a pre-defined search list. Sides of walls made from any AddWall command generally have "front", "back", "left" and "right" sides. Walls made using AddCustomWall and AddTriangleWall have sides of "0" (front) and "1" (back), so with those you'd specify "name:0" for the front. Altitude specifies the altitude to use for the check - basically it makes a copy of the wall, cuts it down to a line at that altitude, and returns the coordinates of the endpoints. The command will store the results in the MinX, MinZ, MaxX and MaxZ variables, which can be used anywhere in the script - to get the minimum X result, you'd use %minx%.

ak. AddAction - defines an action, to be used by custom controls and triggers.
Syntax: AddAction name, parent_object, command[, parameters]
Example: AddAction MyAction, Floor 2, ChangeTexture, OldTexture, NewTexture
Example: AddAction MySoundAction, Floor 2, PlaySound, Sound1, false

This command creates a global action, to be used with commands such as AddActionControl and AddTrigger. Name must be a globally-unique name. If the same name is used for multiple actions, all of those actions will be run when an object uses that name. Parent_object is the object to use to perform the action on. Currently includes "Global", floors such as "Floor 2", elevators such as "Elevator 1", elevator cars such as "Elevator 1:Car 2", shafts like "Shaft 1", stairwells like "Stairwell 2", call buttons such as "Floor 0:Call Panel 1", and can also be specified as a range of objects, such as "Floors 3 to 8".

Commands and parameters:

(General)
ChangeTexture: oldtexture, newtexture
PlaySound: name, loop true/false
StopSound: name
Teleport: X, Y, Z (destination coordinates to teleport camera to)
GotoFloor: floor_number (teleport to specified floor number
OpenShaftDoor: door number (0 for all), floor number (parent needs to be the elevator object)
CloseShaftDoor: door number (0 for all), floor number (parent needs to be the elevator object)
OpenShaftDoorManual: door number (0 for all), floor number (parent needs to be elevator object)
CloseShaftDoorManual: door number (0 for all), floor number (parent needs to be elevator object)
AccessDown: floor number (parent needs to be elevator object)
AccessOff: floor number (parent needs to be elevator object)
AccessUp: floor number (parent needs to be elevator object)
(for other elevator commands, see the AddControl command in the elevator section)
Forward, Reverse, or Stop (parent needs to be an Escalator or MovingWalkway)
Enable or Disable (these are used by CameraTextures)
On and Off (these are used by Lights and Revolving Doors)
Open and Close (used by Doors)
AutoClose: interval (used by Doors)

The PlaySound command plays sounds created with the AddSound command. With this command, if multiple sounds have the same name, all of those sounds will be played simultaneously when the related action is run.

OpenShaftDoor example, to open elevator 1's shaft doors on floor 2:

AddAction MyDoorOpen, Elevator 1, OpenShaftDoor, 0, 2

PlaySound example, to play sound FireAlarm created using the AddSound command on Floor 1:

AddAction MySound, Floor 1, FireAlarm, true

The Access commands enable and disable Hoistway Access Mode on the elevator, which is part of Inspection Mode.
For example, when AccessUp is used by a switch on the elevator's lowest landing, and the elevator is in inspection mode with the shaft doors open, the interlock check for that shaft door is disabled, and the elevator will move upwards at leveling speed. If AccessDown is set, the elevator will move down. When AccessOff is set, the elevator will refuse to move, due to the shaft doors being open, which causes the interlock check to fail.

al. AddActionControl - creates a custom control that uses a specific action defined by AddAction.
Syntax: AddActionControl name, sound, direction, centerx, centerz, width, height, voffset, selection_position, action_name(s), texture_name(s)
Example: AddActionControl MyControl, switch.wav, front, -10, 10, 1.5, 1.5, 4, 1, UndoMyAction, MyAction, Touch, TouchLit

AddActionControl command creates an advanced control similar to elevator button panel controls, but assigned to an action created with the AddAction command. The action_name(s) and texture_name(s) parameters allow you to specify a list of actions, and a list of textures to go along with those actions. There needs to be a texture for every action; if you specify 3 actions and only 2 textures, you will get an error. The control starts up in the first action, and switches to the next actions in sequence when it's clicked. Direction is the direction the control itself will face in 3D space (front, left, right, back). Leave the sound field blank for no sound to be played. Selection_position is the selection position to start at, which is normally 1.

am. AddTrigger - creates a trigger that is used to signal an action when the user's camera enters or leaves the defined area.
Syntax: AddTrigger name, sound, start_x, start_y, start_z, end_x, end_y, end_z, action_names(s)
Example: AddTrigger MyTrigger, switch.wav, -30, 0, -30, -20, 10, -20, UndoMyAction, MyAction

AddTrigger creates a trigger similar to action controls (AddActionControl) and elevator controls. The action_names(s) parameter allows you to specify a list of actions that this trigger will call when the camera enters or exits the area. The trigger starts in the first action, and will switch to each consecutive action when the users enters/leaves. The X, Y and Z parameters specify the 3D box that defines the trigger area. Leave the sound field blank for no sound to be played.

an. AddModel - adds a global 3D model. If a filename is specified, the model's textures/materials must be defined in a separate ".material" file, and a separate collider mesh ".collider.mesh" will be loaded. In that situation, if a collider mesh isn't available, a simple box collider will be created. If a filename is not specified, this command will create a new empty model, where it's name can be used as the destobject parameter in other commands, and a collider will be automatically created.
Syntax: AddModel name, filename, center, CenterX, CenterY, CenterZ, RotationX, RotationY, RotationZ, MaxRenderDistance, ScaleMultiplier, EnablePhysics, Restitution, Friction, Mass
Example 1: AddModel MyModel, cube.mesh, true, 0, 0, 0, 0, 0, 0, 0, 1, false, 0, 0, 0
Example 2: AddModel MyModel, cube.mesh, true, 0, 0, 0, 0, 0, 0, 0, 1, true, 0.1, 0.5, 0.1
Example 3: AddModel MyModel, , false, 0, 0, 0, 0, 0, 0, 0, 1, true, 0.1, 0.5, 0.1

The Center value is either true or false, and determines if the loaded model should be automatically centered, otherwise the exact mesh positioning in the model file will be used. MaxRenderDistance determines the maximum distance in feet that the object will be shown (0 means unlimited). ScaleMultiplier allows you to change the size of the object during the load - for example, set to 2 to double the size. Model files are in the OGRE native mesh format. In the example, the material/texture file is cube.material, and the optional collider mesh file is cube.collider.mesh. EnablePhysics enables Bullet physics on the object (physics will only work if you don't provide a collider mesh), and Restitution, Friction and Mass determine the physical properties of the object.

ao. CreateWallObject - creates a custom wall object, in the specified mesh object. Wall objects are used to contain a number of polygons, to represent a wall structure, and are normally automatically created by other commands. The AddPolygon command is used with this command, to create the polygons.
Syntax: CreateWallObject destobject, name
Example: CreateWallObject landscape, mywall

ap. AddPolygon - this is the same as the AddCustomWall command, but adds the custom polygon to an existing (usually custom) wall object, instead of creating a new one. The example below adds the polygon to the Landscape mesh object, to the custom-created "mywall" Wall Object, which was created with the CreateWallObject command. The polygon will be two-sided if the DrawWalls command's MainNegative and MainPositive parameters are true. If created in a Floor section, the Y values will be relative to that floor's base.
Syntax: AddPolygon destobject, wallname, texturename, x1, y1, z1, x2, y2, z2, x3, y3, z3, ..., tw, th
Example: AddPolygon landscape, mywall, Brick, 0, 0, 0, 0, 10, 0, 10, 10, 0, 10, 0, 10, 0, 0

aq. SetKey - specifies that the next created model will be a key. The model will be tagged with a specific key ID number, and when clicked, the key ID will be added to the user's keyring and the model will be deleted. The value must be greater than 0.
Syntax: SetKey keyid
Example: SetKey 1

ar. SetLock - sets the lock and key parameters for subsequent doors, controls/buttons, and call buttons that are created.
Syntax: SetLock locked, keyid
Example: SetLock 1, 3

For doors, locked specifies which sides (directions) are locked. Values are:
0 - unlocked
1 - negative-facing (left/front) side locked
2 - positive-facing (right/back) side locked
3 - both sides locked

For controls/buttons and call buttons, the locked values are:
0 - unlocked
1 - locked

Locked objects can only be unlocked if the person has the key number specified as keyid. If keyid is 0, no key is needed to lock or unlock. To reset to the defaults, use 0 for the locked setting and 0 for keyid.

as. Print - prints the contents of a line to the console. This command will still convert variables and even math expressions, and output the results.
Syntax: Print text
Example: Print 1+1

at. Delete - deletes an object. This command is normally used after a building has loaded.
Syntax: Delete object_number
Example: Delete 12

au. RunAction - runs an action by name. This command is normally used after a building has loaded.
Syntax: RunAction name
Example: RunAction myaction

av. AddActionParent - adds a parent object to an existing action. See the AddAction command for details on parent objects
Syntax: AddActionParent name, object
Example: AddActionParent myaction, Elevator 2
Example: AddActionParent myaction, Floors 2 to 5

aw. RemoveActionParent - removes a parent object from an existing action. See the AddAction command for details on parent objects. This command is normally used after a building has loaded.
Syntax: RemoveActionParent name, object
Example: RemoveActionParent myaction, Elevator 2
Example: RemoveActionParent myaction, Floors 2 to 5

ax. GotoFloor - jumps the user to the specified floor. This command is normally used after a building has loaded.
Syntax: GotoFloor floor
Example: GotoFloor 3

ay. EndPoint - the EndPoint function calculates endpoint coordinates given a starting point, direction (angle in degrees), and distance.
Syntax: endpoint(startx, starty, angle, distance)
Example: endpoint(-150, 150, 180, 20)
Result: -150, 130

az. FloorInfo - show information on all floors or optionally a specified floor
Syntax: FloorInfo [number]
Example: FloorInfo 3

ba. ListTextures - list the loaded texture names (materials) and filenames

bb. ListVisibleMeshes - list the mesh objects currently visible by the camera

bc. ShowLoadedSounds - show the sounds currently loaded in the sound system, and the number of associated sound objects for each one

bd. ShowPlayingSounds - show the sounds currently playing in the sound system, with each filename followed by a listing of playing sound objects

be. Teleport - warps the user to the specified location. This command is normally used after a building has loaded.
Syntax: Teleport X, Y, Z
Example: Teleport 3, 5, 10


11. Extended Commands/Functions

Extended commands are global commands that use a newer method of specifying objects to use.  The previous Global Commands have an older method of specifying Mesh objects, these newer commands allow you to specify raw SBS objects.  Some commands are broken out, so that you can specify parameters for an object with separate commands for each type of parameter.  This also introduces Levels, which are the floors used in Shafts and Stairwells.

In this section, Parent refers to the destination SBS object to use as the object's parent, such as if you create a Light object named "Light1" within Floor 3, the Floor 3 object would be the parent, and the full SBS name would be "Floor 3:Light1".

Current examples:

Floor 1
Elevator 1
Elevator 1:Car 1
Shaft 1:Level 2
Stairwell 5:Level 6
DoorManager
(used for creating global/external Doors)
SBS (creates a global object, available with some commands)


a. AddLight - adds a light, the parameters of the light can be changed later.  Note that lights only work if Lighting is enabled in the INI file.
Syntax: AddLight parent, name, type
Example: AddLight Floor 0, My Light, 0

The example will create "My Light" on floor 0.  Type is 0 for a point light, 1 for a directional light, and 2 for a spotlight.  The related Action commands that lights use are On and Off, these can be used to create a lightswitch for example.

b. SetLightColor - sets the color of a light.  The default is white.
Syntax: SetLightColor parent, name, ColorR, ColorG, ColorB
Example: SetLightColor Floor 0, My Light, 0.5, 0, 1

The example will set the color of "My Light" to a shade of purple.

c. SetLightSpecular - sets the specular color of a light.  The default is black.
Syntax: SetLightSpecular parent, name, ColorR, ColorG, ColorB
Example: SetLightSpecular Floor 0, My Light, 1, 1, 1

The example will set the specular color of My Light to white.


d. SetLightAttenuation - sets the attenuation of the specified light.  This has no effect on directional lights.
Syntax: SetLightAttenuation parent, name, range, constant, linear, quadratic
Example: SetLightAttenuation Floor 0, My Light, 100000, 1, 0, 0

The example shows the default for this.  Range is the upper range of the light in world units.  A constant of 1 means never attenuate, 0 means always attenuate.  A linear of 1 means evenly attenuate over the distance.  Quadratic adds a curvature to the attenuation formula.

e. SetSpotlightRange - sets the range of a spotlight.  This is only applicable to spotlights (type 2).
Syntax: SetSpotlightRange parent, name, inner_angle, outer_angle, falloff
Example: SetSpotlightRange Floor 0, My Light, 30, 40, 1

The example shows the defaults.  Inner_angle is the angle covered by the bright inner cone.  Outer_angle is the angle covered by the outer cone.  Falloff is the rate of falloff between the inner and outer cones, 1 means linear, less means slower, higher means faster.

f. SetLightDirection - sets the direction of a light, not applicable to point lights.
Syntax: SetLightDirection parent, name, X, Y, Z
Example: SetLightDirection Floor 0, My Light, 10, 50, 20

g. MoveLight - moves a light.
Syntax: MoveLight parent, name, X, Y, Z
Example: MoveLight Floor 0, My Light, 0, 10, 0

The example will move "My Light" up 10 feet.

h. AddCameraTexture - creates a CameraTexture in the specified object.  CameraTextures are turned off by default, but can be turned on with Actions, used in conjunction with a trigger object.  See the demo building "Simple - CameraTexture".
Syntax: AddCameraTexture parent, name, quality, fov, position_x, position_y, position_z, use_rotation, rotation_x, rotation_y, rotation_z
Example: AddCameraTexture Floor 0, Camera1, 1, 71, 10, 10, 0, true, 0, 90, 0

The example will create Camera1 on Floor 0, with a default FOV.  Quality can either be 1, 2, or 3, and determines the resolution of the image.  If use_rotation is false, the specified rotation will be a LookAt position.  A light will also move with it's parent object, such as if you put a light in an elevator, it'll move as the elevator goes up.

The related Action commands that CameraTextures use are Enable and Disable, see the Triton Center building for an example of why this is needed, the framerate drops when the cameratexture is active, so it is only enabled in a small range near the TV screen.

Name will create a texture with that name, there can only be one texture with that name in the simulator instance, so make it unique.  Once the CameraTexture is created, use another command such as AddWall to create a TV screen, and use the CameraTexture's name as the wall's texture.  When the CameraTexture is enabled, you'll see a live video feed on your wall.

i. AddSlidingDoor - creates a sliding door object, which is a door with the rotation setting turned off.
Syntax: AddSlidingDoor parent, name, open_sound, close_sound, open_state, texture, side_texture, thickness, face_direction, open_direction, open_speed, close_speed, CenterX, CenterZ, width, height, voffset, tw, th, side_tw, side_th
Example: AddSlidingDoor Floor 0, MyDoor, open.wav, close.wav, false, Door, Brick, 0.2, left, right, 10, 5, 5, 3.5, 8, 0, 1, 1

The example will create a sliding door on Floor 0.  Open_state determines if the door is open on startup.  Side_texture defines the texture used on the sides of the door.  Face_direction is the direction the door faces, such as "left", "right", "front" or "back".  Open_direction is either "up", "down", "left"/"front" or "right"/"back".

j. AddStdDoor - creates a standard door object, which is a door with the rotation setting turned on.  This command replaces the older AddDoor and related commands.
Syntax: AddStdDoor parent, name, open_sound, close_sound, open_state, texture, side_texture, thickness, face_direction, open_direction, open_speed, close_speed, CenterX, CenterZ, width, height, voffset, tw, th, side_tw, side_th
Example: AddStdDoor Floor 0, MyDoor, open.wav, close.wav, false, Door, Brick, 0.2, left, right, 10, 10, 5, 5, 3.5, 8, 0, 1, 1, 1, 1

The example will create a standard door on Floor 0.  Open_state determines if the door is open on startup.  Side_texture defines the texture used on the sides of the door.  Face_direction is the direction the door faces, such as "left", "right", "front" or "back".  Open_direction is either "left", "right", "front" or "back".

k. CreateCustomDoor - starts a manually-created (custom) door.  The commands CustomDoorComponent and FinishDoor need to be used after this command.
Syntax: CreateCustomDoor parent, name, open_sound, close_sound, rotate
Example: CreateCustomDoor Floor 0, My Custom Door, open.wav, close.wav, false

The example will create a sliding door "My Custom Door" on floor 0.

l. CustomDoorComponent - creates a door component in the specified custom door.
Syntax: CustomDoorComponent parent, name, component_name, texture, side_texture, thickness, face_direction, open_direction, OpenClockwise, OpenSpeed, CloseSpeed, x1, z1, x2, z2, height, voffset, tw, th, side_tw, side_th
Example: CustomDoorComponent Floor 0, My Custom Door, RightDoor, StairsDoor, Brick, 0.2, front, front, false, 10, 10, -5, -5, 0, -5, 8, 0, 0, 0, 0, 0

The example will create a custom door component on floor 0's door "My Custom Door" named "RightDoor".  Face_direction can either be "left", "right", "front" or "back", open_direction can be "up", "down", "left"/"front", or "right"/"back".  OpenClockwise is used when door rotation is on, it determines if the door opens clockwise or not.

m. FinishDoor
- finishes a manually-created (custom) door.

Syntax: FinishDoor parent, name, open_state
Example: FinishDoor Floor 0, My Custom Door, true

The example will finish the custom door, and open it on startup.

n. MoveDoor - changes a door's position

Syntax: MoveDoor parent, name, X, Y, Z
Example: MoveDoor Floor 0, My Custom Door, -5, 0, 0

o. SetAutoClose - enables or disables the autoclose timer on a door

Syntax: SetAutoClose parent, name, interval
Example: SetAutoClose Floor 0, My Custom Door, 5

The example will automatically close "My Custom Door" after being open for 5 seconds.  Set interval to 0 to turn off the timer.

p. CreatePrim - creates a new primitive object and shape

Syntax: CreatePrim parent, name, type, [shape parameters...]
Example: CreatePrim Floor 0, MyPrim, Sphere, 2.0, 5.0, 5.0, 16, 16

The Type parameter determines the type of shape to create, with the shape parameters following it:
    -Plane, SizeX, SizeY, SegmentsX, SegmentsY, UTile, VTile
    -Sphere, Radius, UTile, VTile, Rings, Segments
    -Cylinder, Radius, Height, UTile, VTile, SegmentsBase, SegmentsHeight, Capped
    -Torus, Radius, SectionRadius, UTile, VTile
    -Cone, Radius, Height, UTile, VTile, SegmentsBase, SegmentsHeight
    -Tube, InnerRadius, OuterRadius, Height, UTile, VTile, SegmentsBase, SegmentsHeight
    -Box, SizeX, SizeY, SizeZ, UTile, VTile, SegmentsX, SegmentsY, SegmentsZ
    -Capsule, Radius, Height, Rings, UTile, VTile, Segments, SegmentsHeight, Capped
    -TorusKnot, Radius, SectionRadius, UTile, VTile, SegmentsCircle, SegmentsSection, P, Q
    -IcoSphere, Radius, UTile, VTile, Iterations
    -RoundedBox, SizeX, SizeY, SizeZ, ChamferSize, UTile, VTile, SegmentsX, SegmentsY, SegmentsZ, Capped
    -Spring, RadiusCircle, RadiusHelix, Height, Round, UTile, VTile, SegmentsCircle, SegmentsPath, Capped
    -Prism, Radius, Height, Sides, SegmentsHeight, Capped
 

The command creates a new prim with an attached shape on the parent object, making it available for use by future commands.
The example creates a sphere shape on the prim "MyPrim", on floor 0.

q. PrimCollider - determines if a collider should be created for the specified primitive

Syntax: PrimCollider parent, name, value
Example: PrimCollider Floor 0, MyPrim, -1

The example turns off the collider flag for the prim, so that when the PrimAttach command is run, a collider is not created.  The values are currently 0 for standard collider, and -1 for no collider.

r. PrimAttach - attaches the specified primitive to the parent object

Syntax: PrimAttach parent, name, X, Y, Z, rotation_x, rotation_y, rotation_z
Syntax2: PrimAttach parent, name, X, Y, Z, rotation_x, rotation_y, rotation_z, max_render_distance, scale_multiplier, enable_physics, restitution, friction, mass
Example: PrimAttach Floor 0, MyPrim, 0, 5, 0, 0, 0, 0
Example2: PrimAttach Floor 0, MyPrim, 0, 5, 0, 0, 0, 0, 0, 1, true, 0.1, 0.5, 0.1

The example places the prim at the center of floor 0, at a height of 5 feet.  The second example creates the prim and enables physics on it.

s. PrimTexture - assigns a texture to a primitive

Syntax: PrimTexture parent, name, texture
Example: PrimTexture Floor 0, MyPrim, Default

The example assigns the system texture "Default" to the prim MyPrim.

t. PrimVisible - determines if a primitive should always be visible or not.

Syntax: PrimVisible parent, name, value
Example: PrimVisible Floor 0, MyPrim, true

The example makes the prim "MyPrim" always visible.

u. CreateObject - creates a custom object.  The command FinishObject needs to be used after this command.
Syntax: CreateObject parent, name, X, Y, Z, RotationX, RotationY, RotationZ, max_render_distance, scale_multiplier
Example: CreateObject Floor 0, My Custom Object, 0, 0, 0, 0, 0, 0, 100, 1

The example will create a custom object "My Custom Object" on floor 0, at the center of the building.

v. FinishObject
- finishes a custom object.  This needs to be run after the CreateObject command, and after working on the object such as adding walls.

Syntax: FinishObject parent, name[, restitution, friction, mass]
Example: FinishObject Floor 0, My Custom Object
Example 2: FinishObject Floor 0, My Custom Object, 1, 1, 1

The first example will finish the custom object "My Custom Object" on floor 0, and set it to non-physical.  The second example is the same but enables physics on the object.

w. ObjectWall - adds a wall to the specified custom object.  This needs to be run after the CreateObject command.

Syntax: ObjectWall parent, name, texture, thickness, x1, z1, x2, z2, height1, height2, altitude1, altitude2, tw, th
Example: ObjectWall Floor 0, My Custom Object, Brick, 0, -10, 0, 10, 0, 10, 10, 0, 0, 1, 1

The example will create a wall on custom object "My Custom Object" on floor 0.


x. ObjectFloor - adds a floor to the specified custom object.  This needs to be run after the CreateObject command.

Syntax: ObjectFloor parent, name, texture, thickness, x1, z1, x2, z2, altitude1, altitude2, reverse_axis, texture_direction, tw, th
Example: ObjectFloor Floor 0, My Custom Object, Brick, 0, -10, -10, 10, 10, 0, 0, false, false, 1, 1

The example will create a floor on custom object "My Custom Object" on floor 0.

y. ObjectWallBox - adds a wall box to the specified custom object.  This needs to be run after the CreateObject command.

Syntax: ObjectWallBox parent, name, texture, x1, x2, z1, z2, height, voffset, tw, th, inside, outside, top, bottom, autosize
Example: ObjectWallBox Floor 0, My Custom Object, Brick, -10, 10, -10, 10, 10, 0, 1, 1, true, true, true, true, true

The example will create a box on custom object "My Custom Object" on floor 0.

z. ObjectWallBox2 - adds a centered wall box to the specified custom object.  This needs to be run after the CreateObject command.

Syntax: ObjectWallBox parent, name, texture, CenterX, CenterZ, WidthX, WidthZ, height, voffset, tw, th, inside, outside, top, bottom, autosize
Example: ObjectWallBox Floor 0, My Custom Object, Brick, 0, 0, 10, 10, 10, 0, 1, 1, true, true, true, true, true

The example will create a centered box on custom object "My Custom Object" on floor 0.

aa. ObjectVisible - determines if the object should always be visible or not.

Syntax: ObjectVisible parent, name, value
Example: ObjectVisible Floor 0, My Custom Object, true


ab. EnablePhysics - an experimental feature that enables physics on SBS mesh objects

Syntax: EnablePhysics parent, meshname, value, restitution, friction, mass
Example: EnablePhysics Floor 0, Level 0, true, 0.1, 0.5, 0.1

The example turns physics on for Floor 0's mesh, which is a pretty crazy effect.

ac. Rotate - rotate an object

Syntax: Rotate object, X, Y, Z, speed
Example: Rotate Floor 0:MyPrim, 0, 1, 0, 1

Object is similar to the other commands, but the parent and child objects are separated by a colon, this was done to simplify the C++ code for these.
The example rotates the prim object "MyPrim" on Floor 0, on the Y axis.  This command is mainly provided for runloops.

ad. Move - move an object

Syntax: Move object, X, Y, Z, speed
Example: Move Floor 0:MyPrim, 0, 1, 0, 1

The example causes the prim object "MyPrim" on Floor 0, to move up vertically.  This command is mainly provided for runloops.

ae. SetPosition - set the position of an object

Syntax: SetPosition object, X, Y, Z
Example: SetPosition Floor 0:MyPrim, 5, 0, 0

The example sets the position of the prim object "MyPrim" on Floor 0, to "5, 0, 0".  This command is mainly provided for runloops.

af. SetPositionY - set the Y (vertical) position of an object

Syntax: SetPositionY object, value
Example: SetPositionY Floor 0:MyPrim, 5

The example sets the vertical position of the prim object "MyPrim" on Floor 0, to 5.  This command is mainly provided for runloops.

ag. SetPositionRelative - set the position of an object relative to it's parent

Syntax: SetPositionRelative object, X, Y, Z
Example: SetPositionRelative Floor 0:MyPrim, 5, 0, 0

The example sets the position of the prim object "MyPrim" on Floor 0, to "5, 0, 0", relative of the parent's (Floor 0) position.  This command is mainly provided for runloops.

9. END command

The End command tells the software to stop processing the current script and start the simulation. This is optional.
Example: <end>


10. BREAK command

The Break command triggers a break section in the script processor, and is used when running a debug build of the simulator, with a debugger attached. A breakpoint can be set on the associated line in fileio.cpp, and when this command is called, the debugger will hit the breakpoint.
Example: <break>

 

12. Predefined Functions

There are a number of script functions provided by the simulator. Currently there's only a single script for elevator doors - see the Simple building (noted at the bottom of this page) for an example. These functions can be used by putting this line in your script:

<Include data/scripts/elevator_doors.txt>

You'll then be able to use some predefined door functions:

1. elevdoor_single - creates a single-slide elevator door.
Syntax: elevdoor_single(door_number, texture, side_texture, thickness, CenterX, CenterZ, width, height, door_direction, movement_direction, speed, is_shaft_door)

Door_Direction is either "left", "right", "front" or "back" and is the direction the doors face (torwards the outside of the elevator). Movement_direction is the direction the door should move.

2. elevdoor_center - creates a center-open elevator door.
Syntax: elevdoor_center(door_number, texture, side_texture, thickness, CenterX, CenterZ, width, height, door_direction, speed, is_shaft_door)

3. elevdoor_center_classic - creates a center-open elevator door with a partially open interior door.
Syntax: elevdoor_center_classic(door_number, texture, side_texture, thickness, CenterX, CenterZ, width, height, door_direction, speed, is_shaft_door)

4. elevdoor_dualspeed_left - creates a dual-speed door that opens to the left
Syntax: elevdoor_dualspeed_left(door_number, texture, side_texture, thickness, CenterX, CenterZ, width, height, door_direction, speed, is_shaft_door)

5. elevdoor_dualspeed_right - creates a dual-speed door that opens to the right
Syntax: elevdoor_dualspeed_right(door_number, texture, side_texture, thickness, CenterX, CenterZ, width, height, door_direction, speed, is_shaft_door)

6. elevdoor_center_dualspeed - creates a dual-speed center-open door
Syntax: elevdoor_center_dualspeed(door_number, texture, side_texture, thickness, CenterX, CenterZ, width, height, door_direction, speed, is_shaft_door)

 

13. The Buildings Section

The Buildings section allows you to load additional buildings, into separate simulation engines, and have them all be visible and usable in the same scene. This section is small, and mainly exists to provide clarity in scripts. Additional buildings also have their own script interpreters, so their scripts (and things such as includes) are completely isolated from each other. Note that this section is skipped when reloading the building (Ctrl-R). This section should be placed at the beginning of the script file, so that the progress bar during load can be accurate. When the script is finished loading, the primary building (the one included in the main script) will be automatically cut for each child building (using the section's Cut parameters), making it easy to integrate new buildings into existing spaces with large landscapes, or even city blocks. Nesting of this section is also supported, so that if a child building also has a buildings section, it'll process it, and the parent building will be cut for each child building.

The section starts with this header:
<Buildings>

and ends with this footer:
<EndBuildings>

Parameters (all are optional):

1. ConcurrentLoads - if this is set to true, load all buildings simultaneously. Default is false, which loads each building in order.
Example: ConcurrentLoads = true

2. CutLandscape - if this is set to true, cut the Landscape mesh of buildings, discarding the area outside of the building's set boundaries. Default is true
CutLandscape = true

3. CutBuildings - if this is set to true, cut the Buildings mesh of buildings, discarding the area outside of the building's set boundaries. Default is true
CutBuildings = true

4. CutExternal - if this is set to true, cut the External mesh of buildings, discarding the area outside of the building's set boundaries. Default is false, since this may have an unnecessary performance impact
CutExternal = true

5. CutFloors - if this is set to true, cut the Floors meshes of buildings, discarding the area outside of the building's set boundaries. Default is false, since this may have an unnecessary performance impact
CutFloors = true

Commands:

1. Load - load a building, creating a new Engine Context (script interpreter and sim engine pair) for it. This command requires a building filename to be specified, and optionally allows the position to be set (which overrides the Position value in that building's Globals section), the rotation (Y axis, which is left/right) in degrees to be set, and the bounds values to be set (which also overrides the building's Bounds value). For the rotation value, if "90" is specified, the building is rotated so that it faces the right. If the value is "270" or "-90", the building faces the left. The Bounds values are used to determine the position limits of what are considered that building, where if a building has a position X value of 200, and the MinX is -100 and MaxX is 100, the global positions of 100X to 300X are "inside" that building's space (200 - 100, and 200 + 100). Subfolders are supported, so a filename of "myfolder/mybuilding.bld" will load the building file at "buildings/myfolder/mybuilding.bld".

Syntax: Load filename[, X, Y, Z, Rotation][, MinX, MinY, MinZ, MaxX, MaxY, MaxZ]
Example 1: Load Simple.bld
Example 2: Load Simple.bld, 200, 0, 200, 0
Example 3: Load Simple.bld, 200, 0, 200, 0, -100, 0, -100, 100, 0, 100
Example 4: Load myfolder/mybuilding.bld

 

14. The Vehicles Section

The Vehicles section allows you to create vehicles for your building. Vehicles are numbered, starting with 1.

The section headers and footers are similar to the ones in the Floor section.
To specify a single vehicle, you would type something like:
<Vehicle 1>
and end it with:
<EndVehicle>

For a range of vehicles, you would use something like:
<Vehicles 2 to 10>
and end with:
<EndVehicles>

Variables:

%vehicle% - number of the current vehicle

Parameters:

1. Name - sets the name of the vehicle.
Example: Name = Car

2. MaxEngineForce - sets the maximum engine force. Default is 3000

3. SteeringIncrement - sets the steering increment. Default is 0.04

4. SteeringClamp - sets the steering clamp, which is the maximum steering value. Default is 0.8.

5. WheelFriction - sets the wheel friction value. Default is 1e30

6. SuspensionStiffness - sets the suspension stiffness value. Default is 20

7. SuspensionDamping - sets the suspension damping value. Default is 2.3

8. SuspensionCompression - sets the suspension compression. Default is 4.4

9. RollInfluence - sets the roll influence value. Default is 0.1

10. SuspensionRestLength - sets the suspension rest length. Default is 0.6

11. MaxSuspensionTravelCm - sets the maximum suspension travel. Default is 500

12. FrictionSlip - sets the friction slip value. Default is 10.5

13. ChassisShift - sets the vehicle's chassis offset, in X, Y and Z values.
ChassisShift = 0, 1, 0

14. ChassisMesh - defines the mesh file to use for the chassis
ChassisMesh = ogrebullet/models/chassis.mesh

15. WheelMesh - defines the mesh file to use for the wheels
ChassisMesh = ogrebullet/models/wheel.mesh

16. ChassisScale - sets the scaling factor for the chassis mesh
ChassisScale = 4

17. WheelScale - sets the scaling factor for the wheel mesh
WheelScale = 4

Commands:

1. CreateVehicle - creates the vehicle at the specified location. Use this command after the CreateChassis and AddWheel commands.
Syntax: CreateVehicle X, Y, Z
Example: CreateVehicle -50, 0, 0

2. CreateChassis - creates the vehicle's chassis. The parameters are physics options that are used when creating the rigid body
Syntax: CreateChassis restitution, friction, mass, linear_dampening, angular_dampening
Example: CreateChassis 0.6, 0.6, 800, 0.2, 0.2

3. AddWheel - adds a wheel to this vehicle. If engine is true, the wheel is powered by the engine. If steerable is true, the wheel is controlled by the steering wheel. The ConnectionPoint values specify the point at which to connect the wheel to the chassis. The Direction and Axle values are optional, and the defaults for those are "0, 01, 0" for the Direction, and "-1, 0, 0" for the Axle.
Syntax: AddWheel engine, steerable, IsFrontWheel, radius, ConnectionPointX, ConnectionPointY, ConnectionPointZ[, DirectionX, DirectionY, DirectionZ, AxleX, AxleY, AxleZ]
Example: AddWheel true, true, true, 0.3, -1, 0, 0

 

15. Small Example Building

To see an example of a small simplistic building in code, look at the Simple.bld file in Skyscraper's buildings directory. It's also available online here.