Gamestudio Links
Zorro Links
Newest Posts
Black Book, 4th edition
by jcl. 03/17/26 09:28
Trying to get started...
by Lukudo. 03/16/26 09:08
ZorroGPT
by TipmyPip. 03/08/26 18:50
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
4 registered members (clint000, TipmyPip, VoroneTZ, 1 invisible), 4,727 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
mredit, vestriaa, Lukudo, mldenoiser, the1
19204 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to make a timer #416917
02/05/13 21:34
02/05/13 21:34
Joined: Jan 2013
Posts: 41
Redoine Offline OP
Newbie
Redoine  Offline OP
Newbie

Joined: Jan 2013
Posts: 41
Hello good guys

1) i need a code of a timer
i mean a code that execut a function or action evry second , 2s or anytime u want

2) and also i need to know how to enable and disable a function

3) and i'm looking for a pack of lite c code snippets (no AUMs please)

and if someone could make a lite c code library that will be great (like VB.net code library)

Thank you very much

Last edited by Redoine; 02/05/13 21:40.
Re: How to make a timer [Re: Redoine] #416920
02/05/13 21:41
02/05/13 21:41
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
1. + 2.
Code:
var enabled = 1;
void my_special_timer_function()
{
    while (1)
    {
        while (!enabled)
            wait(1);
        while (enabled)
        {
            // Do whatever you want to do every second...
            wait(-1)
        }
    }
}



Always learn from history, to be sure you make the same mistakes again...
Re: How to make a timer [Re: Uhrwerk] #416922
02/05/13 22:03
02/05/13 22:03
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline

Expert
Realspawn  Offline

Expert

Joined: Jul 2001
Posts: 4,801
netherlands


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: How to make a timer [Re: Uhrwerk] #416923
02/05/13 22:03
02/05/13 22:03
Joined: Jan 2013
Posts: 24
M
milaz Offline
Newbie
milaz  Offline
Newbie
M

Joined: Jan 2013
Posts: 24
Originally Posted By: Uhrwerk
1. + 2.
Code:
var enabled = 1;
void my_special_timer_function()
{
    while (1)
    {
        while (!enabled)
            wait(1);
        while (enabled)
        {
            // Do whatever you want to do every second...
            wait(-1)
        }
    }
}



you forgot "wait(1);" for the first while...

Re: How to make a timer [Re: Uhrwerk] #416924
02/05/13 22:12
02/05/13 22:12
Joined: Jan 2013
Posts: 41
Redoine Offline OP
Newbie
Redoine  Offline OP
Newbie

Joined: Jan 2013
Posts: 41
Thank you

Re: How to make a timer [Re: Redoine] #416925
02/05/13 22:15
02/05/13 22:15
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
@milaz: I don't get it, sorry. Where is that wait(1) required?


Always learn from history, to be sure you make the same mistakes again...
Re: How to make a timer [Re: Uhrwerk] #416926
02/05/13 22:20
02/05/13 22:20
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
@milaz: while, for and if don't require the { } braces when there is only one instruction that should be included in the according case.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends

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