Time Counter
Blitz3D Forums/Blitz3D Programming/Time Counter
| ||
I have a problem. I need a time counter between a keypress to change a variable 3 seconds before. ButIf Battle%= 1 And Stado%=3 Then oldTime=MilliSecs() While MilliSecs() < (oldTime + 3000) Battle%=0 combatvalue=0 Text Wend EndIf Did not work, because it pause all the game. Can you help me? |
| ||
if keyhit(whatever)then oltime#=millisecs()+3000 if oldtime#<millisecs() then ; stuff here will happen for 3 seconds endif |
| ||
what does % do? |
| ||
Please stop bumping ancient threads when you have nothing to add to them. You could very easily have started a new thread to ask that question. The % symbol specifies that the variable being declared is an integer. |
| ||
It's also unnecessary. The % only needs to follow the name of the variable when you first declare it. After it's been declared, it's purely redundant and can be omitted. |
| ||
It's also unnecessary. The % only needs to follow the name of the variable when you first declare it. After it's been declared, it's purely redundant and can be omitted. You don't even have to use it then as integer is the default variable type. |
| ||
Really? I didn't know that. I thought that a variable without a type became the type of the first value given to it. (e.g. var = 0.25, then var becomes a float) |
| ||
Yeah Big10p's right... I thought the same as you, Clay but I just tried the following: var=0.25 Print var Returns 0 Just to make sure... var=0.25 Print var# Error: Variable Type Mismatch |
| ||
And while we're at it:if keyhit(whatever)then oltime#=millisecs()+3000 if oldtime#<millisecs() then ; stuff here will happen for 3 seconds endif Better use Integers whenever you are working with Millisecs(). You probably run into NAN, rounding errors and other stuff when you feed a float with very high or low integers (eg. -1800333222). |