This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Lithia's profile picture

Terminating a Program VIA Code

Started by Lithia, 21 January 2013 - 02:07 AM
Lithia #1
Posted 21 January 2013 - 03:07 AM
Is there a way to Terminate a program like holding down CTRL_T in code?
For example
terminate()

it need it because i need to END the tree of programs i am running on my PC

I have tried
break()
error()
and also exit()

none of these terminate the background program

if you guys want to test code on my project

use
pastebin get RP4QxT7X lithium
lithium

I am trying to get override program in /system/override when booted by /system/menu
remiX #2
Posted 21 January 2013 - 03:08 AM
error() should work? Maybe try error("must stop")

Else try shell.exit()? Or return..
Lithia #3
Posted 21 January 2013 - 03:19 AM
error() should work? Maybe try error("must stop")

Else try shell.exit()? Or return..

Hah…
Im trying to exit from your GUI thingy :)/> its amazing ^_^/>
and ill try those :P/>

problem is when i error("stopping program") on your OS it returns back to the OS thing it goes straight back to the OS not the Command line

and yeah ill try those
remiX #4
Posted 21 January 2013 - 03:22 AM
From my Sample OS? Haha good to know people use it :P/>

From which part are you attempting to exit from?

If it's in a loop, you can make the variable mainProg = false which is the main loop for the program
Lithia #5
Posted 22 January 2013 - 12:32 AM
From my Sample OS? Haha good to know people use it :P/>

From which part are you attempting to exit from?

If it's in a loop, you can make the variable mainProg = false which is the main loop for the program

So that will stop it from reverting back to Your Sample OS?

:)/> ill try that ^-^

Also yeah i am lovin the sample OS
Lithia #6
Posted 22 January 2013 - 01:07 AM
When i changed the mainProg = true
to mainProg = false
the OS wont even start anymore
remiX #7
Posted 22 January 2013 - 01:33 AM
When i changed the mainProg = true
to mainProg = false
the OS wont even start anymore

Oh you thought I meant from the top of the line :P/> Nono…

put this line where you want it to stop
mainProg = false

but also tell me what it is doing when you're wanting it to exit which you might need to break another loop or something.
FuuuAInfiniteLoop(F.A.I.L) #8
Posted 22 January 2013 - 02:38 AM

function exitprogram()
 [url="http://computercraft.info/wiki/Os.queueEvent"]os.queueEvent[/url]("terminate")
end
Lithia #9
Posted 22 January 2013 - 02:01 PM
When i changed the mainProg = true
to mainProg = false
the OS wont even start anymore

Oh you thought I meant from the top of the line :P/> Nono…

put this line where you want it to stop
mainProg = false

but also tell me what it is doing when you're wanting it to exit which you might need to break another loop or something.

Oh xD
Thanks ill try this