Teleporter Tweaks

In my last post I looked at the basics of a simple sit-based teleporter. In this post I’ll be taking the script a little bit further, showing some of the tweaks that can be made to improve the performance of the teleportation experience.

Some of you who read the last post and took on recreating the basic script may have come across the following effect when using the teleporter. It is a little hard to describe in words so I have created a short video to show what can happen. Often the effect isn’t as dramatic as that shown and at times there is no effect at all; the user lands as expected on the landing point. More often than not though the effect will consist of just a little shuffling, but it can still be disconcerting to the user. In the video below the red box is the teleporter and the white disc is where the avatar would be expected to land. The teleporter uses the same sit target as the initial script, i.e. llSitTarget(<10.0, 0.0, 0.0>, ZERO_ROTATION).

Now I have no definitive technical reason for why this happens but I have hypothesised that due to time delays in the script execution, caused by sim lag or other effects, the moving of the avatar to the sit target is interrupted by unsitting them immediately, in the changed event, as shown in the script below.

changed(integer change)
{
if(change & CHANGED_LINK)
{
if(llAvatarOnSitTarget() != NULL_KEY)
{
llUnSit(llAvatarOnSitTarget());
}
}
}

The result appears to be some confusion as to the positioning of the unseated avatar, demonstrated by the teleportation shuffling. To test the case for this I added in a time delay prior to unsitting the avatar, using the llSleep function. Now I’m sure that there is a way to calculate the exact time required but I settled for a delay of 0.1 seconds. This seems to be short enough to still make the teleportation look natural, i.e. the sit animation that a basic sit defaults to doesn’t factor in, but long enough that multiple tests of the teleportation ended in a smooth landing. So the changed event now looks like this.

changed(integer change)
{
if(change & CHANGED_LINK)
{
if(llAvatarOnSitTarget() != NULL_KEY)
{
llSleep(0.1);
llUnSit(llAvatarOnSitTarget());
}
}
}

Other things can also be factored into the script to improve the overall interaction with the teleporter. One such item would be the use of floating text as an instruction for using the teleporter. This can be achieved by adding the llSetText function to the state_entry event. Another would be to factor in the action used to sit on the teleporter prim. This needs to be decided before writing the instruction as the two available choices for sitting use different methods; one being a left click and the other a right click.

In the earlier days of Second Life the only method was to right click on the prim and choose the Sit Here option (the default text for the sitting action) from the pie menu. The text could be changed using the llSitText function and was generally rewritten as Teleport. As shown below the lastest Second Life viewer no longer uses a pie menu but third party viewers (TPVs) still do. For the example prim the sit text has been changed to Teleport.

A number of years ago though, click actions were enabled in the build window that allow the builder to set the action that occurs when a user left clicks on a prim (or object if the setting is in the root prim). By default the action for clicking is Touch, but Sit on object as well as other options (see the menus below) are also available. Note: The click action can also be scripted in rather than selected in the build window.

When the Sit on object option is selected holding the mouse pointer over the prim displays a chair icon as displayed below.

I now set any sits or teleports I build as left click Sit on object actioned but you will still find sits, etc., that require a right click to sit and some users still automatically go to use the right click option. Because of this it is good practice to always write in the sit text as Teleport (or some other descriptive wording).

Gathering up all these factors into the state_entry event would now give the following:

state_entry()
{
llSetSitText(“Teleport“); // Sets the menu text
llSetText(“Click to Teleport“, <1.0, 1.0, 0.8>, 1.0); // Sets the floating text
llSetClickAction(CLICK_ACTION_SIT); // Sets the click action
llSitTarget(<10.0, 0.0, 0.0>, ZERO_ROTATION); // Sets the sit target
}

Along with the tweak to the unsitting of the avatar the teleporter is starting to look a little more built for purpose. For the next post in this series I’ll look at an easy way to set the destination offset, rather than working it out manually.

Next in this Series: Setting Teleporter Destinations

Advertisements

One thought on “Teleporter Tweaks

  1. Pingback: The Ubiquitous Teleporter « F/Xual Education Services

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s