- Forums
- :
- Creation Forum
- :
- LSL Scripting
- :
- Re: Handling Sensor Event while waiting on object ...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Handling Sensor Event while waiting on object to rezz
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-01-2012 07:15 AM
I am struggling on a script I am working on.
The script moves a prim to a location, rezzes an object there, then does a sensor to get the object information.
Then moves to the next location and repeats the process.
My problem is, often the sensor returns a no_sensor event due to the delay in rezzing the object.
however, the script has continued to the next position.
I have tried putting a llsleep between the rezz and sensor, but I really hate to do it this way. The time it takes for the object to rezz varies, so it is difficult to set a dalay that always works yet does not slow the process down to much.
code sniplet:
fillslots()
{
integer x=0;
do()
{
rezzslot(x);
}
while(x<10)
}
rezzslot( integer i)
{
tstr = llGetInventoryName(INVENTORY_OBJECT, 0);
vector myPos = llGetPos();
rotation myRot = llGetRot();
vector rezPos = myPos+llList2Vector(rezzvectors,i)*myRot;
vector rezVel = relativeVel*myRot;
rotation rezRot = llEuler2Rot(<0,0,90> * DEG_TO_RAD)*myRot;
MoveToPos(i)
llRezAtRoot(tstr,rezPos,rezVel,rezRot,startParam);
llSleep(1);
llSensor(tstr,"",.5,PI);
llSleep(3);
}
Re: Handling Sensor Event while waiting on object to rezz
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Robster Rau - view message
03-01-2012 07:29 AM - edited 03-01-2012 07:32 AM
To be sure an object you rez is in-world, use the object_rez() event.
In your case, you will be able to remove the sensor and all the delays since you get the UUID of the object which gives you access to all the informations you want with llGetObjectDetails().
Re: Handling Sensor Event while waiting on object to rezz
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Kaluura Boa - view message
03-01-2012 07:48 AM
COOL!! Thanks!!
But when I rezz like 14 objects in a row, I need to be able to know which object rezzed in which position.
Do I somehow delay each one until the previous one rezzes?
Re: Handling Sensor Event while waiting on object to rezz
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Robster Rau - view message
03-01-2012 07:59 AM - edited 03-01-2012 08:14 AM
The object_rez event yields the UUID of the object that was just rezzed. All you have to do is write
object_rez(key id) { vector Pos = llList2Vector(llGetObjectDetails(id,[OBJECT_POS]),0); }
And save both the UUID and the Pos. That's what Kaluura was saying.
Re: Handling Sensor Event while waiting on object to rezz
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Rolig Loon - view message
03-01-2012 09:56 AM
OK, thanks.
I guess I can then compair the pos it rezzed to the possition I rezzed it at, to see which one the event was triggered by.
Re: Handling Sensor Event while waiting on object to rezz
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Robster Rau - view message
03-01-2012 12:07 PM
You can wait to rez next object until you have finished one:
integer x;
list positions;
rezzslot( integer i)
{
tstr = llGetInventoryName(INVENTORY_OBJECT, 0);
vector myPos = llGetPos();
rotation myRot = llGetRot();
vector rezPos = myPos+llList2Vector(rezzvectors,i)*myRot;
vector rezVel = relativeVel*myRot;
rotation rezRot = llEuler2Rot(<0,0,90> * DEG_TO_RAD)*myRot;
MoveToPos(i)
llRezAtRoot(tstr,rezPos,rezVel,rezRot,startParam);
}
default
{
state_entry()
{
x=0;
positions=[];
rezzslot( x);
}
obj_rez( key id)
{
positions += llGetObjectDetails(id,[OBJECT_POS]);
if ( ++x < 10 ) rezzslot( x);
}
}This snippet shows how you get an ordered list of positions
Of course when you know the id you can get any object detail the llGetObjectDetails can provide.
I don't know what you are after so you must finish it yourself
Re: Handling Sensor Event while waiting on object to rezz
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Reply to Dora Gustafson - view message
03-01-2012 12:27 PM
yes, that is kinda what I was thinking. Ether that, or convert the returned location back to the offset vector from the root prim, and look it back up in the list to see which one the event is for.
Thanks!

