Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetKey <-> on rez

Altern8 McMillan
Registered User
Join date: 27 Mar 2007
Posts: 36
07-19-2007 09:14
Hi there,
Iwas just stumbling across sthg I do not understand. I was reading the wiki on http://www.lslwiki.net/

In the llGetKey() article it says:
From: someone
Teleporting from one place to another causes attachments to be derezzed and rezzed at the new location. This implies that when teleporting, all attachment scripts will receive an on_rez event, and each attachment's prims will be given a new key.


In the on_rez event it says:
From: someone
on_rez is not triggered when an object is rezzed after a teleport. For that, use a changed() event instead.


:confused:

I have never worked with attached objects, so I guess I can figure it out by myself. Was just wondering what u experienced guys have figured out.

greetz

A8
Altern8 McMillan
Registered User
Join date: 27 Mar 2007
Posts: 36
07-19-2007 09:30
oh wow, one of these threads where I gonna answer my own questions.

just tried it, it seems the changed-event is triggered, but as well no new key is assigned. the object still has the old key. I tried it with the following code:

default {
state_entry() {
llOwnerSay(llGetKey());
}

on_rez(integer start_param) {
llOwnerSay("on_rez";);
llOwnerSay(llGetKey());
}

changed(integer change) {
llOwnerSay("changed";);
llOwnerSay(llGetKey());
}
}

So the big question is. Can I rely on the key the prim is givven on attachement? Or should I always better ask for the key after a teleport?

thx

A8
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
07-19-2007 10:06
Since attaching things like servers to transport them to new locations is considered standard practice to keep the key the same, I would say you can assume this is safe. It has something to do with those UUID's being tied to your AV as it tracks you on the grid, so as long as you don't leave the grid (logoff or crash) they should remain constant.

The only issue with teleporting comes if someone crashes on teleport, but if you utilize on_rez and changed in a similar fashion to your test, you can compensate for the resulting key change since the attachment would receive a new key everytime the on_rez fires.
Altern8 McMillan
Registered User
Join date: 27 Mar 2007
Posts: 36
07-19-2007 12:30
thx very much for the answer :)
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
07-19-2007 12:52
Anytime :)