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

How to run a program with shell.run/os.run without stopping the Parent of the program

Started by MadBudderKing, 10 August 2014 - 01:23 PM
MadBudderKing #1
Posted 10 August 2014 - 03:23 PM
Hi,
I have a question.
How would you run a program using shell.run or os.run without stopping the program that is running that program?
Thanks
-MadBudder
MKlegoman357 #2
Posted 10 August 2014 - 08:04 PM
If you are running on CC 1.6+ then you can use the new multishell multitasking system:


multishell.launch({shell=shell,multishell=multishell}, "rom/programs/fun/worm") --// Launch the "Worm" game passing multishell and shell APIs to it

But if you are running an earlier version of ComputerCraft then it is a little harder, but still achievable using the parallel API.

EDIT: there might be an easier solution for your problem, if could just tell us what you are trying to achieve.
Edited on 10 August 2014 - 06:06 PM
MadBudderKing #3
Posted 10 August 2014 - 09:40 PM
If you are running on CC 1.6+ then you can use the new multishell multitasking system:


multishell.launch({shell=shell,multishell=multishell}, "rom/programs/fun/worm") --// Launch the "Worm" game passing multishell and shell APIs to it

But if you are running an earlier version of ComputerCraft then it is a little harder, but still achievable using the parallel API.

EDIT: there might be an easier solution for your problem, if could just tell us what you are trying to achieve.

Thanks.
How would I use the Parallel API Exactly to do this?
Something like parallel.waitForAny/All(shell.run(whateverProgam))?
MKlegoman357 #4
Posted 10 August 2014 - 10:18 PM
Depends on what you are trying to do. Could you give us a little more information?

Edit: also, what version of CC are you using?
Edited on 10 August 2014 - 08:22 PM
MadBudderKing #5
Posted 10 August 2014 - 10:31 PM
Im using 1.6, Though I might think using parallel Might be mroe efficient on what Im doing.
Im just trying to create a program alike what OneOS can do, switch back between programs And the Desktop.
MKlegoman357 #6
Posted 10 August 2014 - 10:41 PM
Ah, so a Desktop system? Well, for that I would suggest to make your own coroutine management system. Go ahead to the Tutorials subforum, Bubba has written a nice tutorial on coroutines there.
MadBudderKing #7
Posted 10 August 2014 - 11:37 PM
Thanks. After reading that coroutines will be more useful then I thought :)/>
Ill think of the coroutine Managment.
:)/>