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

Computer ON/OFF switch

Started by unobum03, 14 July 2012 - 02:38 PM
unobum03 #1
Posted 14 July 2012 - 04:38 PM
I was wondering how i can use one computer to turn another computer on and off, i tried myself but i needed to run the program to turn it off, anyone know a code i could use to do this?
ETHANATOR360 #2
Posted 14 July 2012 - 05:08 PM
are your computers conected through redstone or rednet?
MysticT #3
Posted 14 July 2012 - 06:25 PM
You can use the peripheral api, but it only works if the computer is next to the one you need to turn on/off.
Tiin57 #4
Posted 14 July 2012 - 06:46 PM
Edit: That idea was flawed, but here's a new one; make a server/client program. The client stays responsive to server messages, and interprets x message as os.shutdown. Just an idea.
Sxw #5
Posted 15 July 2012 - 01:55 AM
You could have it turn a turtle on that, well, moves to the other comp and turns it on.
Ponder #6
Posted 15 July 2012 - 03:56 PM
Although, it would probably lots of work you could edit the bios.lua in a way that it doesn't automatically starts a prompt when booting (have a look at line 400). You could modify it in a way that it waits until it receives a signal (via rednet/redstone) and only after that start the shell.
It would be a bit cheating though, since technically the computer is running all way time, but it'd work.

EDIT: Want would be even easier (but still some kind of a hack) is just to edit rom/startup (yours would be ok too, but at the point where yours is run, the autorun files will already be ran, so that's not actually what we want) in a way that clears the terminal (to delete the wlecome message) and then have a loop til the computer receives some kind of signal (rednet/redstone). This way the execution of your startup will be delayed until some kind trigger is received and only after your startup is done the shell will be started.
KingMachine #7
Posted 26 July 2012 - 06:16 AM
As much as I like Ponder's thinking, this solution is not applicable to smp unless you're hosting the server and thus deprecated due to it's inability to port.
The turtle idea however is prime. This would be a very efficient way of doing it. Not fast, but it would work. Otherwise you would have to use redstone/rednet to accomplish your task which is also deprecated because it would be taking excess processes or would have to be running in the background of all of your programs (best done using an api).
Ponder #8
Posted 26 July 2012 - 06:54 PM
For my first idea, yeah, that would only work if you have access to /rom, but my second idea should work on SMP, too. You don't have to edit /rom/startup, /startup will do just as well. And you could distribute that startup to other computer via disk or an ingame ftp program.