Difference between revisions of "Synchronize"

From Second Life Wiki
Jump to navigation Jump to search
m (i'm not sure what this code is supposed to do)
Line 3: Line 3:
simple synchronize script for two or more separate prims, like wings for instance <br>
simple synchronize script for two or more separate prims, like wings for instance <br>
assuming the task();  is 100% similar in all prims and takes less than 1 sec to implement
assuming the task();  is 100% similar in all prims and takes less than 1 sec to implement
 
<lsl>
      float i = llGetTime();   
    float i = llGetTime();   
        task();  
    task();  
      float x = llGetTime();
    float x = llGetTime();
        while (llGetUnixTime()%2 == 0)// do every even second (result 1 for odd seconds)
    while (llGetUnixTime()%2 == 0)// do every even second (result 1 for odd seconds)
            {  
    {  
            llSleep(1-(x-i));// one second minus time that has passed
        llSleep(1-(x-i));// one second minus time that has passed
            }
    }
</lsl>

Revision as of 13:15, 14 November 2010


simple synchronize script for two or more separate prims, like wings for instance
assuming the task(); is 100% similar in all prims and takes less than 1 sec to implement <lsl>

   float i = llGetTime();  
   task(); 
   float x = llGetTime();
   while (llGetUnixTime()%2 == 0)// do every even second (result 1 for odd seconds)
   { 
       llSleep(1-(x-i));// one second minus time that has passed
   }

</lsl>