Difference between revisions of "Synchronize"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with ' //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 impleme...')
 
m (<lsl> tag to <source>)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
    
    


//simple synchronize script for two or more separate prims, like wings for instance
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
 
<source lang="lsl2">
 
    float i = llGetTime();   
 
    task();  
 
    float x = llGetTime();
      float i = llGetTime();   
    while (llGetUnixTime()%2 == 0)// do every even second (result 1 for odd seconds)
 
    {  
        task();  
        llSleep(1-(x-i));// one second minus time that has passed
 
    }
      float x = llGetTime();
</source>
 
        while (llGetUnixTime()%2 == 0)//odd or even seconds
            {  
            llSleep(1-(x-i));// one second minus time that has passed
            }

Latest revision as of 09:26, 25 January 2015


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

    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
    }