Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

teleporting with a delay

Breezy Ishtari
Registered User
Join date: 10 Sep 2009
Posts: 5
02-02-2010 09:55
I want to have an avatar sit on my object, then a short speech will be read over chat, some white light will be emitted and then the avatar will be teleported. However when using the llsittarget function the avatar is instantly teleported even if I put llSleep before the llsittarget or if I have a state change and then llsittarget. Is their a different function I could use to accomplish this or a way to cause a delay before teleporting?
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
02-02-2010 11:23
You'll need to move the object the avatar is sitting on, using llSetPos for distances under 10m or something like WarpPos (from the wiki) for larger ones, and then perhaps llUnSit.
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
02-02-2010 11:38
I've tackled the same challenge by simply moving the guts of the teleport mechanism to a timer event, like so ...

CODE

changed (integer change)
{
if (change & CHANGED_LINK)
{
if (llAvatarOnSitTarget() != NULL_KEY)
{
// llSay a bunch of stuff, play a sound, shoot off sparklers .......
llSetTimerEvent(5);
}
}
}

timer()
{
//Do the stuff that transports an av.
llSetTimerEvent(0);
}



ETA: BTW, don't use llSleep for something like this. It puts your entire script to sleep so it's unaware of any other activity. All events (listens, touch, sensors, etc.) are dead. A timer lets you do other things while the timer waits to activate.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
02-03-2010 09:31
To be honest this is one of the few times i would use llSlepp.

You want to tp, probaly dont want to be intruppeted

Edit you so need to spell better than I can
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
02-03-2010 10:14
From: Beverly Ultsch
To be honest this is one of the few times i would use llSlepp.

You want to tp, probaly dont want to be intruppeted

Edit you so need to spell better than I can

That's probably true, but I can certainly imagine writing scripts in which you might want a dataserver event or a sensor, for example, to still be triggerable while a delayed TP is in progress. The OP is talking about sitting (standing?) immobilized for several seconds between the time s/he gives the "Teleport" command and the time s/he poofs. During those few seconds, while music is playing, a pre-recorded message is appearing in chat, and particle fireworks are blasting off ...... it might be nice to know if someone is sneaking up. ;)
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
02-03-2010 10:45
not disputting this at al.

I think it all depends on the circumstanes

My TP does a lot

It forst does a sit, then replicates itself, then throws out a prin for some nice particle effect, then does a warp pos, then throws out onotehr prim for particles, then dies,

Belive me i dont want another event to interuppt this.

circumstances riule wht you need

Edit, just looked at my spelling, to much wine, and this will be archived for posterity :)
Pete Olihenge
Registered User
Join date: 9 Nov 2009
Posts: 315
02-03-2010 10:52
As I understand it, a new event won't interrupt an event handler already executing: it is queued until the script has finished.
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
02-03-2010 10:58
From: Pete Olihenge
As I understand it, a new event won't interrupt an event handler already executing: it is queued until the script has finished.


I agree, so if you use a sleep in your tp nothing can stop it, if you use a timer it can be intruppeted
Breezy Ishtari
Registered User
Join date: 10 Sep 2009
Posts: 5
02-03-2010 11:00
Rolig,

thanks for the help, I had a similar plan when I started out but it did not work for me. I'm new to lsl so I've posted a simplified version of my code, could you take a look and see if you notice something i'm doing wrong?

CODE


default
{
state_entry()
{
//where i first want to sit during speech, fireworks, etc.
llSitTarget(<44.257,200.933,36>, ZERO_ROTATION);
}

changed (integer change)
{
if (change & CHANGED_LINK)
{
if (llAvatarOnSitTarget() != NULL_KEY)
{
//display text fireworks etc.
llSetTimerEvent(5);
}
}
}

timer()
{
//Do the stuff that transports an av.

vector target=<115,212,22>; //final destination
vector offset;
offset = (target- llGetPos()) * (ZERO_ROTATION / llGetRot());
llSitTarget(offset, ZERO_ROTATION); //send avatar to final destination
llSetTimerEvent(0);
llSleep(0.5); // llUnSit works better with this delay
if (llAvatarOnSitTarget() != NULL_KEY) // somebody is sitting on me
llUnSit(llAvatarOnSitTarget()); // unsit him
}

}
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
02-03-2010 11:02
Put the llSetTimerEvent *before* you do the fireworks.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
02-03-2010 11:12
From: Breezy Ishtari
Rolig,

thanks for the help, I had a similar plan when I started out but it did not work for me. I'm new to lsl so I've posted a simplified version of my code, could you take a look and see if you notice something i'm doing wrong?

CODE





timer()
{
//Do the stuff that transports an av.

vector target=<115,212,22>; //final destination
vector offset;
offset = (target- llGetPos()) * (ZERO_ROTATION / llGetRot());
llSitTarget(offset, ZERO_ROTATION); //send avatar to final destination// this wont work
llSetTimerEvent(0);
llSleep(0.5); // llUnSit works better with this delay
if (llAvatarOnSitTarget() != NULL_KEY) // somebody is sitting on me
llUnSit(llAvatarOnSitTarget()); // unsit him
}

}


You cant change the sit target once its sat on, it can be frigged, im going to look on the wiki for it

if no one ese finds i t first
Breezy Ishtari
Registered User
Join date: 10 Sep 2009
Posts: 5
02-03-2010 11:16
yup that would make sense with the problems i'm getting. I'm going to look into workarounds let me know if you find anything thanks Beverly.
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
02-03-2010 11:21
You need to use warpos or something else, the sitpos is a function of the prim, no chance to intervene with it
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
02-03-2010 11:22
The easiest way to do the actual teleport is to move the object he's sitting on, unsit him, and move it back.

To move the object more than 10 meters, google for WarpPos.

vectore return = llGetpos();
WarpPos(target);
llUnSit(avatar);
llSleep(0.1);
WarpPos(return);
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
02-03-2010 11:25
From: Argent Stonecutter
The easiest way to do the actual teleport is to move the object he's sitting on, unsit him, and move it back.

To move the object more than 10 meters, google for WarpPos.

vectore return = llGetpos();
WarpPos(target);
llUnSit(avatar);
llSleep(0.1);
WarpPos(return);


I agree although i dont bother to move it back, just rez another one and let the first die

Once again depends on circumstances
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
02-03-2010 11:51
I found ths sit targer bit
http://wiki.secondlife.com/wiki/LlSitTarget
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
02-03-2010 11:51
Also, the sit target that you set in the state_entry event isn't going to work. The coordinates you have to use there are local to the prim that contains the script, not global.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
02-03-2010 11:53
Sit taret doesnt work ir this, look at warppos
Rolig Loon
Not as dumb as I look
Join date: 22 Mar 2007
Posts: 2,482
02-03-2010 12:20
From: Beverly Ultsch
Sit taret doesnt work ir this, look at warppos

Yup.... just sayin'.... IF you use llSitTarget for something, it has to be given in local coordinates, not sim coordinates.

You're absolutely right, though.... this is a job for Warppos. llMoveToTarget (or trying to mess with the sit target like this OP is) won't work for anything over 10m.
_____________________
It's hard to tell gender from names around here but if you care, Rolig = she. And I exist only in SL, so don't ask.... ;)

Look for my work in XStreetSL at
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
02-03-2010 13:45
I'm curious, has anyone tried warpPos directly on the avatar... at least within normal sitTarget ranges? I wouldn't think it'd work, but obviously avatars are a special case of linking rules...
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
02-03-2010 13:57
From: Void Singer
I'm curious, has anyone tried warpPos directly on the avatar... at least within normal sitTarget ranges? I wouldn't think it'd work, but obviously avatars are a special case of linking rules...

you mean with llSetLinkPrimitiveParams? might have to try that later when i have time to go in world. i think it might be affected by the link distance limit though
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
02-03-2010 14:05
I don't think you can move the avatar more than 40M from the center of the root prim with llSetLinkPrimitiveParams, period.
_____________________
Argent Stonecutter - http://globalcausalityviolation.blogspot.com/

"And now I'm going to show you something really cool."

Skyhook Station - http://xrl.us/skyhook23
Coonspiracy Store - http://xrl.us/coonstore
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
02-03-2010 22:14
so i tried it with an avatar, it worked, sort of
it seems that if the avatar is moved out of the distance limit, the prim(s) move towards the avatar to within that limit. but the direction didn't seem to be correct, i sat my avatar onto a cube with zero rotation, and one fed warppos a vector of <0.0,0.0,100.0> which should have moved the avatar 100 meters above the prim, but it moved in in x and y directions too, after the movement stopped, my avatar was up in the air with the cube 30m or so away on each of the axises, which had also moved about that far from its original position
_____________________
Dark Heart Emporium

http://www.xstreetsl.com/modules.php?name=Marketplace&MerchantID=133020

want more layers for tattoos, specifically for the head? vote here
http://jira.secondlife.com/browse/VWR-1449?

llDetectedCollision* Functions similar to touch
http://jira.secondlife.com/browse/SVC-3369
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
02-03-2010 23:10
now that's weird...
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Breezy Ishtari
Registered User
Join date: 10 Sep 2009
Posts: 5
02-04-2010 13:55
just wanted to say thanks everyone, I was able to create what i wanted by using llsleep then warppos and then rerezzing the object. it works great thanks again
1 2