Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Using a time variable

Author
Message
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 26th Jul 2005 10:46
I need to know how to make the current time a variable. I tried the get imte$() command but I can't get it to put it into a variable.
I tried
But it says I have to assign a variable to an amount or something like that. I think the get time$() command only works for printing it. The reason I need it in a variable is so I can make the person the player controls lose health in the day and keep health in the dark (because hes a shadow). I wanted to use the actual time instead of forced time (like time that is made up). Any help is appreciated!

David

------------------------
Visit my website of Games!
http://dabip.stonerocket.net
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 26th Jul 2005 10:49 Edited at: 26th Jul 2005 11:25
vgames master,

Well, I suppose that since the only value the get time$() command returns is a string, then you will need to code a string dissembler. Then, you can get the values of each seperated string, via the val command.

Runnable program:



+NanoBrain+
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 26th Jul 2005 11:31
Alright! Thanks, so If I wanted to check if it was a certain time (say 2:00 pm) how would I go abouts in doing that?

------------------------
Visit my website of Games!
http://dabip.stonerocket.net
NanoBrain
20
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 26th Jul 2005 12:01 Edited at: 26th Jul 2005 12:02
vgames master,

If the hour is equal or greater than 12 then you know it is afternoon;pm. Use a simple if else statement to include either an am or pm sign, next to the time. Also, if the hour is equal to or greater than 13, then subtract 12 from the hour. Combining these two methods will get you a standard looking time.

Runnable Program:



+NanoBrain+
dab
20
Years of Service
User Offline
Joined: 22nd Sep 2004
Location: Your Temp Folder!
Posted: 26th Jul 2005 12:34
Okay, thanks! I really appreciate it!!

------------------------
Visit my website of Games!
http://dabip.stonerocket.net

Login to post a reply

Server time is: 2025-05-22 13:25:31
Your offset time is: 2025-05-22 13:25:31