Posted: Mon Jun 20, 2005 8:20 pm Post subject: Storing Times in Variables
I can't figure out how I can record a time as a variable... Say I use this to determine how long the user took to complete a maze:
code:
Time.Elapsed/1000:0:2
How would I be able to store it as a variable? When I tried doing something like:
code:
timer:=Time.Elapsed/1000:0:2
it just gave me a syntax error at ":="... Any pointers on this situation?
Sponsor Sponsor
vagyb
Posted: Mon Jun 20, 2005 8:24 pm Post subject: Re: Storing Times in Variables
DarkMastermind wrote:
I can't figure out how I can record a time as a variable... Say I use this to determine how long the user took to complete a maze:
code:
Time.Elapsed/1000:0:2
How would I be able to store it as a variable? When I tried doing something like:
code:
timer:=Time.Elapsed/1000:0:2
it just gave me a syntax error at ":="... Any pointers on this situation?
um.. well try using wallclock command to record the time in how long it takes to complete, this way its much easier. search wallclock in turing help.
DarkMastermind
Posted: Mon Jun 20, 2005 8:26 pm Post subject: (No subject)
Thanks, I just noticed that a second before I noticed your reply. I feel like quite the arse now .. But now I'm stuck again, I don't know how to use it. The Turing Help description confuses me. It can only be used to count the time since 1/1/1970?
In addition, how can I take the time from when the user begins the game, excluding any time the introduction and recording of user name takes?
vagyb
Posted: Mon Jun 20, 2005 8:47 pm Post subject: (No subject)
okay create t1 and t2 variables, put wallclock (t1) in begining of program and wallclock (t2) at the end of program (when u loose) then do t2-t1 and put t2, will show wat time it is
var t1 : int
var t2 : int
wallclock (t1)
delay (5000)
wallclock (t2)
t2 := t2 - t1
put t2
edit: lolz i wrote c0ck by accident instead of clock and it cencsored it.
DarkMastermind
Posted: Mon Jun 20, 2005 8:52 pm Post subject: (No subject)
Thanks a ton!
[Gandalf]
Posted: Mon Jun 20, 2005 8:55 pm Post subject: (No subject)
Wallclock, from what I remember tells you the amount of milliseconds or seconds since 1970. To use that like Time.Elapsed you would have to do some math on it.
Why not just use Time.Elapsed, properly.
code:
var timer:=Time.Elapsed/1000
put timer
When you have timer:=Time.Elapsed/1000:0:2 you are telling it to show the declaration of the variable somewhere on the screen. That's just not possible. You have to use put for that, while you used it when declaring what the variable it.
*EDIT* grr, all that time to post and there are so many others.
Trust me though, you'll want to use the simpler method, Time.Elapsed.
MysticVegeta
Posted: Mon Jun 20, 2005 9:25 pm Post subject: (No subject)