Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,244 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Stopping functions from running #150453
08/27/07 02:47
08/27/07 02:47
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
What syntax do you need to stop a function from running?

Re: Stopping functions from running [Re: Knuckles] #150454
08/27/07 02:48
08/27/07 02:48
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
return to terminate

sleep(time in seconds) to pause..

Re: Stopping functions from running [Re: MMike] #150455
08/27/07 11:06
08/27/07 11:06
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
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.

Re: Stopping functions from running [Re: Knuckles] #150456
08/27/07 11:44
08/27/07 11:44
Joined: Oct 2006
Posts: 873
S
Shadow969 Offline
User
Shadow969  Offline
User
S

Joined: Oct 2006
Posts: 873
return - terminate function(stops it permanently)
wait(), sleep() - pause function

Re: Stopping functions from running [Re: Shadow969] #150457
08/27/07 12:01
08/27/07 12:01
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
don'T use sleep. sleep is bad, mkay?

you can also use proc_kill to terminate a function

Re: Stopping functions from running [Re: Scorpion] #150458
08/27/07 13:06
08/27/07 13:06
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
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?

Re: Stopping functions from running [Re: Knuckles] #150459
08/27/07 15:05
08/27/07 15:05
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
well depends, starting the function from the beginning, yes .. from a middle point .. im not sure.. since it has to be called again dosomething(); :

Re: Stopping functions from running [Re: MMike] #150460
08/27/07 15:50
08/27/07 15:50
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Maybe simply to use a flag to control the function
execution like :

Code:

var status = on;

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



Re: Stopping functions from running [Re: vlau] #150461
08/27/07 16:53
08/27/07 16:53
Joined: Jul 2006
Posts: 91
Florida, USA
Knuckles Offline OP
Junior Member
Knuckles  Offline OP
Junior Member

Joined: Jul 2006
Posts: 91
Florida, USA
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.

Re: Stopping functions from running [Re: Knuckles] #150462
08/27/07 16:57
08/27/07 16:57
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
Code:

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




xXxGuitar511
- Programmer
Page 1 of 2 1 2

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

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