Blockland Forums > Modification Help
Looping a function
Ephialtes:
Eval is an advanced function - people encouraging it's usage in this thread for a loop are being handicapped and should stop trying to "teach" people. soba and Superb (sick cunt) have the right idea here.
Nexus:
I guess I just like recursion scripts that can handle more kinds of input too much. It's hard to be recursive without eval.
And I assumed that he meant looping an existing function, not editing a function to be looped.
So yes, if possible the best solution would be to add a schedule like soba's in a situation where the schedule will cause itself to be triggered again. Just make sure you can stop the loop.
I do not believe that cancelling the schedule is needed unless it is important to the way the function works, because that will otherwise likely cause problems if the function should be able to loop independantly of other loops.
Anything I missed?
Glad this didnt spiral completely out of control...
Greek2me:
--- Quote from: Nexus on November 18, 2011, 12:27:00 AM ---And I assumed that he meant looping an existing function, not editing a function to be looped.
--- End quote ---
In which case the guy was probably right, call would work better. But whatever, hopefully the OP learned something.
Nexus:
--- Quote from: Greek2me on November 18, 2011, 12:39:19 AM ---In which case the guy was probably right, call would work better. But whatever, hopefully the OP learned something.
--- End quote ---
waitwaitwait
call() is a function? I thought he was just using something ambiguous as a placeholder to show that he would be calling some function.
I didn't realize you could do something like call('functionname');
I thought keybinds and schedule and servercommands did something like
--- Code: ---eval(%command @ "(" @ %args @ ");");
--- End code ---
except less obviously flawed, like stripping %command of spaces and symbols and such.
Thats actually really useful!
So yea I guess alot of us were partially wrong, or at least not entirely correct.
I feel like facepalming
Uristqwerty:
Sorry about the ranty tangents, not nearly enough sleep recently. It seems like just about every terrible post I have ever made (here and elsewhere) was late at night without enough sleep, and I never realize it at the time.