|
Alvaro Zapatero
O.o
Join date: 7 Jun 2008
Posts: 650
|
01-19-2009 09:30
Total Noob... please bear with me. I need help unsitting my avatar after I've warped to my destination. Warp ( vector DESTINATION ) { integer JUMPS = ( integer ) ( llVecDist ( DESTINATION, llGetPos ( ) ) / 10.0 + 1 ); list RULES = [ PRIM_POSITION, DESTINATION ]; integer COUNT = 1; while ( ( COUNT = COUNT << 1 ) < JUMPS ) RULES = ( RULES = [ ] ) + RULES + RULES; llSetPrimitiveParams ( ( RULES = [ ] ) + RULES + llList2List ( RULES, ( COUNT - JUMPS ) << 1, COUNT ) ); if ( llVecDist( llGetPos ( ), DESTINATION ) > .001 ) while ( --JUMPS ) llSetPos ( DESTINATION ); llSetPos ( DESTINATION ); } default { touch_start ( integer NUMBER ) { Warp ( <126,126,4002>); } }
_____________________
O.o C
|
|
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
|
01-19-2009 09:44
May want to glance at this thread: /54/24/138989/1.html for some clues on how to use warppos in a teleporter. The big thing is that the warping needs to happen in a changed(), not a touch_start() handler, because the avatar needs to be seated on the teleporter first, lest the teleporter warp off to the destination when the av touches it, leaving the av standing there. You also have to decide whether you want to rez a replacement teleporter for the next trip, or get the one back when it reaches its destination. (The one in the cited thread does the latter.)
|
|
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
|
01-19-2009 09:45
Put the llUnSit() call right after the Warp() call?
|
|
Alvaro Zapatero
O.o
Join date: 7 Jun 2008
Posts: 650
|
01-19-2009 17:18
From: Argent Stonecutter Put the llUnSit() call right after the Warp() call? Oh sure... that's easy for YOU to say.  Here's what worked for me in the end. Teleports me up to my skybox at 4000m... //The target location .. change this to where you want to end up (x, y, z) vector gTargetPos = <126, 126, 4001>; // Text for the "pie menu" string gSitText="Teleport";
// Key for avatar sitting on object, if any key gAvatarID=NULL_KEY;
warpPos ( vector destpos ) { integer JUMPS = ( integer ) ( llVecDist ( destpos, llGetPos ( ) ) / 10.0 + 1 ); list RULES = [ PRIM_POSITION, destpos ]; integer COUNT = 1; while ( ( COUNT = COUNT << 1 ) < JUMPS ) RULES = ( RULES = [ ] ) + RULES + RULES; llSetPrimitiveParams ( ( RULES = [ ] ) + RULES + llList2List ( RULES, ( COUNT - JUMPS ) << 1, COUNT ) ); if ( llVecDist( llGetPos ( ), destpos ) > .001 ) while ( --JUMPS ) llSetPos ( destpos ); llSetPos ( destpos ); }
default { state_entry() { // Put the teleport text in place of the Sit in the pie menu llSetSitText(gSitText); // Sit the avatar on the object llSitTarget(<0,0,1>,ZERO_ROTATION); }
changed(integer change){ if(change & CHANGED_LINK) { // Find id for avatar sitting on the object gAvatarID = llAvatarOnSitTarget(); // If someone sits on it... if(gAvatarID != NULL_KEY) { // Move avatar to destination warpPos(gTargetPos); // Pause for 1 second llSleep(1); llDie(); } } } }
Thanks for everyone's help!
_____________________
O.o C
|
|
Zaphod Zepp
Registered User
Join date: 13 Jan 2009
Posts: 38
|
01-19-2009 19:17
"RULES = ( RULES = [ ] ) + RULES + RULES;"
Huh? That can't possibly mean what it looks like it means...
|