jamppa
Junior Member
DarkAges rules!!!
Posts: 53
|
Post by jamppa on Feb 15, 2002 18:08:23 GMT
Does anyone know how to put second´s tenparts to timer?? Now it´s always "00:00:09" (<--- example), but how can i get "00:00:09,87" (example again)??
|
|
jamppa
Junior Member
DarkAges rules!!!
Posts: 53
|
Post by jamppa on Feb 19, 2002 17:40:55 GMT
MASTERS WHERE ARE YOU??
|
|
jamppa
Junior Member
DarkAges rules!!!
Posts: 53
|
Post by jamppa on Feb 19, 2002 17:42:15 GMT
MASTERS WHERE ARE YOU??
|
|
jamppa
Junior Member
DarkAges rules!!!
Posts: 53
|
Post by jamppa on Feb 22, 2002 13:24:06 GMT
PLEEEEEEEEAAAAAAAAAASEEEEEEEE!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
Post by piegopher on Feb 24, 2002 22:47:19 GMT
How are you trying to use it? Give me some context
|
|
jamppa
Junior Member
DarkAges rules!!!
Posts: 53
|
Post by jamppa on Feb 25, 2002 18:49:20 GMT
in a running game...i can´t copy it here cause notepad doesn´t understand it without problems, but i´ll try to write a little:
------------------------------------------------------------ TIME$ = "00:00:00" TIMER ON GOTO RUN
run: PRINT "Your time:", TIME$ PRINT "Ran", j INPUT h$ IF h$ = "j" or h$ = "J" THEN j = j + 2 IF j = 100 THEN GOTO goal GOTO run
goal:
PRINT "Your time :", TIME$ IF TIME$ < "00:00:09" THEN PRINT "Good, you beat your opponent!" IF TIME$ = "00:00:09" THEN PRINT "You get a tie, try again!" IF TIME$ > "00:00:09" THEN PRINT "You lost." INPUT qwerty$ GOTO menu
----------------------------------------------------
Well, that was a simplified thing but i think you get the idea...HELP NEEDED!!!
|
|
|
Post by piegopher on Feb 26, 2002 1:32:51 GMT
I've never used TIME$ before... hmmf- Maybe I should try it sometime... but at any rate, here's how I did it- I used TIMER instead- Instead of returning a neat little hh:mm:ss display, timer gives out a weird decimal that covers really small times, meh- here's the program I did (as usual I probably do some things a little too complicated than I should)
TIMER ON timei = TIMER GOTO 1
1 TIME = INT((TIMER - timei) * 100) / 100 PRINT "Your time:", TIME PRINT "Ran", j INPUT h$ IF h$ = "j" OR h$ = "J" THEN j = j + 2 IF j = 100 THEN GOTO 2 GOTO 1 2 PRINT "Your time :", TIME IF TIME < 9 THEN PRINT "Good, you beat your opponent!" IF TIME = 9 THEN PRINT "You get a tie, try again!" IF TIME > 9 THEN PRINT "You lost." INPUT qwerty$ goto 3
Probably the most confusing line in it would be
TIME = INT((TIMER - timei) * 100) / 100
so I'll explain it- (TIMER - timei) gives me the time since timei was created (at the beginning of the program) in something like 8 decimal places. INT rounds that number down to the nearest 1 (or second in this case), so to avoid losing those 2 extra decimals that you wanted I multiplied it by 100 before the INT and divide it by 100 afterwards to return the number to normal. meh- I hope that helps
|
|
pebe
Junior Member
Posts: 39
|
Post by pebe on Mar 9, 2002 22:48:24 GMT
Why don't you just use TIMER? It will give time to 2 decimals. Like:
'get the times for each player in your prog based on time elapsed, using TIMER
IF player1! > player2! then PRINT "You lost" IF player1! = player2! THEN PRINT " You drew" IF player1! < player2! THEN PRINT "You won"
|
|
jamppa
Junior Member
DarkAges rules!!!
Posts: 53
|
Post by jamppa on Mar 10, 2002 11:17:14 GMT
what do you mean??
|
|
pebe
Junior Member
Posts: 39
|
Post by pebe on Mar 10, 2002 16:13:11 GMT
You haven't shown all the program, but I assumed that you were timing a player's action or something. In that case you could time his start with start!=timer, and time his finish with finish!=timer. Timer rounds to 2 decimal places, so timetaken!=finish!-start! The answer would be in seconds, eg. 54.23
If you want the *actual* time of the start and finish in the format you showed then it can be converted. If you want I'll post a routine for it.
|
|
jamppa
Junior Member
DarkAges rules!!!
Posts: 53
|
Post by jamppa on Jan 22, 2003 13:14:28 GMT
This doesn't work: TIME$ = "00:00:00" TIMER ON GOTO RUN run: PRINT "Your time:", TIME$ PRINT "Ran", j INPUT h$ IF h$ = "j" or h$ = "J" THEN j = j + 2 IF j = 100 THEN GOTO goal GOTO run goal: PRINT "Your time :", TIME$ IF TIME$ < "00:00:09" THEN PRINT "Good, you beat your opponent!" IF TIME$ = "00:00:09" THEN PRINT "You get a tie, try again!" IF TIME$ > "00:00:09" THEN PRINT "You lost." INPUT qwerty$ GOTO menu Neither works this: TIMER ON timei = TIMER GOTO 1 1 TIME = INT((TIMER - timei) * 100) / 100 PRINT "Your time:", TIME PRINT "Ran", j INPUT h$ IF h$ = "j" OR h$ = "J" THEN j = j + 2 IF j = 100 THEN GOTO 2 GOTO 1 2 PRINT "Your time :", TIME IF TIME < 9 THEN PRINT "Good, you beat your opponent!" IF TIME = 9 THEN PRINT "You get a tie, try again!" IF TIME > 9 THEN PRINT "You lost." INPUT qwerty$ goto 3 --------------------------- I went back on QB from a 1-year break. But, I tried my running program and it doesn't work: time doesn't go on. It's just 00:00:00 and in the end of the game it's 00:00:01. PLEASE help me. The code is just like above. I'd like you to join #jamppaweb @ IRCnet, for real-time help. Thank you.
|
|
Elias
Junior Member
Posts: 78
|
Post by Elias on Jan 22, 2003 23:47:27 GMT
the answer is quite simple!!
TIMEWITHDECIMAL$ = TIME$ + RIGHT$(STR$(TIMER), 3)
|
|