Jump to content

Handling Sensor Event while waiting on object to rezz


Robster Rau
 Share

Recommended Posts

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


 

Link to comment
Share on other sites

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.

 

  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...