Neron Posted October 10, 2011 Share Posted October 10, 2011 Is there procedure "restart script" ? Quote Link to comment Share on other sites More sharing options...
FHannes Posted October 10, 2011 Share Posted October 10, 2011 No, you can loop in your main method... Quote Link to comment Share on other sites More sharing options...
Wanted Posted October 10, 2011 Share Posted October 10, 2011 [sCAR]program ResetExample; procedure MainLoop; begin Everything; MainLoop; //Restart script Exit; //Restart script EverthingElse; end; begin MainLoop; end.[/sCAR] Quote Link to comment Share on other sites More sharing options...
FHannes Posted October 10, 2011 Share Posted October 10, 2011 [sCAR]program ResetExample; procedure MainLoop; begin Everything; MainLoop; //Restart script Exit; //Restart script EverthingElse; end; begin MainLoop; end.[/sCAR] That's actually not the best implementation, by recursing without using tail recursion, your stack will grow and overflow the memory if the script is repeated too often. It's better just to use a loop. [scar]begin repeat ... until False; end.[/scar] Quote Link to comment Share on other sites More sharing options...
Wanted Posted October 10, 2011 Share Posted October 10, 2011 Hmm.. any way to avoid that? Quote Link to comment Share on other sites More sharing options...
FHannes Posted October 10, 2011 Share Posted October 10, 2011 No, it's a property of recusion, you have to put a return memory address on the stack before going into another function, in case you're not using tail recursion, you also have to put all of the current variables on the stack so they can be restored when you return. Quote Link to comment Share on other sites More sharing options...
Wanted Posted October 10, 2011 Share Posted October 10, 2011 Ok yea definitively see where that would be a problem them here's a good thread that shows different ways to loop http://forums.scar-divi.com/showthread.php?tid=165 Quote Link to comment Share on other sites More sharing options...