Adding Actions to Objects


The Action field of an object allows the objects you build to behave in interesting ways. For example, you can have an object play a sound when approached or bring up a web page when clicked on. Multiple actions can be combined together on a single object to create complex behaviors.

The general syntax of an action is as follows:

    trigger command [, command, ...] [; trigger command...]

As you can see, all actions are combinations of triggers and commands. The trigger specifies what must occur in order for the commands to be carried out. For example:

    create solid off

This action makes an object "unsolid" so that users can pass through it without colliding with it. "create" is the trigger and "solid off" is the command. Another example:

    activate url www.Outerworlds.com

This action displays the Outerworlds home page when the user clicks on the object. "activate" is the trigger and "url www.Outerworlds.com" is the command.

The following triggers are available:

  • create - occurs when the object first comes in to view
  • bump - occurs when the user physically collide with the object
  • activate - occurs when the user clicks on the object with the left mouse button
  • adone - occurs when an animation running on the object completes

Each trigger can be combined with one or more of the following commands:

  • animate - runs an animation on the object
  • astart - starts a stopped animation
  • astop - stops a running animation
  • color - assigns a new color to the object
  • corona - places a corona over the object (new in 3.3)
  • examine - allows users to rotate the object with the mouse
  • frame - changes the current animation frame
  • light - places a light source on the object
  • move - causes the object to move smoothly from one position to another
  • name - attaches a name to the object
  • noise - plays a sound effect (.wav or .mp3 file)
  • picture - displays a picture (JPEG) on the object
  • rotate - causes the object to spin around one or more axes
  • sign - places visible text on the object
  • solid - makes the object either solid or unsolid (i.e. un-bumpable)
  • sound - attaches a sound to the object (a .wav, .mp3, or .mid file)
  • texture - places a new texture on the object
  • teleport - sends the user to a new location instantly
  • url - displays a web page in the web browser
  • visible - makes the object either visible or invisible
  • warp - moves the user to a new location gradually

Multiple actions on a single object

You can attach more than one command to a single trigger by separating the commands with commas. For example:

    create visible off, sound background.wav

This creates an object which is both invisible and also the source of a continuously playing sound file.

Multiple trigger/action pairs can be combined on a single object by separating them with semi-colons. For example:

    create visible off; bump url Outerworlds.com

This creates an object that is invisible, but which will display the Outerworlds home page when bumped by a user (objects can still be bumped while invisible.)