goto – Talk

From Bohemia Interactive Community
Revision as of 23:11, 23 May 2006 by Thobson (talk | contribs) (Evidence)
Jump to navigation Jump to search

Ok......lets get this clear.

I have always thought that a loop, in most cases, MUST have a delay of some sort, otherwise the loop loops so fast that you cannot interrupt it and end up having to reboot or quit the game.

Lets have the nitty gritty here.

Also, are Label names case sensitive or not, give reasons , evidence.........etc.


Planck


raedor: From what I know they're not case sensitive, I've been using them for years without problems. About the delay: it is correct that you should have delays in your loops, especially "infinite" loops (eg with alive x as condition), as slower computers will CTD without that delay. Also you should think about the length of the delay if you're addon-scripting, because you have to face the fact that your scripts might run 20 times at once. I think it's an interesting fact here, that @ and triggers check with .5 delays.

Delay in a loop

While it is not required to include delay in a loop, loop without a delay can cause the script to slow down the game a lot, as the loop will be executed many times before game engine interruprts the script.

Unless you really want the loop to execute multiple times during a frame, you should include a small delay.

--Suma 12:19, 23 May 2006 (CEST)


Thanks for that Suma, I was always under the impression that at least a small delay was advisable, even if only 0.001.

Planck 17:11, 23 May 2006 (CEST)


Well, .001 is still a bit short as it means 1000 checks per second and this again is 20 checks per frame (if you have 50 FPS... I play on about 20 FPS usually). Everything > 1 check per frame is useless, as you'll see the effect on the next frame at the earliest. You can say a maximum of 70 checks per second (I doubt that anyone plays with 70 FPS... anyway) is okay, so that a minimum of .014 as delay should be clear.

Raedor 17:25, 23 May 2006 (CEST)

First time here - I hope this is going in the correct place. The point I am making is that loops that look like:

#loop
lots
of
useful
stuff
if (condition) then {goto"loop"}

do not need to have a delay, it is just like a long list of repeated instructions.

I could understand that a loop that looks like:

#wait
if (condition) then {goto"wait"}

Could well cause problems without a small delay. But then unless they really know what they are doing they should use an @ instruction which by my testing runs much smoother. But to say that all loops need a delay is to seriously confuse the punters.

If people are okay with it I will edit the entry tomorrow when I get chance and then let's see if we are in agreement - I can shift all that stuff I put in about forEach as well that is really irrelevant here.

Does that make sense? Have I understood the disconnect?

Evidence

Not knowing about this place until Planck tipped me off I was not aware that the question about evidence for case sensitivity of labels had been asked. Is the script I posted sufficient evidence that labels are not case sensistive?

Would it be better if I moved that script here rather than leave it where it is. I am happy either way.