Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,731 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Timer with sys_seconds #123537
04/12/07 19:03
04/12/07 19:03
Joined: Dec 2005
Posts: 57
Brazil
P
pesseba Offline OP
Junior Member
pesseba  Offline OP
Junior Member
P

Joined: Dec 2005
Posts: 57
Brazil
Does somebody has a code of counter with sys_seconds? I need to start it from zero... and synchronized with the windows clock!

Thanks!

Re: Timer with sys_seconds [Re: pesseba] #123538
04/12/07 19:27
04/12/07 19:27
Joined: Mar 2005
Posts: 514
Brazil
Carloos Offline
User
Carloos  Offline
User

Joined: Mar 2005
Posts: 514
Brazil
I dont use it, but its in the manual. There is an AUM also that contains something about it.

Re: Timer with sys_seconds [Re: Carloos] #123539
04/12/07 19:51
04/12/07 19:51
Joined: Dec 2005
Posts: 57
Brazil
P
pesseba Offline OP
Junior Member
pesseba  Offline OP
Junior Member
P

Joined: Dec 2005
Posts: 57
Brazil
thanks... But I resolved my counter, timer or chronometer with total_secs!

/////////////////////////////////////////////
seq= total_secs; // when start conter
...
//while loop
temp = total_secs;
result = temp-seq;
if(result == 60)
{
min+= 1;
seq= total_secs;
}

/////////////////////////

see you..

Re: Timer with sys_seconds [Re: pesseba] #123540
04/12/07 19:54
04/12/07 19:54
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
does total_secs have a limit?

Nevermind, just did the math. It would take over 10 hours of gameplay to have an error... lol.


xXxGuitar511
- Programmer
Re: Timer with sys_seconds [Re: xXxGuitar511] #123541
04/12/07 22:11
04/12/07 22:11
Joined: Dec 2005
Posts: 252
MyOwnKingdom
nipx Offline
Member
nipx  Offline
Member

Joined: Dec 2005
Posts: 252
MyOwnKingdom
why dont you just use sleep(1); ? this stops your loop for 1 sec.



Quote:

10 hours of gameplay



Are you sure? if sys_sec is a double (the engine is written in C/C++ , isnt it?)
with a range from -1.8e+308 to 1.8e+308 -> 3.6e+308(unsigned). so you can play 3.6e+308 secs
/60 -> 6.e+306 mins /60 -> 1.e+305 h if they used a long double (10Bit) you can play even a few hours more.

Or am I completely wrong?



nipx

Re: Timer with sys_seconds [Re: nipx] #123542
04/12/07 22:14
04/12/07 22:14
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Forget sleep(x); its old syntax, use wait(-x); instead.

Easy minute timer using wait(-x):
Code:

var minutes = 0;
var status_timer = 0;

function set_timer(_mode)
{
minutes = 0;
status_timer = _mode;
while(status_timer)
{
minutes += 1;
wait(-60); //waits 60 seconds
}
}

//call the function the following ways:
//start the timer: set_timer(1);
//stop the timer: set_timer(0);



Re: Timer with sys_seconds [Re: Xarthor] #123543
04/12/07 23:05
04/12/07 23:05
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
I meant at least 10 hours

10 hours ~= 4200 seconds... lol.


xXxGuitar511
- Programmer
Re: Timer with sys_seconds [Re: xXxGuitar511] #123544
04/13/07 00:12
04/13/07 00:12
Joined: Oct 2004
Posts: 1,655
T
testDummy Offline
Serious User
testDummy  Offline
Serious User
T

Joined: Oct 2004
Posts: 1,655
total_secs (no freeze_mode)
999999.999 secs?
16666.66665 mins?
277.7777775 hrs?
11.5740740625 days?
1.6534391517857142857142857142857 weeks?
0.41335978794642857142857142857143 months?
0.034446648995535714285714285714286 years?
0.0034446648995535714285714285714286 decades?
0.00034446648995535714285714285714286 centuries?

Re: Timer with sys_seconds [Re: testDummy] #123545
04/13/07 05:42
04/13/07 05:42
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
lol, thank you test dummy. I'll make sure if I ever leave my game on for centuries, I use your calculations...

BTW: Your posts are always a pleasure to read... Very intelligent and humorous in a technical way...


xXxGuitar511
- Programmer
Re: Timer with sys_seconds [Re: xXxGuitar511] #123546
04/13/07 06:39
04/13/07 06:39
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline
Expert
Germanunkol  Offline
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Hey, let's try it! anyone got a spare computer? We'll run the game ans see when it gives you the error...
after 200 years we'll know test dummy was right


~"I never let school interfere with my education"~
-Mark Twain

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | 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