|
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
|
04-24-2007 20:45
I have several no copy items that I'm trying to move out of an object to different locations using llRezAtRoot. The objects are all 1 prim each.
Here is the code: touch_start(integer total_number) { integer nobjects = 0; integer i; nobjects = llGetInventoryNumber(INVENTORY_OBJECT); for(i=0; i<nobjects;i++) { llRezAtRoot(llGetInventoryName(INVENTORY_OBJECT,i),<120,(244-(2*i)),75>,ZERO_VECTOR,ZERO_ROTATION,0); } }
It should just rez the objects side by side. However, it seems to have trouble with no copy items, skipping over some. I tried introducing a llSleep delay but that doesn't seem to help. It doesn't seem to have a problem if the items are not no copy.
Has anyone successfully used llRezAtRoot to rez a bunch of no copy items? Can anyone suggest what the problem is here?
|
|
Talarus Luan
Ancient Archaean Dragon
Join date: 18 Mar 2006
Posts: 4,831
|
04-24-2007 22:17
When you rez no-copy objects from inventory, they leave the container object forever. As such, when you rez no-copy object index 0, it leaves the container, and the remaining no-copy objects shift up one index position; ie, object index 1 becomes index 0, index 13 becomes index 12, etc. When you increment the index, you are essentially skipping every other object.
What you want to do is always rez the object with inventory index 0. Of course, this WILL BREAK if any of the objects is copy-permed. It will continually rez that object forever.
|
|
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
|
04-24-2007 23:11
I'll give that a try. Makes sense.
|
|
Ed Gobo
ed44's alt
Join date: 20 Jun 2006
Posts: 220
|
04-25-2007 00:52
You can rez in reverse order. That way deleted items don't affect earlier items in the list. From a section of builder's buddy: integer iCount = llGetInventoryNumber(INVENTORY_OBJECT); //Loop through backwards (safety precaution in case of inventory change) llOwnerSay("Rezzing build pieces..."); for( i = iCount - 1; i >= 0; i-- ) { item = llGetInventoryName(INVENTORY_OBJECT, i); llRezObject(item, vThisPos + <0,0,4>, ZERO_VECTOR, rThisRot, PRIMCHAN); llSay(PRIMCHAN, "MOVE " + llDumpList2String([ vThisPos, rThisRot ], "|")); llSleep (3.0); if (debug) llOwnerSay ("Rezzing " + item); llSleep (1.0);
|