Jump to content
  • 0

LSL How to detect the event of rez but not attached to avatar?


robotommy
 Share

You are about to reply to a thread that has been inactive for 2583 days.

Please take a moment to consider if this thread is worth bumping.

Question

  • 0

Hi robotommy,

It's been ages since I've scripted, but that won't stop me from making something up.

"on_rez" fires whether the item is rezzed on the ground or as an attachment. After "on_rez" fires, "attach" will fire if the thing is attached. The delay from on_rez() to attach() should be fairly short, so start a timer with on_rez() and if it times out before attach(), you've got the condition you're looking for. If attach() happens before the timeout, it can cancel the timer.

http://wiki.secondlife.com/wiki/On_rez

http://wiki.secondlife.com/wiki/Attach

Maybe something like...

on_rez(){
    llSetTimerEvent(0.5); // figure out the shortest delay that won't expire before attach() happens, if it happens.
}

attach(){
    llSetTimerEvent(0);
}

timer(){
    llSay(0,"I'm rezzed!");
}

Good luck!

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi robotommy,

It's been ages since I've scripted, but that won't stop me from making something up.

"on_rez" fires whether the item is rezzed on the ground or as an attachment. After "on_rez" fires, "attach" will fire if the thing is attached. The delay from on_rez() to attach() should be fairly short, so start a timer with on_rez() and if it times out before attach(), you've got the condition you're looking for. If attach() happens before the timeout, it can cancel the timer.

http://wiki.secondlife.com/wiki/On_rez

http://wiki.secondlife.com/wiki/Attach

Maybe something like...

on_rez(){
    llSetTimerEvent(0.5); // figure out the shortest delay that won't expire before attach() happens, if it happens.
}

attach(){
    llSetTimerEvent(0);
}

timer(){
    llSay(0,"I'm rezzed!");
}

Good luck!

Link to comment
Share on other sites

  • 0

Quite simply, write your on_rez event with a test to see if the object is attached.  Then send a status message to let you know the result.

 

on_rez(integer start_param){    llSleep(0.5); // Just in case it doesn't attach instantly    integer IsAttached = (llGetAttached() > 0);  // TRUE if attached, FALSE otherwise    llOwnerSay( llList2String(["Object NOT attached"],["Object IS attached"],IsAttached) );}

 

  • Like 3
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2583 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...