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.
ah. SetCameraZoom - set the zoom factor of a CameraTexture's camera

Syntax: SetCameraZoom parent_name, cameratexture_name, zoom
Example 1: SetCameraZoom Floor 0, MyCamera, 2
Example 2: SetCameraZoom MapGenerator, MapCamera, 1.5

The first example sets the camera zoom factor of MyCamera on Floor 0 to be 2X. The second example changes the simulator's map generator to 1.5X. Zoom values need to be greater than 0.