Author |
Message |
freakysnots
|
Posted: Mon May 19, 2008 6:24 pm Post subject: Exiting Fork |
|
|
Hi guys.
I made this game which requires several fork commands running. When the game finishes, the fork commands are still running causing massive lag, and the game cannot go back to the main screen.
I was wondering if there was a way to end the fork commands when the program is running like a "end fork" or something to that effect.
Thanks.
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
freakysnots
|
Posted: Mon May 19, 2008 6:30 pm Post subject: Re: Exiting Fork |
|
|
Here is the game just in case anyone was wondering what I was talking about.
Description: |
|
Download |
Filename: |
menu.t |
Filesize: |
16.01 KB |
Downloaded: |
80 Time(s) |
|
|
|
|
|
|
Sean
|
Posted: Mon May 19, 2008 6:41 pm Post subject: RE:Exiting Fork |
|
|
Change the Processes to Procedures. The only need for Processes is for Music. And you don't even need it for that.
|
|
|
|
|
|
freakysnots
|
Posted: Mon May 19, 2008 6:51 pm Post subject: RE:Exiting Fork |
|
|
It gives an error "fork argument must be a process"
|
|
|
|
|
|
andrew.
|
Posted: Mon May 19, 2008 7:30 pm Post subject: RE:Exiting Fork |
|
|
Take out fork.
e.g.
Turing: | procedure DoThis
blah blah blah
end DoThis
DoThis |
instead of
Turing: | process DoThis
blah blah blah
end DoThis
fork DoThis |
|
|
|
|
|
|
freakysnots
|
Posted: Mon May 19, 2008 11:09 pm Post subject: RE:Exiting Fork |
|
|
That doesn't work since I want the process running at the same time as the main game.
It will freeze the gameplay and loop that specific code nonstop.
|
|
|
|
|
|
Insectoid
|
Posted: Tue May 20, 2008 7:49 am Post subject: RE:Exiting Fork |
|
|
You don't use individual loops, try one big loop.
code: |
proc movesomething
x += 1
y += 1
end movesomething
proc movesomethingelse
otherx -= 1
othery -= 1
end movesomethingelse
loop
movesomething
movesomethingelse
View.Update
end loop
|
|
|
|
|
|
|
isaiahk9
|
Posted: Tue May 20, 2008 4:10 pm Post subject: RE:Exiting Fork |
|
|
I don't think a fork can be exitted (85% sure).
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
gitoxa
|
Posted: Tue May 20, 2008 8:56 pm Post subject: RE:Exiting Fork |
|
|
In proper coding conventions, a program (subprograms included [procedures, funtions, processes]) are supposed to end when they're reached the bottom of code.
Your process will stop running once it runs out of code to run.
|
|
|
|
|
|
isaiahk9
|
Posted: Wed May 21, 2008 5:48 am Post subject: RE:Exiting Fork |
|
|
I think freakysnots meant if there was just an exit fork command.
AS far as i know, there isn't (besides gitoxa's way which won't work for infinite loops, like music in the main menu). You could put the process in a procedure and exit the procedure.
|
|
|
|
|
|
gitoxa
|
Posted: Wed May 21, 2008 6:06 am Post subject: RE:Exiting Fork |
|
|
You know, there's this crazy command, I'm not sure if you've heard of it, but it exits loops.
There's also this other one, that (get this) stops music!
|
|
|
|
|
|
Clayton
|
Posted: Wed May 21, 2008 8:28 am Post subject: RE:Exiting Fork |
|
|
return
|
|
|
|
|
|
Sean
|
Posted: Wed May 21, 2008 10:49 am Post subject: RE:Exiting Fork |
|
|
And Clayton comes to the rescue. Processes end the same as procedures and loops. You have the two options, return or exit, however return.
When the condition is met in the process then use the return function there.
|
|
|
|
|
|
|