Problem Description
Having an issue with a play time timer. I'm adding 0.1 to a variable "Play_Time" ever 0.1 seconds.
This way I can exclude menu time from game time by checking to see if the menu is open before it adds time to the play time variable. I need milliseconds because It's a time based racing survival game where seconds aren't going to be enough to separate players on a leader board. However I'm getting weird numbers.
What I get
Code
The disabled code just caused the Play_Time to stay at 0.7.. not what I expected either.
What I expected would happen
well... you know.. 0.1 second would be a nice round 0.1... how could it possibly equate to anything else <img src="{SMILIES_PATH}/icon_eek.gif" alt=":shock:" title="Shocked">
Recreating this issue
I had another interesting issue when recreating the capx for public viewing.
I did the add 0.1 per 0.1 seconds thing with the play_time variable, then set a value in an array (used to record multiple scores) to Play_Time, which always gives a raw, uninterpreted value such as 1.99999999865 when viewed through a text object (set text1.text to array(1) ).
Mean while I let construct interpret Play_Time directly without the array by viewing its value through a text object, the same way i did with the array, (set text2.text to Play_Time).
I used a button object to take a snapshot of the values.
- The array received the value Play_Time and displayed it as 14.999999999999963
- The text object, however, displayed the value for Play_Time as 15
- My value for time display which I got from the array and converted into time showed 0:1410 (this is in minutes)
I get the sense that the .99999999963 is something theoretical. It knows it should be absolute e.g. 1.0 but it can be seen behaving as a decimal when viewed through an array... however the moment you reinterpret the value from the array it switches back into a whole value..... <img src="{SMILIES_PATH}/icon_e_surprised.gif" alt=":o" title="Surprised"> like my time display, the .999etc became a 1 again when called on to be a 'used value' as opposed to a 'stored value'... i'm freaking out, it's the matrix man!
" Time " & int(Scores.At(Scores.CurX)/60) & ":" & int(Scores.At(Scores.CurX)) - (int(Scores.At(Scores.CurX)/60))*60 & (Scores.At(Scores.CurX) - int(Scores.At(Scores.CurX)) )*10
Demo capx
https://www.dropbox.com/s/dziksi3to3781 ... .capx?dl=0
Affected Browsers
Chrome
Operating System and Service Pack
Windows 7 64 SP1
Construct 2 Version ID
r216 64bit