User:Toy Wylie/RLV Documentation/tpto
Jump to navigation
Jump to search
@tpto
Type
General
Implemented
Implemented since RLV version 1.12
Usage
@tpto:<location>=force
Purpose
Teleports the user to the destination immediately, without questions. @tploc=n and @unsit=n will block this attempt. The location format is:
- X/Y/Z
See Also
Example 1
<lsl>// simple example with a fixed, pre-calculated destination
default {
state_entry()
{
llOwnerSay("Touch this box to teleport to Toy's Toys.");
}
touch_start(integer num)
{
if(llDetectedKey(0)==llGetOwner())
{
llOwnerSay("@tpto:179068/254564/24=force");
}
}
}
</lsl>Example 2
<lsl>// a more complex example to teleport to any location on the grid
integer listener; integer channel;
key regionRequest;
string location; vector position;
removeListener() {
if(listener!=0)
{
llListenRemove(listener);
listener=0;
}
llSetTimerEvent(0.0);
}
init() {
listener=0;
regionRequest=NULL_KEY;
llOwnerSay("Touch this box to set your teleport location.");
}
default {
on_rez(integer num)
{
llResetScript();
}
state_entry()
{
init();
}
touch_start(integer num)
{
if(llDetectedKey(0)!=llGetOwner())
return;
if(location!="")
{
llOwnerSay("@tpto:"+location+"=force");
init();
return;
}
if(listener!=0)
{
llOwnerSay("We are still waiting for a location to be teleported to.");
return;
}
if(regionRequest!=NULL_KEY)
{
llOwnerSay("We are still waiting for the region data to arrive.");
return;
}
channel=(integer) (llFrand(100)+10);
listener=llListen(channel,"",llDetectedKey(0),"");
llSetTimerEvent(30.0);
llOwnerSay("Please say your teleport location on channel "+(string) channel+" within the next 30 seconds. For example: /"+(string) channel+" Mode/124/100/24");
}
listen(integer channel,string name,key sender,string message)
{
list params=llParseString2List(message,["/"],[]);
if(llGetListLength(params)!=4)
{
llOwnerSay("Please make sure to say your destination in the following format: Region/X/Y/Z where X, Y and Z are the coordinates in the region you want to teleport to.");
return;
}
removeListener();
position.x=llList2Float(params,1);
position.y=llList2Float(params,2);
position.z=llList2Float(params,3);
string region=llList2String(params,0);
regionRequest=llRequestSimulatorData(region,DATA_SIM_POS);
}
dataserver(key k,string data)
{
if(k==regionRequest)
{
regionRequest=NULL_KEY;
if(data==""