Stopping functions from running

Posted By: Knuckles

Stopping functions from running - 08/27/07 02:47

What syntax do you need to stop a function from running?
Posted By: MMike

Re: Stopping functions from running - 08/27/07 02:48

return to terminate

sleep(time in seconds) to pause..
Posted By: Knuckles

Re: Stopping functions from running - 08/27/07 11:06

So this will only stop it temporarily? not permanently?
What I'm trying to do is stop certain functions from running when a different level is loaded.
Posted By: Shadow969

Re: Stopping functions from running - 08/27/07 11:44

return - terminate function(stops it permanently)
wait(), sleep() - pause function
Posted By: Scorpion

Re: Stopping functions from running - 08/27/07 12:01

don'T use sleep. sleep is bad, mkay?

you can also use proc_kill to terminate a function
Posted By: Knuckles

Re: Stopping functions from running - 08/27/07 13:06

alright, if I use the proc_kill and/or return terminate functions can I call these terminated functions again when a particular the level loads again?
Posted By: MMike

Re: Stopping functions from running - 08/27/07 15:05

well depends, starting the function from the beginning, yes .. from a middle point .. im not sure.. since it has to be called again dosomething(); :
Posted By: vlau

Re: Stopping functions from running - 08/27/07 15:50

Maybe simply to use a flag to control the function
execution like :

Code:

var status = on;

function someFunction()
{
if (status == on)
{
// function contents
//....
}
}


Posted By: Knuckles

Re: Stopping functions from running - 08/27/07 16:53

Yes, that was something that I had in mind. Basically I want certain functions related to a certain level to stop running when the player is not on that level. Then when the player returns to the level again, the functions run again from the beginning.

When using flags like the one above, will the functions keep running once they are triggered whether the flag is on or not?

Right now, my program has been getting errors while it's running as soon as I change a level. It's trying to still call functions related to the old level and I want it to stop.
Posted By: xXxGuitar511

Re: Stopping functions from running - 08/27/07 16:57

Code:

while(1)
{
if (player)
{
// do whatever
}
//
wait(1);
}


Posted By: Knuckles

Re: Stopping functions from running - 08/28/07 05:26

hmm.. it's still not working for me... What if I were to just stop all functions from a certain WDL file from running? how do I do that? I realize I have to include it at the top of the program, so how do you make it so you can include and not include the wdl file at different times?
© 2024 lite-C Forums