Freeloop

From Hercules Wiki
Revision as of 09:58, 28 June 2013 by Neqste (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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;
   	// will sleep the script for 1ms when detect an infinity loop to 
   	// let Hercules do what it need to do (socket, timer, process, 
   	// etc.)
   }
   
   freeloop(0); // disable
   
   for ( set .@i,0; .@i<.@bigloop; set .@i, .@i+1 ) {
   	dothis;
   	// throw an infinity loop error
   }


See Also