VRF Actions

The <action> tag. Action tags are used to make a VRF more dynamic and interactive. VRGRid as dozens of actions you can choose from, we will detail each one of them later but now lets take a look at some sample code and go into the details in how to create a action in this example we will use the <replace> action:

<create unit="11" vrobj="basic:full">
<side name="*" texture="images/sad.gif" />
<action trigger="roll on" >
<replace source="22" />
</action>
</create>
<create unit="22" vrobj="basic:full">
<side name="*" texture="images/happy.gif" />
</create>

Here we have created a full 3d object, which has the image “sad.gif” on all its parts, and assigned it the unit “11”. Whenever a user rolls her mouse over this 3d object, the 3d object will be replaced with the “22” 3d object, which is also a full 3d object but which has the image “happy.gif” on all its parts. Note that there is no other action on the “22” 3d object, so once this action has been triggered once, there is no more functionality. When the player rolls off the 3d object, it will still appear to be happy. But we can also add an <action> tag to vrobj “22” which will switch back to vrobj “11”:

<create unit="22" vrobj="basic:full">
<side name="*" texture="images/happy.gif" />
<action trigger="roll off" />
<replace source="11" />
</action>
</create>

Now there is another <replace> tag on 3d object “22”, with trigger=“roll off”. So when the user rolls over 3d object “11”, it will replace itself with 3d object “22”. Then when they roll off of 3d object“22”, it will replace itself with 3d object “11” again. So in effect, when a user rolls the mouse onto the 3d object, they will see happy.gif, and when they roll off, they will see sad.gif again.

Now lets look at the complete syntax for action tags:

<action location="(column,row,layer)" trigger="roll on|
roll off|click on|step in|step out|proximity|timer|location"
radius="number-of-units" delay="min..max" />
.. action to execute goes here ...
</action>

Radius is measured in units and is only used when the trigger is “step in”, “step out”, or “proximity”. When trigger=“proximity”, the action will remain active as long as the user is within the specified radius. Once they leave the radius, then the action will reverse itself. Delay is measured in seconds and is only used when the trigger is “timer”. If only one value is included for delay, then the delay will always be the same number of seconds. If a minimum and maximum delay are specified, then the delay will be a random length in between those 2 values. If the action is not attached to a 3d object through a <create> tag, then location specifies where the action is located in the map or layer. Target (in the <action> tag) is only used when trigger=“location”. If trigger=“location” then the action will be triggered when a 3d object is placed on the specified target.

Action and exit

<Action> tags can also hold <exit> tags. The <action> tag would look like this:

<action trigger="step in" radius="3" location="(5,5,1)">
<exit href="another.vrf#default" />
</action>

Actions in Imagemaps

Actions can also work inside of imagemaps. The code is the same as for a regular imagemap, except that the <area> tag becomes an <action> tag, like so:

<imagemap name="myimagemap">
<action shape="rect" coords="0,0,100,100"
trigger="click on">
.. action to execute goes here ...
</action>
</imagemap>

Triggers avaliable in current version
REPLACE
ROLL_ON
ROLL_OFF
ROLLOVER
CLICK_ON
STEP_ON
STEP_IN
STEP_OUT
PROXIMITY
TIMER
EVERYWHERE
LOCATION
KEY_DOWN
KEY_UP
KEY_HOLD
START_UP
Actions avaliable in current version
REPLACE
EXIT
SPIN
MOVE
RIPPLE
ORBIT
STOPSPIN
STOPMOVE
STOPRIPPLE
STOPORBIT
TALK
HTMLPAGE
HTTPPOST
HTTPGET
ANIMATE
SETFRAME