Jump to content

Linking large amount of prims


Skye Bizet
 Share

You are about to reply to a thread that has been inactive for 3516 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I am trying to create a script that rezzes 75 prims - link them and break the link from the root prim. I get a script error after linking 64 prims 'Script trying to link but permissions or target are invalid!'

I searched the forum on this problem and found a thread  In the answer it is suggested not to link all prims at the 'same time'. Good thought, but I have no idea how to build in a delay or how to change the script so it would rez only 64 prims - link them - rez the next 15 and link those too.

I give an example of my script (simplyfied so I rez only 3 prims) but this gives an idea of what I want.

integer createdObjectCounter;
integer linkedObjectCounter;

default
{
    state_entry()
    {
  
         
    linkedObjectCounter = 0;  
    }

    touch_start(integer total_number)
    {
        if( createdObjectCounter <= 0 )  
        {                              
            
           
           llRequestPermissions( llGetOwner(), PERMISSION_CHANGE_LINKS ); 
llOwnerSay( "Make sure a Prim (Object) is placed in my contents. Close the edit screen and click the me. Give Permission in the menu" );
        }
        else  
        {     
           
        }
    }

    run_time_permissions( integer permissions_granted )
    {
       if( permissions_granted == PERMISSION_CHANGE_LINKS ) 
    {

    llOwnerSay("Starts");
    
llRezObject("Object", llGetPos() + < 0.0,  0.0, 0.0  >, ZERO_VECTOR, llEuler2Rot(< 1.0, 0.0, 0.0 >*DEG_TO_RAD), 10);
createdObjectCounter = createdObjectCounter + 1;
llRezObject("Object", llGetPos() + < 0.0,  0.0, 0.0  >, ZERO_VECTOR, llEuler2Rot(< 0.0, 1.0, 0.0 >*DEG_TO_RAD), 10);
createdObjectCounter = createdObjectCounter + 1;
llRezObject("Object", llGetPos() + < 0.0,  0.0, 0.0  >, ZERO_VECTOR, llEuler2Rot(< 0.0, 0.0, 1.0 >*DEG_TO_RAD), 10);

          
       }
       else
       {
           llOwnerSay( "You must give me permissions to link." );
           return;
       }
    }

    object_rez( key child_id )
    {
         llCreateLink( child_id, TRUE ); 

 
        linkedObjectCounter++;
        if( linkedObjectCounter >=3 ) 
        {
            
  
        llBreakLink( 1 );

        
          llOwnerSay( "Done" );
        
          llResetScript();


        }
    }
}

 Does anyone have a suggestion on how to solve this problem? 

Link to comment
Share on other sites

It works if you do it like so:

integer count;default {    state_entry() {        llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS);    }    touch_start(integer total_number) {        integer perm = llGetPermissions();        if (perm &  PERMISSION_CHANGE_LINKS) {            llOwnerSay("Building...");            llRezObject("Object", llGetPos() + <.0, .0, (float)count/10 + .1>, ZERO_VECTOR, ZERO_ROTATION, 42);        }    }        object_rez( key child_id ) {        ++count;        llCreateLink( child_id, TRUE );         if (count < 90) {            llRezObject("Object", llGetPos() + <.0, .0, (float)count/10 + .1>, ZERO_VECTOR, ZERO_ROTATION, 42);        }        else {            llOwnerSay("Unlinking root...");            llBreakLink(1);        }    }}

 It is rather slow though.

Link to comment
Share on other sites

There is a common misunderstanding: object_rez and all other events do NOT interrupt the script processing.

So If you rez 50 objects in a loop the object_rez events will stack and are cached in the event queue. Once your rezzing loop is finished the event_queue can be worked off and 50 object_rez events in a row will happen.

The lenght of the event queue is 64 and if more events coming in they are dropped. Now you know why your script failed with more than 64 objects.

 

Link to comment
Share on other sites

  • 2 weeks later...

There is faster .

 

You need some preparation in the rezzed prim .

In the rezzed prim , you have already wroten a tiny script who request permission and link to the root  prim.

After it has linked to the root prim , it deletes its script

 

In the root prim , you don try to link .. You only rez .

 

Finally : with the Ron Khondi's version :

- it s easier to setup ( no need to prepare the permissions ) :

- it s slow :

 N * 1/45 second because you can t enter in the same event twice in the same simulator frame

+ N * 1 second : delay for the link

+ N * 0.1 second : delay for the rez 

For instance ,

for 100 prims , it will take 100/45 + 100*1 +100*0.1 = 112 seconds

for 255 prims , it will take 255/45 + 255*1 +255*0.1 = 286 seconds

 

With one version where it s the  rezzed prim who tries to link to the root  :

- it s more difficult to setup ( need to prepare permissions )

- it s difficult to transfer to someone ( it s a big inconvenient ) because we can t change the permissions inside a content when it s not rezzes and when we change the owner of the object

- it s faster :

N * 1/45 s

+ N * 0.1 s ..  

for 100 prims , it will take 100/45 + 100*1 = 12 seconds . So 9 to 10 X faster

 for 255 prims , it will take 255/45 +255*0.1 = 31 seconds

 

This is the script to put in the rezzer object

 

integer count;integer channel = -44451552;string objectName = "Object";string message = "ack";default{    touch_start(integer total_number)    {        llResetTime();        llRezObject( objectName, llGetPos() + <.0, .0, (float)count/10 + .1>, 
ZERO_VECTOR, ZERO_ROTATION, (integer)("0x"+llGetSubString(llGetKey(),-8,-1)) ); } object_rez( key child_id ) { ++count; llRegionSayTo (child_id, channel, message); if (count < 90) { llRezObject( objectName, llGetPos() + <.0, .0, (float)count/10 + .1>,
ZERO_VECTOR, ZERO_ROTATION, (integer)("0x"+llGetSubString(llGetKey(),-8,-1)) ); } else { llOwnerSay("Time = " +(string)llGetTime()); state dummy; } llSetText("Number of prims = "+(string)llGetNumberOfPrims(), <1,1,1>, 1); } }state dummy{ state_entry() {}}

  

And this is the script to put in the rezzed prim . Save it , grant the permissions , take the object in your inventory . and copy it inside the content inventory of the rezzer

 

integer channel = -44451552;string message = "ack";default{    state_entry()    {       llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS);       llListen(channel, "", NULL_KEY, message);    }    listen(integer channel , string name , key k, string m)    {        if ( (integer)("0x"+llGetSubString(k,-8,-1)) == llGetStartParameter() )        {            if ( llGetOwner() == llGetOwnerKey(k ) )            {                llCreateLink(k, FALSE);            }        }    }    changed(integer c)    {        if ( c & CHANGED_LINK )        {            if ( llGetNumberOfPrims() > 1 )            {                llRemoveInventory(llGetScriptName());            }        }    }}

 

 Of course , you can even link faster 

- if you don t rez individual prim but bulk prims (  but bulk objects add one constraint too )

- if you have already rezzed all your prims and know all the keys  ( other constraint too )

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3516 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...