prim doesn't detect position when rezzed from another prim
|
|
Azul Wilder
Registered User
Join date: 29 Jan 2007
Posts: 87
|
03-22-2007 10:28
Hi! I have a prim (prim_1) with an script that uses a sensor to detect another prim (prim_2) position. So when I rez this prim_1 from my inventory to the floor it detects prim_2 correctly. But when I put prim_1 inside another prim (prim_3) and this prim_3 uses a script with llRezObject to rez prim_1, when this prim_1 is rezzed from prim_3, it doesn't detect the position of prim_2. Why could this be? prim_2 is the root prim of an object. Thanks.
_____________________
First goes before AW Devices
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
03-22-2007 10:33
Could be any number of reasons related to how you are setting up the sensor.
Note that sensors only detect *objects*, not individual *prims*. Objects can also be single prims as well, though. It doesn't sound like you are getting bitten by this, but I thought I would point it out.
Otherwise, what does your llSensor call look like?
|
|
Azul Wilder
Registered User
Join date: 29 Jan 2007
Posts: 87
|
03-22-2007 10:43
The sensor is placed in state_entry and is this: llSensor("prim_2",NULL_KEY,ACTIVE | PASSIVE,30,PI);
remember that the same script works when rezzed from my inventory
_____________________
First goes before AW Devices
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
03-22-2007 11:34
May be completely of base here but, The object you are rezzing from inventory isnt necessarily in the same state as the object in the object that rez's it. Also you say that the sensor (single shot) is in state entry, however unless you are resetting the script on rez then it will have already been triggered when the object was first rezzed and will not be firing on subsequent rezz's
|
|
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
|
03-22-2007 11:37
From: Azul Wilder The sensor is placed in state_entry and is this: llSensor("prim_2",NULL_KEY,ACTIVE | PASSIVE,30,PI);
remember that the same script works when rezzed from my inventory Are you resetting the script in on_rez or something then? 'Cause it shouldn't be working when you rez it if the sensor's in state_entry.
|
|
Azul Wilder
Registered User
Join date: 29 Jan 2007
Posts: 87
|
03-22-2007 12:08
I've been rechecking the script, and I've seen that it doesn't detects the position in any case. The I have placed the llSensor inside a on_rez. on_rez(integer start_param) { llSensor("prim_2",NULL_KEY,ACTIVE | PASSIVE,30,PI); } Besides that I have a global variable vector position; and I have a sensor and a no_sensor sensor(integer total_number) { vector position; position = llDetectedPos(0); llOwnerSay("Position is " + (string)position); } no_sensor() { llOwnerSay("Position NOT found"); } The script now goes find up to this point. The variable position is correct, llOwnerSay told me. Later on the same script I try to use the global variable position inside an "IF" again but in this case the variable position is detected as <0.0000,0.0000,0.0000> Is it possible that the IF is not recognizing the correct value of the global variable position? Thanks.
_____________________
First goes before AW Devices
|
|
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
|
03-22-2007 12:16
sensor(integer total_number) { position = llDetectedPos(0); llOwnerSay("Position is " + (string)position); } no_sensor() { llOwnerSay("Position NOT found"); }
Should be more like that shouldn't it?
|
|
Azul Wilder
Registered User
Join date: 29 Jan 2007
Posts: 87
|
03-22-2007 12:22
yes but it is wrong in the example of the post. In the real script is correct. I have already changed it in the post too.
_____________________
First goes before AW Devices
|
|
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
|
03-22-2007 12:25
From: Azul Wilder yes but it is wrong in the example of the post. In the real script is correct. I have already changed it in the post too. You still don't want to be declaring the position variable again inside the sensor event though, do you?
|
|
Azul Wilder
Registered User
Join date: 29 Jan 2007
Posts: 87
|
03-22-2007 12:36
position is a global variable that has already been declared at the beginning of the script
Do I need to redeclare it again?
_____________________
First goes before AW Devices
|
|
AJ DaSilva
woz ere
Join date: 15 Jun 2005
Posts: 1,993
|
03-22-2007 13:31
No you don't, IIRC it'll create a new variable while the event's running and deny access to the global one. In your example you have though, which could be why you're finding it has a value of 0 when you access it elsewhere.
|