any timing feature in turing?
Author |
Message |
WangChang
|
Posted: Wed Mar 08, 2006 4:53 pm Post subject: any timing feature in turing? |
|
|
I have a game i made, very simple where they have to type the exact mesage, I was wondering it there was a possible way to make it show how many "seconds" it takes for them to type whatever thanks alot! |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
[Gandalf]

|
Posted: Wed Mar 08, 2006 5:11 pm Post subject: (No subject) |
|
|
Use the Time.Elapsed function which returns the amount of milliseconds since the program was started. You can manipulate it in ways like this:
pseudo: | startTime = getCurrentTime()
doSomething()
put "It took you " getCurrentTime() - startTime " seconds to do something." |
Note: The above is obviously not Turing code, but it should be enough for you to get the picture. |
|
|
|
|
 |
WangChang
|
Posted: Wed Mar 08, 2006 6:13 pm Post subject: (No subject) |
|
|
code: | %Randomize a 9-digit integer for the game
randomize
var n1 : int
randint (n1, 100000000, 999999999)
%Introduction/Instructions to game
colour (2)
put "The instuctions are simple, all you have to do is..."
delay (2500)
put "Type the given number without any mistakes, what you typed will be invisable so"
delay (3500)
put "you only get one chance at typing the number unless you know your mistake, you"
delay (3500)
put "can simply 'backspace' to correct the error. Game begins in:"
delay (1500)
put ""
%Declares "number" as variable for number entered, loop created to re-run if number typed incorrectly
loop
var number : int
delay (750)
play ("a")
colour (4)
put "Five!"
delay (1000)
play ("a")
colour (4)
put "Four!"
delay (1000)
play ("a")
colour (4)
put "Three!"
delay (1000)
play ("a")
colour (4)
put "Two!"
delay (1000)
play ("a")
colour (4)
put "One!"
delay (500)
put ""
%Display the number
colour (1)
play ("f")
put n1
%Players enter number
colour (0)
put ""
get number
%if number is correct, program will not re-run
exit when number = n1
%clear screen, if number not correct it will re-run giving you a chance to try again
cls
colour (2)
put "The number you typed did not match given number, please try again! ;)"
delay(750)
put "Number will appear again in"
put ""
end loop
%if number typed was correct, everything will be cleared and congratulation message will be created
cls
colour (2)
locate(13,17)
put "You have successful typed: ", n1, " correctly!"
|
Please help me add a feature to this code showing the time it takes to type the random integers created. Thank you so very much.. |
|
|
|
|
 |
Delos

|
Posted: Wed Mar 08, 2006 7:12 pm Post subject: (No subject) |
|
|
[Gandalf] wrote: Use the Time.Elapsed function...
What more is there to say? We appreciate you posting your code, but if you haven't at least attempted to solve this given the new information you've been presented with, then you're not learning anything.
Press F10 and look up how to use this syntax. Then follow Gandalf's pseudo to code it. |
|
|
|
|
 |
|
|