1 registered members (AbrahamR),
717
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: how do I tell the program to use a function only every second
[Re: MasterQ32]
#415532
01/19/13 21:41
01/19/13 21:41
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
Maybe you want to run a save-loop run in a seperate function:
void SaveLoop(var wait_time)
{
while(1)
{
save();
wait(-wait_time);
}
}
f.e. call SaveLoop(2); once and save(); gets called every 2 seconds without affecting the rest of your code.
POTATO-MAN saves the day! - Random
|
|
|
Re: how do I tell the program to use a function only every second
[Re: elevationmind]
#415541
01/20/13 00:57
01/20/13 00:57
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
I know and tried that, but it doesn't help me because I don't want the program to wait ten seconds - I want something to happen every x seconds. How do I do that? Do the tutorials. Seriously. http://tutorial.3dgamestudio.net/
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: how do I tell the program to use a function only every second
[Re: Kartoffel]
#415548
01/20/13 11:20
01/20/13 11:20
|
Joined: Nov 2012
Posts: 18 Germany
elevationmind
OP
Newbie
|
OP
Newbie
Joined: Nov 2012
Posts: 18
Germany
|
Maybe you want to run a save-loop run in a seperate function:
void SaveLoop(var wait_time)
{
while(1)
{
save();
wait(-wait_time);
}
}
f.e. call SaveLoop(2); once and save(); gets called every 2 seconds without affecting the rest of your code. Thank you very much! I tryed something simmilar, but my mistake was to call the function in my while(1) - so it was called every few miliseconds. But now I moved it to main and it does exactly what it should! Thanks again!
|
|
|
Re: how do I tell the program to use a function only every second
[Re: Uhrwerk]
#415549
01/20/13 11:24
01/20/13 11:24
|
Joined: Nov 2012
Posts: 18 Germany
elevationmind
OP
Newbie
|
OP
Newbie
Joined: Nov 2012
Posts: 18
Germany
|
I know and tried that, but it doesn't help me because I don't want the program to wait ten seconds - I want something to happen every x seconds. How do I do that? Do the tutorials. Seriously. http://tutorial.3dgamestudio.net/ So I did, but failed to find there anything that would help me. Could you direct me to the part of the information I might have missed that would have helped?
|
|
|
Re: how do I tell the program to use a function only every second
[Re: elevationmind]
#415572
01/20/13 15:02
01/20/13 15:02
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
I think Workshop 10 - Entities is the best one for this. Workshop 2 and 3 are also related to the issue.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
|