Teleporter Script SL

31 May

This is the teleporter script, clicking this causes you to be teleported to the destination co-ordinates. (vector dest)

key lastAVkey = NULL_KEY;
string fltText = “To Lower Chamber”;
vector dest = ; // X Y Z coordinates

init()
{
llSetSitText(“Teleport”);
llSetText(fltText, , 1);
llSitTarget(dest-llGetPos(), );
}

default
{
state_entry()
{
init();
}
touch_start(integer i)
{
init();
}
changed(integer change)
{
key currentAVkey = llAvatarOnSitTarget();
if (currentAVkey != NULL_KEY && lastAVkey == NULL_KEY)
{
lastAVkey = currentAVkey;
if (!(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION))
llRequestPermissions(currentAVkey,PERMISSION_TRIGGER_ANIMATION);
llSleep(0.5);
llUnSit(currentAVkey);
llStopAnimation(“sit”);
llResetScript();
}
}
}

The teleporter sits on a hub that spawns the teleporter when placed, this script is added as well as the item “teleporter” with the script above inside that object.

This is the hub script;

integer made = 0;

default
{
state_entry()
{
llSetText(“”, , 0.8);
llSetTimerEvent(4.0);
}

timer()
{

llSensor(“teleporter”, NULL_KEY,PASSIVE, 5, PI);

}

sensor(integer total_number)
{
// llSay (0, “Teleport already available”);
}

no_sensor()
{
state create;
}

}

state create
{
state_entry()
{

llRezObject(“teleporter”, llGetPos() + , ZERO_VECTOR, ZERO_ROTATION, 42);

state default;

}
}

Leave a comment

Design a site like this with WordPress.com
Get started