Reply
Honored Resident
Robster Rau
Posts: 7
0 Kudos

Handling Sensor Event while waiting on object to rezz

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);
}


 

Kaluura Boa
Posts: 177
Registered: ‎03-09-2009

Re: Handling Sensor Event while waiting on object to rezz

[ Edited ]

Reply to Robster Rau - view message

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().

Honored Resident
Robster Rau
Posts: 7
0 Kudos

Re: Handling Sensor Event while waiting on object to rezz

Reply to Kaluura Boa - view message

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?

 

Rolig Loon
Posts: 17,439
Registered: ‎10-05-2009

Re: Handling Sensor Event while waiting on object to rezz

[ Edited ]

Reply to Robster Rau - view message

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.

 

Not as dumb as I look
Honored Resident
Robster Rau
Posts: 7
0 Kudos

Re: Handling Sensor Event while waiting on object to rezz

Reply to Rolig Loon - view message

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.

 

Dora Gustafson
Posts: 1,421
Registered: ‎10-05-2009
0 Kudos

Re: Handling Sensor Event while waiting on object to rezz

Reply to Robster Rau - view message

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

Honored Resident
Robster Rau
Posts: 7
0 Kudos

Re: Handling Sensor Event while waiting on object to rezz

Reply to Dora Gustafson - view message

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!