←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft

»

redstone signal to bootup/start running co...

c1one1's Photo c1one1 25 Jan 2014

So i'm new to computercraft but i've been learning how to use bundled cables with computercraft computers and i'm using it to create a control system for a factory.

right now i'm having the issue that this control program needs to be started manually everytime i load my world.

the program runs on a loop testing against input signals and responding appropriately. (eg. maintaining the temperature of a nuclear reactor) but if the control program isn't running my entire factory could go nuclear

i'm wanting some form of persistent solution. so that whenever i load the world, the control program launches without manual input.

(remembering that i'm not looking for a solution within a program, but to start the program in the first place)
Quote

OReezy's Photo OReezy 25 Jan 2014

Just name the program "startup" then it will start automatically when the computer boots.
Quote

surferpup's Photo surferpup 25 Jan 2014

When you are in the os of the computer, type:

rename myProgramName startup

Whenever the computer restarts or boots up, it will run.
Quote

c1one1's Photo c1one1 26 Jan 2014

thanks you guys...
One side question... is there a way to remotely boot the computer as well?
Quote

surferpup's Photo surferpup 26 Jan 2014

Sure. Wrap a wired or attached computer with peripheral.wrap(). Then call the reboot() function.

local myRemoteComputer = peripheral.wrap("right")
myRemoteComputer.reboot()

See Computer Peripheral Functions.
Edited by surferpup, 26 January 2014 - 10:31 PM.
Quote