Qbasicnews.com
May 31, 2020, 06:54:42 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: In-game timer  (Read 1302 times)
NovaProgramming
Been there, done that
*****
Posts: 1025



« on: June 29, 2004, 02:17:40 PM »

I am in the process of re-doing my Qbasic RPG (Mokli: Quest for the Gems) and I was wondering if it were possible to make an in-game timer... you know, like they have on Final Fantasy or something, that tells you how long you've played?  I've messed around with the TIMER function, but haven't gotten it to work quite right...  Any help would be appreciated, thanks!
Logged

ovaProgramming.

One night I had a dream where I was breaking balls.  The next morning, BALLSBREAKER was born.

Quote from: "Haye, Phillip J."
 Excellent.  Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Zack
*/-\*
*****
Posts: 3974



WWW
« Reply #1 on: June 29, 2004, 03:48:39 PM »

Indeed, TIMER can be counter-intuitive. Here's a timer routine. It checks if a full second has past, and if so, updates the timer output.
Code:
t!=TIMER
DO
    IF TIMER - t! >= 1 THEN
        elapsed=elapsed + 1
        LOCATE 1,1: PRINT elapsed
        t!=TIMER
    END IF
LOOP

Of course, if the user is playing when the clock strikes midnight then the timer will be screwed up. But just trust that nobody is a nerd enough to be playing a game through midnight. :wink:
Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
NovaProgramming
Been there, done that
*****
Posts: 1025



« Reply #2 on: June 29, 2004, 06:14:43 PM »

yeah, especially if it's MY game  Cheesy
Logged

ovaProgramming.

One night I had a dream where I was breaking balls.  The next morning, BALLSBREAKER was born.

Quote from: "Haye, Phillip J."
 Excellent.  Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!