Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Rezzed object target only parent object

Mr Bellingshausen
Registered User
Join date: 25 Mar 2009
Posts: 14
06-27-2009 04:53
How can I send by scipt the key or uuid of the parent prim to an object that is rezzed from its inventory?

I want the key or uuid to be used by the rezzed object's sensor script.

The rezzed object is not going to be linked to the parent but will target the parent for its position by using a sensor. I want to reduce the chances of there being multiple objects with the same name within range of the sensor and the rezzed object targeting the wrong prim.

Thanks in advance for your help.

Mr B.
Rygel Ryba
Registered User
Join date: 12 Feb 2008
Posts: 254
06-27-2009 04:59
You can't send a key or id, but you can send a unique "number".

Rezzing object has the ability to send a parameter (integer) when it rezzes something.

On the object that got rezzed, there is the "on_rez(integer p)" and that "p" becomes the number that the object that rezzed it gave it as a parameter. So, in this way, the rezzing object can give the object it rezzes some random number that becomes a listen channel. And then your objects can talk to each other on that channel.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
06-27-2009 07:38
you can slightly improve the security by using a portion or a hash of the rezzors key as the start parameter.

alternatively, the object_rez event provides the rezzed objects key to the rezzor, which can be used by the rezzor to target the rezzed object with various communications like e-mail.

and you can use all of those together.
_____________________
|
| . "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...
| -
Mr Bellingshausen
Registered User
Join date: 25 Mar 2009
Posts: 14
06-27-2009 08:21
I am guessing here but from what I understand is if I want the rezzed object to only target or "follow" the rezzer I have a couple of options:

1. Through llSay and llListen I can have the rezzer tell the rezzed object where it is and the rezzed object move to the appropriate offset. (Doesn't sound like the most efficient way)

2. Using a target sensor have the rezzer pass part of its key to the rezzed object so the rezzed object only targets the object it was rezzed from. (Where can I find an example of how to do this?)

Maybe I am over thinking this and if I am feel free to let me know. What I am really trying to avoid is having two rezzers that may have the same name rez their objects and they not know which rezzer to target or follow.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
06-27-2009 09:01
From: Mr Bellingshausen
Maybe I am over thinking this and if I am feel free to let me know.

definitely...

CODE

integer gIntChn;

default{
on_rez( integer vInt ){
gIntChn = (integer)("0x" + llGetSubString( (string)llGetKey(), 0, 7 ))

touch_start( integer vInt ){
llRezAtRoot( "Luke", llGetPos + < 1.0, 0.0, 0.0 >, ZERO_VECTOR, ZERO_ROTATION, gIntChn );
}

object_rez( key vKeyTgt ){
llSay( vIntChn, (string)vKeyTgt + ", I am your father. Join me."
}
}


CODE

default{
on_rez( integer vIntRez ){
llListen( vIntRez, "Darth Vader", "", "" );
}

listen( integer vInt, string vStrName, key vKeyTgt, string vStrTxt ){
if (~llSubStringIndex( vStrTxt, (string)llGetKey() )){
llGetObjectDetails( vKeyTgt, [OBJECT_POS, OBJECT_ROT] );
//-- now we know the key, position, and rot of our rezzor
}
}
}
_____________________
|
| . "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...
| -
Mr Bellingshausen
Registered User
Join date: 25 Mar 2009
Posts: 14
06-27-2009 12:20
Thank you for your help.
Ruthven Willenov
Darkness in your light
Join date: 16 Jan 2008
Posts: 965
06-27-2009 20:48
and you automatically get the key of the speak from the listen event, so if you wanted to use a sensor to make the new object follow the parent you would call the sensor(repeat) from the listen event

listen(integer chan, string name, key id, string message)
{
llSensorRepeat("",id,PASSIVE|ACTIVE,20,PI,1.0);
}

//insert usual follower sensor here
_____________________
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
06-27-2009 22:05
might want to close the listen after you've got the key to target, unless you have some further need for it.
_____________________
|
| . "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...
| -