Jump to content

How can a script tell the difference between a login rez and an attach rez


Pete Olihenge
 Share

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

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

Recommended Posts

I can't think of a reliable one offhand without checking against an external source that monitors when an av was online or not....

I'm not sure about update speed though, so it may be possibe to quickly check something like the owners display name or online status and catch it before it updates.

Link to comment
Share on other sites

One way is to take advantage of the fact that on_rez() always triggers first. Plus, depending on your script, you may execute a quick line of code when the object gets detached. So, set a variable to FALSE first line in the attach() event (you'll set it TRUE later in the event after you've tested that the obect is indeed attached). Inside on_rez(), check to see if that variable is TRUE. TRUE should indicate a login rez.

When the user attaches the object, on_rez() triggers and the variable test indicates FALSE followed by attach() which immediately sets the variable to FALSE anyway. Then, still inside attach(), do your llGetAttached() and != NULL_KEY tests and set the variable to TRUE if the object is indeed attached.

When the user detaches the object, the variable should get set to FALSE. Therefore, theoretically, the on_rez() event should only see the variable as TRUE when the object is already attached at login.

Link to comment
Share on other sites

One of the things people who make RLV stuff have to watch out for is that attachments rez, and are able to ask the wearer's viewer -- via llOwnerSay -- if RLV is turned on well before the viewer is able to reply, so you've got to allow 30 seconds or so to stand any chance of getting an answer.

Are there any circumstances in which the regular viewer can talk direct to attachments?  I don't know if there are or not, but if it can, you might be able to use that.    

The other thing, off the top of my head, that might be worth exploring is that, according to the wiki, llGetAgentSize returns 1.9 exactly as the z component if the avatar's not fully loaded, and it notes that it's going to be so rare for an avatar to be precisely that size normally that, if this is what it returns, the avatar is probably ruthed.   So maybe if you check llGetAgentSize(llGetOwner())  in the on_rez event?

Link to comment
Share on other sites

so what you're saying is that detach never actually fires when logging off, although the event may be queued and overwritten when attaching?

if so wouldn't that fail if swapping viewers caused it not to be attached when logging in and the next attach give a false positive for attaching (as if it were a login attach)?

Link to comment
Share on other sites

Many thanks for your responses.

Void, your external monitor is probably going to be the most reliable and future-proof method, but it's also going to be the most work! I may get around to doing it this way, one day.

DoteDote, yeah, I was speculating along those lines myself. But what I forgot to mention is that this needs to work across various instances of the object.

Innula, I've tested your suggestion a few dozen times now, and it's worked every time, so this is the way I'll go for now. Mind you, it has been pretty lag-free here so far.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4636 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...