Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Getting the key of the object that called llRezObject ?

Frunnik Herbst
Second Life Resident
Join date: 28 Oct 2004
Posts: 3
11-18-2004 13:16
Hi all,

Im new to LSL, having very very very much fun.

In my humble coding efforts, im struggling with this:

Im calling llRezObject in an object to create another object. I get the key of the created object via the object_rez event. But how do i get the key of the creating object from within the created object ?

I will eleborate on what i want to do:

I am trying to create a sliding puzzle.

For that i want certain objects (blocks) to listen exclusively to their holder (parent) (preferably by key).
I create the blocks to be moved from the holder via llRezObject.
Im communicating postions to and from the blocks and holder via a fixed numbered channel.
Im using the start_param of llrezObject to communicate to the child block what type it is (so that param is used).

Is there a simple way to get the key of the holder from inside a block ?

Like i said, i know there is a callback object_rez that gives me the key of the object that i created via llRezObject,
but i want to have the key of the creator object inside the created object.

I have found and heard several (not quite satisfying because cumbersomb and possible error prone) solutions:

- communicate the key via a secret channel
- do a sensor for the owner by name

Both methods can fail under certain circumstances.

Any tips, suggestions welcome...

- frunnik

EDIT: Typo meant to say object_rez where i said on_rez
McWheelie Baldwin
Registered User
Join date: 9 Apr 2004
Posts: 154
11-18-2004 13:44
Unfortunately the solutions you mentioned are pretty much it. You could maybe try to do something with collision_start() and rez the pieces slightly interpenetrating the holder. Such that a collision is raised. Of course without testing I am not sure if two non-physical objects touching/interpenetrating each other will raise a collision event. Could be worth a try though. Other than that, the communicating the key over a private channel is probably more reliable than using a sensor. *shrug*

McW

EDIT: typo
Water Rogers
Registered User
Join date: 1 May 2003
Posts: 286
11-18-2004 17:46
From: someone
Is there a simple way to get the key of the holder from inside a block ?

I'm kinda confused - are you wanting the key of the object inside the creator's contents, or you mean you're rezzing an object and it interpolates another (the creator) object? Also - are you using any dynamic linking?

At anyrate.... If you aren't linking the objects, you could have your creator objects listen on a special channel. you can get the keys of the objects from the "key id" argument of the listen event... dunno why that would fail for you.

Maybe i'm failing to fully understand you though.

--Water
_____________________
From: Philip Linden

For the more technically minded - the problem is actually NOT the asset server (or 'asshat' as you prefer to affectionately call it herein).
Azelda Garcia
Azelda Garcia
Join date: 3 Nov 2003
Posts: 819
11-18-2004 21:46
What I do is not use the object_rez event at all, but to get the object to whisper back to me its param, then send it all the info it needs in the reply whisper. Yes, you need a couple of whispers, but its not nearly as cumbersome as it sounds, and once its in place its really as flexible as you like.

Azelda
blaze Spinnaker
1/2 Serious
Join date: 12 Aug 2004
Posts: 5,898
11-18-2004 22:33
Yes, whispers is how I do it as well (actually, I use shouts..)

You can also use the param for lots off btw, by using the >> operator you can pass it a total of 32 bits of information.. (32 boolean parameters!)
_____________________
Taken from The last paragraph on pg. 16 of Cory Ondrejka's paper "Changing Realities: User Creation, Communication, and Innovation in Digital Worlds :

"User-created content takes the idea of leveraging player opinions a step further by allowing them to effectively prototype new ideas and features. Developers can then measure which new concepts most improve the products and incorporate them into the game in future patches."
Carnildo Greenacre
Flight Engineer
Join date: 15 Nov 2003
Posts: 1,044
11-18-2004 23:38
I've never had any trouble with using whispers.
_____________________
perl -le '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_++;'
Frunnik Herbst
Second Life Resident
Join date: 28 Oct 2004
Posts: 3
Thanks for suggestions
11-19-2004 12:42
Thank you all for your responses.

The individual pieces are not linked, because they need to be moveable.

The problem i have with chatting over a private channel, is what happens when
2 puzzles are next to each other... Their whispers may interfere...

Ive seen discussions about this in in back threads and there are good solutions suggested i think. One of the best ive seen would be to make a new on_rez event that gets the key of the rezzing object and a string as parameter.
Guess thats not going to happen soon. So until then ill have to use the private channels.

The tip about shifting info in the start_param is something that may help - i hadnt thought of that! - Thanx

Ill be working on this on Morris so if any of you wants to drop by you're more then welcome.

- frunnik
Issarlk Chatnoir
Cross L. apologist.
Join date: 3 Oct 2004
Posts: 424
11-19-2004 13:51
From: Frunnik Herbst
...
The problem i have with chatting over a private channel, is what happens when
2 puzzles are next to each other... Their whispers may interfere...

To avoid interferences, you can make use of the key information you get. Have the creator script maintain a list of rezzed objects keys ; when he receive a message, if the sender is not in his list then it's not intended for him and probably just your neightbor's puzzle chatting.

And to have the rezzed object only receive messages intented for it, you can have the creator script include the rezzed object's key in all the messages it sends to it.
I use this format:
id_of_intended_object,command,command_arguments1,...
then I use llCSV2List in the rezzed object ; that's convenient.
_____________________
Vincit omnia Chaos
From: Flugelhorn McHenry
Anyway, ignore me, just listen to the cow
Frunnik Herbst
Second Life Resident
Join date: 28 Oct 2004
Posts: 3
11-19-2004 17:56
Issarlk,

>To avoid interferences, you can make use of the key information you get. Have the creator
>script maintain a list of rezzed objects keys ; when he receive a message, if the sender is
>not in his list then it's not intended for him and probably just your neightbor's puzzle
>chatting.

This is what im doing, i just wanted the receiving end to listen exclusively to their creator, because i think anyone can see the key of an object and then could (potentially) send a (false) message to the object ... You would need to know the channel to to this though but ...

Anyway,

thanks for your suggestions,

i now have a basic version working ...

cheers

- frunnik
Tcoz Bach
Tyrell Victim
Join date: 10 Dec 2002
Posts: 973
11-21-2004 09:57
- Rez'r object gens a random number...use the time to compute it. Send it in param. Set up a listener that listens for "sendkey" + "_" + random num. Or use/parse lists (which is actually how I do it).
- Rez'd object says, "sendkey" + "_" + random num. It also (after rez) has a listener set up so that you can hear tells and attempt to find your random number in the response.
- Rez'r responds with "mykey" + "_" + random num. Parse the msg. If you find your number, it is from the rez'r. Whack off the "_" + random num, and you have your key.
- Remove all listeners related to this (you should always clean up).

This is how I did it in the Vorago, where I have objects all over the place rezzing other objects. I can put a dozen weapons or mob rezzrs right next to one another and there is never any confusion. It works like a charm.
_____________________
** ...you want to do WHAT with that cube? **