Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, VoroneTZ, 1 invisible), 1,512 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
game clock #151414
08/31/07 23:06
08/31/07 23:06
Joined: Jun 2007
Posts: 28
D
Doriel Offline OP
Newbie
Doriel  Offline OP
Newbie
D

Joined: Jun 2007
Posts: 28

I am trying to create a clock for my game. However, I am having difficulty making the clock consistent. Depending on where I am in the game, the time will change faster or slower. Right now all I do is have variables for minutes, seconds, etc, and on every loop through main, i update the variables. I use wait() to slow down the clock from running too fast. However, I think it's those same wait() statements (in other functions) that are making the clock inconsistent.

Is there any way I can use the system time to make my own clock? Are there any examples of this?

My clock needs to start at 7:00 AM and go to 7:00 PM at which the game ends. But the game shouldn't last more than 20 minutes.

Any ideas?

Doriel

Re: game clock [Re: Doriel] #151415
08/31/07 23:17
08/31/07 23:17
Joined: Apr 2005
Posts: 3,076
Germany, NRW
rvL_eXile Offline

3D Artist
rvL_eXile  Offline

3D Artist

Joined: Apr 2005
Posts: 3,076
Germany, NRW
Yes, look into the Manual "sys_seconds/Minutes/Hours/Days/weeks/month/year" This shows you the Time/Date of ure PC.

cYa Sebastian

EDIT:
Use wait(-Value); for the waiting Time. Set FPS_Max=30; into the Main Function for a constant FPS

Last edited by rvL_eXile; 08/31/07 23:18.

Tutorials:
[Blender]Terrain creation ENG/GER
[Blender]Low Poly Tree Modeling
[GIMP]Create a Texture for Terrains
CLICK HERE


Re: game clock [Re: rvL_eXile] #151416
08/31/07 23:59
08/31/07 23:59
Joined: Nov 2003
Posts: 1,257
Wade_Adams Offline
Serious User
Wade_Adams  Offline
Serious User

Joined: Nov 2003
Posts: 1,257
i would use sleep instead of wait cause sleep is a set amount of time and wait depends greatly on the speed of your computer.


Optimism is an occupational hazard of programming: feedback is the treament.
Kent Beck
Re: game clock [Re: Wade_Adams] #151417
09/01/07 07:46
09/01/07 07:46
Joined: Aug 2007
Posts: 165
Germany
J
jermy Offline
Member
jermy  Offline
Member
J

Joined: Aug 2007
Posts: 165
Germany
schau dir mal des an:

-------------------
code

function clock()
{
//HOUR,MINUTES,SECONDS
str_for_num(clock_string, SYS_HOURS);
str_cat(clock_string, ":");
IF (SYS_MINUTES < 10)
{str_cat(clock_string, "0");}

str_for_num(temp_string, SYS_MINUTES);
str_cat(clock_string, temp_string);
str_cat(clock_string, ":");
IF (SYS_SECONDS < 10)
{str_cat(clock_string, "0");}

str_for_num(temp_string, SYS_SECONDS);
str_cat(clock_string, temp_string);

//DAY,MONTH,YEAR
str_for_num(date_string, sys_day);
str_cat(date_string,".");
IF (sys_month < 10)
{ str_cat(date_string,"0");}
str_for_num(temp_string, sys_month);
str_cat(date_string,temp_string);
str_cat(date_string, ".");
str_for_num(temp_string, sys_year);
str_cat(date_string, temp_string);
}


das noch in eine while 1 +wait1 schleife packen und fertig ist die uhr.

ps. alle strings ... musst du noch am anfang vom skript einführen! ich habe 2 texte! für datum und uhr!

Re: game clock [Re: Wade_Adams] #151418
09/01/07 08:52
09/01/07 08:52
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Quote:

i would use sleep instead of wait cause sleep is a set amount of time and wait depends greatly on the speed of your computer.




wait with a negative argument in seconds is the replacement for sleep sleep has been abandoned.


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1