Difference between revisions of "Freeloop"

From Hercules Wiki
Jump to: navigation, search
(Created page with "==Syntax== *'''freeloop'''(<toggle>); ==Description== Toggling this to enabled (1) allows the script instance to bypass the infinite loop protection, allowing your script to...")
 
m (Freeloop don't do a sleep(1) when there is an infinity loop (even if it was how I introduced this command to the community). Devs coded it just to skip the infinity loop countdown, nothing else.)
 
Line 13: Line 13:
 
     for ( set .@i,0; .@i<.@bigloop; set .@i, .@i+1 ) {
 
     for ( set .@i,0; .@i<.@bigloop; set .@i, .@i+1 ) {
 
     dothis;
 
     dothis;
     // will sleep the script for 1ms when detect an infinity loop to  
+
     // Be aware, it will block the emulator to process other
     // let Hercules do what it need to do (socket, timer, process,  
+
     // stuff (socket, timer, logic, etc.) until the loop end.
    // etc.)
+
 
     }
 
     }
 
      
 
      
Line 24: Line 23:
 
     // throw an infinity loop error
 
     // throw an infinity loop error
 
     }
 
     }
 
  
 
==See Also==
 
==See Also==

Latest revision as of 07:38, 18 July 2013

Contents

Syntax

  • freeloop(<toggle>);

Description

Toggling this to enabled (1) allows the script instance to bypass the infinite loop protection, allowing your script to loop as much as it may need. Disabling (0) will warn you if an infinite loop is detected.

Example

   freeloop(1); // enable script to loop freely
   
   //Be aware with what you do here.
   for ( set .@i,0; .@i<.@bigloop; set .@i, .@i+1 ) {
   	dothis;
   	// Be aware, it will block the emulator to process other
   	// stuff (socket, timer, logic, etc.) until the loop end.
   }
   
   freeloop(0); // disable
   
   for ( set .@i,0; .@i<.@bigloop; set .@i, .@i+1 ) {
   	dothis;
   	// throw an infinity loop error
   }

See Also