CODE

//Warp Cross-Sim Teleportation

//Warp from warpPos script by Keknehv Psaltery

//Full Script by Khalek Trescothick

//This Script is classified as open-source

//Do not remove this header

vector pos;

vector my_pos;

vector g_target;

vector save;

string sim;

string dest_sim;

integer c = 92805;

integer NeedToCrossSim = FALSE;

integer near_check = FALSE;

integer target = FALSE;

warpPos( vector d )

{

if ( d.z > 768 )

d.z = 768;

integer s = (integer)(llVecMag(d-llGetPos())/10)+1;

if ( s > 100 )

s = 100;

integer e = (integer)( llLog( s ) / llLog( 2 ) );

list rules = [ PRIM_POSITION, d ];

integer i;

for ( i = 0 ; i < e ; ++i )

rules += rules;

integer r = s - (integer)llPow( 2, e );

if ( r > 0 )

rules += llList2List( rules, 0, r * 2 + 1 );

llSetPrimitiveParams( rules );

}

default

{

on_rez(integer rez)

{

llResetScript();

}

state_entry()

{

llListen(92805, "", "", "");

llSitTarget(<0,0,0>,ZERO_ROTATION);

}

dataserver(key TID, string data)

{

g_target += (vector)data;

vector G2 = g_target;

G2.z = 200;

save = llVecNorm(G2 - llGetRegionCorner());

if(llRound(save.y*2)>0)

save = <127,255,200>;

else if(llRound(save.y*2)<0)

save = <128,0,200>;

else if(llRound(save.x*2)>0)

save = <255,128,200>;

else if(llRound(save.x*2)<0)

save = <0,128,200>;

if(llEdgeOfWorld(llGetPos(), llVecNorm(save - llGetPos())))

{

save = llVecNorm(g_target - llGetRegionCorner());

if(llRound(save.x*2)>0)

save = <255,128,200>;

else if(llRound(save.x*2)<0)

save = <0,128,200>;

else if(llRound(save.y*2)>0)

save = <128,255,200>;

else if(llRound(save.y*2)<0)

save = <128,1,200>;

if(llEdgeOfWorld(llGetPos(), llVecNorm(save - llGetPos())))

{

llWhisper(0,"Pinpoint Error");

llUnSit(llAvatarOnSitTarget());

llSleep(1.0);

llDie();

}

}

NeedToCrossSim=TRUE;

warpPos(save);

llMessageLinked(-1,0,"done","");

}

link_message(integer prim,integer chan,string m, key id)

{

if(m == "done")

{

if(NeedToCrossSim)

{

vector P = llGetPos();

if(P.x==0)

P.x = -3;

else if(P.x==255)

P.x = 258;

if(P.y==0)

P.y = -3;

else if(P.y==255)

P.y = 258;

llSleep(3.5);//Needed delay so you do not crash over sim borders!

llSetPos(P);

NeedToCrossSim = FALSE;

llSleep(4);

}

sim = llGetRegionName();

if(sim != dest_sim)

{

g_target.z = 200;

save = llVecNorm(g_target - llGetRegionCorner());

if(llRound(save.y*2)>0)

save = <128,255,200>;

else if(llRound(save.y*2)<0)

save = <128,0,200>;

else if(llRound(save.x*2)>0)

save = <255,128,200>;

else if(llRound(save.x*2)<0)

save = <0,128,200>;

if(llEdgeOfWorld(llGetPos(), llVecNorm(save - llGetPos())))

{

save = llVecNorm(g_target - llGetRegionCorner());

if(llRound(save.x*2)>0)

save = <255,128,200>;

else if(llRound(save.x*2)<0)

save = <0,128,200>;

else if(llRound(save.y*2)>0)

save = <128,255,200>;

else if(llRound(save.y*2)<0)

save = <128,0,200>;

}

NeedToCrossSim = TRUE;

warpPos(save);

llMessageLinked(-1,0,"done","");

}

else if(sim == dest_sim)

{

NeedToCrossSim = FALSE;

warpPos(my_pos);

llSay(0,"Arrived");

llUnSit(llAvatarOnSitTarget());

llDie();

}

}

else

{

pos = g_target - llGetRegionCorner();

}

}

changed(integer change)

{

if(change & CHANGED_REGION)

{

llMessageLinked(LINK_SET, 0, "done", "");

}

}

listen(integer channel,string name,key id,string message)

{

if(message == message)

{

list d = llParseString2List(message,["*"],[]);

list p = llCSV2List(llList2String(d,0));

float x = llList2Float(p,0);

float y = llList2Float(p,1);

float z = llList2Float(p,2);

pos = <x,y,z>;

my_pos = <x,y,z>;

llMessageLinked(LINK_SET, 0, "bu", NULL_KEY);

dest_sim = llList2String(d,1);

if(llGetSubString(dest_sim,0,0) == " ")

{

dest_sim = llGetSubString(dest_sim,1,-1);

}

if(llGetRegionName() == dest_sim)

{

warpPos(my_pos);

}

else

{

llRequestSimulatorData(dest_sim, DATA_SIM_POS);

}

}

}

}

Have Fun!