Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 840 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Stopwatch ? [Re: elevationmind] #411402
11/16/12 11:12
11/16/12 11:12
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Nearly everything is possible why not ?
Rename it to StopWatch2 and u have another one grin

Make the var "running" global. Then u can stop the running StopWatch function by setting running to zero.


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Stopwatch ? [Re: rayp] #411412
11/16/12 12:06
11/16/12 12:06
Joined: Nov 2012
Posts: 18
Germany
E
elevationmind Offline
Newbie
elevationmind  Offline
Newbie
E

Joined: Nov 2012
Posts: 18
Germany
var running;
void StopWatch(var* Seconds)
{
static var seconds;
seconds= *Seconds;
while(running)
{
wait(1);
seconds += (timer()/1000000);
}
return;
*Seconds = seconds;
return;

}

This is what I am currently using (as I only need seconds), but it is not working.

Starting it with running=1; StopWatch(SS);
doesn't work...

Re: Stopwatch ? [Re: elevationmind] #411414
11/16/12 12:16
11/16/12 12:16
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Here are the worst things:
1. *Seconds = seconds; is dead code.
2. There is no advante in making seconds static.
3. You cannot use timer() over two frames. Read the documentation. Besides timer() is absolutely not necesary here. time_step is totally sufficient.


Always learn from history, to be sure you make the same mistakes again...
Re: Stopwatch ? [Re: Uhrwerk] #411417
11/16/12 12:40
11/16/12 12:40
Joined: Nov 2012
Posts: 18
Germany
E
elevationmind Offline
Newbie
elevationmind  Offline
Newbie
E

Joined: Nov 2012
Posts: 18
Germany
Originally Posted By: Uhrwerk
Here are the worst things:
1. *Seconds = seconds; is dead code.
2. There is no advante in making seconds static.
3. You cannot use timer() over two frames. Read the documentation. Besides timer() is absolutely not necesary here. time_step is totally sufficient.


Could you please explain to me how I could use time_step to make a stopwatch that just counts the seconds?

Re: Stopwatch ? [Re: elevationmind] #411418
11/16/12 12:43
11/16/12 12:43
Joined: Nov 2012
Posts: 18
Germany
E
elevationmind Offline
Newbie
elevationmind  Offline
Newbie
E

Joined: Nov 2012
Posts: 18
Germany
Nevermind - I've got it. Thx anyway!

Page 2 of 2 1 2

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