Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llRezObject not working for me

Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
11-20-2005 21:52
I'm trying to pass a key that's being broadcast on a channel to an object, and for some reason my llRezObject doesn't like me passing a key, or anything for in the slot that's for the llGetStartParameter. I read the wiki and it says it's for an integer, but when I just put 0 in there I still get an error in my compilation. what's going wrong?

***script listens for a target's key on channel 982 from the radar device, and is then supposed to rez the a missile and pass that key's info onto the missile with the llGetStartParameter. I'm using the touch event for trouble shooting right now.

CODE

key tarkey = NULL_KEY;

default
{
state_entry()
{
llListen(982,"scan v1.5",NULL_KEY,""); //listening for the key to be broadcast
}

listen(integer channel, string name, key id, string message)
{
tarkey = message; //sets the target's key from the key broadcast
}
touch_start(integer total_number)
{
llRezObject("missile", llGetPos(), 3, llGetRot(), tarkey); //Supposed to rez a missile and pass the key to the missile but this part isn't working.
}
}
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
11-21-2005 01:17
The correct form of llRezObject is llRezObject(string inventory, vector pos, vector vel, rotation rot, integer param). You can not pass a key to rezobject unless you some how encode it as an integer.
_____________________
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
11-21-2005 02:06
...and...since keys contain alphabetic letters...you're not gonna get a key transferring to an integer very well.
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Ben Bacon
Registered User
Join date: 14 Jul 2005
Posts: 809
11-21-2005 02:27
The most common solution to this problem is:
  1. Parent object chooses a chat channel number (randomly or next one from cyclic range)
  2. Parent listens on that channel
  3. Parent rezzes child, passing chat channel as start_param
  4. In child's on_rez, child starts listening on that channel
  5. still in child's on_rez, child then chats on that channel, to query parent.
  6. Parent, on hearing child's query, knows that child is rezzed and listening.
  7. Parent kills its listen - and says target key (still on the same channel).
  8. Child hears key, kills listen, and goes off to cause greivious bodily harm :D

If you want code, just shout - but judging some of your other posts, I don't think you'll have too much of a problem.
Laukosargas Svarog
Angel ?
Join date: 18 Aug 2004
Posts: 1,304
11-21-2005 04:10
From: someone
Parent, on hearing child's query, knows that child is rezzed and listening.


Alternatively the parent could use it's object_rez event to know that the child is rezzed, no need for chat. There is a caveat though , the event is only sent to the same prim that rezzed the child.

http://secondlife.com/badgeo/wakka.php?wakka=object_rez

According to the WIKI you cannot rez objects that are not in the inventory of the object containing the rezzing script.

It will also fail if you try to rez an object more than 10m from the parent position.


looking at your script ...

llRezObject("missile", llGetPos(), 3, llGetRot(), tarkey);

You are rezzing the object at the same position as the parent, this could be a cause of the failure too. Try llGetPos() + <offset>
Senuka Harbinger
A-Life, one bit at a time
Join date: 24 Oct 2005
Posts: 491
11-21-2005 08:19
From: Ben Bacon
The most common solution to this problem is:
  1. Parent object chooses a chat channel number (randomly or next one from cyclic range)
  2. Parent listens on that channel
  3. Parent rezzes child, passing chat channel as start_param
  4. In child's on_rez, child starts listening on that channel
  5. still in child's on_rez, child then chats on that channel, to query parent.
  6. Parent, on hearing child's query, knows that child is rezzed and listening.
  7. Parent kills its listen - and says target key (still on the same channel).
  8. Child hears key, kills listen, and goes off to cause greivious bodily harm :D

If you want code, just shout - but judging some of your other posts, I don't think you'll have too much of a problem.


thanks a heap :). I hadn't thought of generating a random chat channel before, but now it seems like a really good idea, especially since there will probably be a few dozen of these kinds of events going on in my sim.

I might just move all the weapon commands and such to the HUD so I can use Link messages instead of chat channels (would probably make my current damage system less bulky), and just keep the visible weapons for eyecandy. but right now the method you outlined is working good in an alpha build :)