Pages: 1
I've always used repeat until's but I've noticed people using forevers with an if (conditions){stop script}. which one actually causes less lag? or is there a different advantage to one or the other (not counting the fact that you can add scripts to the bottom of a repeat until)
Last edited by estorken (2011-05-12 16:30:38)
Offline
Well, the advantage you mentioned is only valid for 1s1s projects, as you can easily stick in a broadcast right before the stop script.
I think that the repeat until should cause less lag (of a couple milliseconds) because it's a block less, even if the actions performed are exactly the same (at each loop, check the condition).
The only real advantage of using the IF block is that you can stick it in wherever you need, whereas with the repeat until you have no choice over that (checks it before each loop).
So it really depends on what your purpose is.
Less lag: Repeat until
More customize-ability: IF clause
Offline
I use the repeat until a lot coupled with a variable called "place". Then, when place applies to that script. This way when a "place" is left, the scripts can stop and they don't slow the other scripts down when they're really not needed. It does mean broadcasting a lot though.
Offline
LS97 wrote:
Well, the advantage you mentioned is only valid for 1s1s projects, as you can easily stick in a broadcast right before the stop script.
I think that the repeat until should cause less lag (of a couple milliseconds) because it's a block less, even if the actions performed are exactly the same (at each loop, check the condition).
The only real advantage of using the IF block is that you can stick it in wherever you need, whereas with the repeat until you have no choice over that (checks it before each loop).
So it really depends on what your purpose is.
Less lag: Repeat until
More customize-ability: IF clause
To be exact, it would save 10 millisecs (as that is how long a block takes to run.)
Offline
Pages: 1