Is that a bug?
-
So I got rid of the for loop at the end of your program and the 2 if statements in it and replaced a normal loop with the for loop and it works for me
-
@LinkCraft so did it crash like for me?
Is the for loop the problem? -
I have tested it without the for loop, seems to work now.
Okay then I'm in front of another problem.
If an infinite for loop gets my game to crash how am I going to build a timer for my abilities? Time is an important factor...
-
how do you have an infinite for loop?
I’m not saying it’s what’s causing your crash, but non-stopping loops should probably use ‘while’..?
-
@toxibunny infininite for loop example:
For i = 0 to 60 step 1 loop
If i = 60 then i = 0 endif
RepeatEasy as that
-
@Mechanical So what are you trying to achieve here? A counter that goes from 0 to 59 because this would be neater:
i = 0 loop i = (i + 1) % 60 repeat
-
Also, the
step 1
is not required. That's the default. -
@pianofire im trying to achieve a timer for some abilitys.
Just the ability to measure time would be great. -
Use settimer()
-
-
Use the time() command. Have variables called starttime, currenttime, and elapsedtime. Put a starttime = time() right at the beginning before your main loop, put a currenttime = time() inside your main loop, and then just remember that elapsedtime = currenttime-starttime. Making starttime=currenttime will reset the counter (don’t do that every loop though, obviously), and if you just want seconds, then secondscounter = elapsedtime%60
The % means ‘modulo’ , btw. Google it, it’s very useful!