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

Startup

Started by Apples903, 23 November 2014 - 04:25 PM
Apples903 #1
Posted 23 November 2014 - 05:25 PM
I want to make a start up script that activates other scripts. What do I need to do. I tried Shell.run but that doesnt work either.
Lyqyd #2
Posted 23 November 2014 - 09:06 PM
Please post the code you tried using and any error messages you got while using it.
Apples903 #3
Posted 24 November 2014 - 04:51 AM
print(“Reactor B Status Program Active”)
  • while true do
  • local reactor1 = peripheral.wrap("BigReactors-Reactor_4")
  • local mon = peripheral.wrap("monitor_5")
  • mon.clear()
  • – Begin Reactor 1
  • –mon.setCursorPos(1,1)
  • –mon.setTextColor(colors.white)
  • –mon.write("Reactor #: ")
  • –mon.setTextColor(colors.lime)
  • –mon.write("1")
  • mon.setCursorPos(1,1)
  • mon.setTextColor(colors.white)
  • mon.write("Reactor: ")
  • mon.setTextColor(colors.lime)
  • mon.write(“B”)
  • mon.setCursorPos(1,2)
  • mon.setTextColor(colors.white)
  • mon.write("Active: ")
  • mon.setTextColor(colors.lime)
  • mon.write(reactor1.getActive())
  • mon.setCursorPos(1,3)
  • mon.setTextColor(colors.white)
  • mon.write("RF/T: ")
  • mon.setTextColor(colors.lime)
  • mon.write(math.floor(reactor1.getEnergyProducedLastTick()))
  • mon.setCursorPos(1,4)
  • mon.setTextColor(colors.white)
  • mon.write("RF Stored: ")
  • mon.setTextColor(colors.lime)
  • mon.write(math.floor(reactor1.getEnergyStored()))
  • mon.setCursorPos(1,5)
  • mon.setTextColor(colors.white)
  • mon.write("Casing Heat: ")
  • mon.setTextColor(colors.lime)
  • mon.write(math.floor(reactor1.getCasingTemperature()))
  • mon.setCursorPos(1,6)
  • mon.setTextColor(colors.white)
  • mon.write("Fuel Heat: ")
  • mon.setTextColor(colors.lime)
  • mon.write(math.floor(reactor1.getFuelTemperature()))
  • – End Reactor 1
  • sleep(5)
  • end

print(“Reactor A Status Program Active”)
  • while true do
  • local reactor1 = peripheral.wrap("BigReactors-Reactor_5")
  • local mon = peripheral.wrap("monitor_4")
  • mon.clear()
  • – Begin Reactor 1
  • –mon.setCursorPos(1,1)
  • –mon.setTextColor(colors.white)
  • –mon.write("Reactor #: ")
  • –mon.setTextColor(colors.lime)
  • –mon.write("1")
  • mon.setCursorPos(1,1)
  • mon.setTextColor(colors.white)
  • mon.write("Reactor: ")
  • mon.setTextColor(colors.lime)
  • mon.write(“A”)
  • mon.setCursorPos(1,2)
  • mon.setTextColor(colors.white)
  • mon.write("Active: ")
  • mon.setTextColor(colors.lime)
  • mon.write(reactor1.getActive())
  • mon.setCursorPos(1,3) mon.setTextColor(colors.white)
  • mon.write("RF/T: ")
  • mon.setTextColor(colors.lime)
  • mon.write(math.floor(reactor1.getEnergyProducedLastTick()))
  • mon.setCursorPos(1,4)
  • mon.setTextColor(colors.white)
  • mon.write("RF Stored: ")
  • mon.setTextColor(colors.lime)
  • mon.write(math.floor(reactor1.getEnergyStored()))
  • mon.setCursorPos(1,5)
  • mon.setTextColor(colors.white)
  • mon.write("Casing Heat: ")
  • mon.setTextColor(colors.lime)
  • mon.write(math.floor(reactor1.getCasingTemperature()))
  • mon.setCursorPos(1,6)
  • mon.setTextColor(colors.white)
  • mon.write("Fuel Heat: ")
  • mon.setTextColor(colors.lime)
  • mon.write(math.floor(reactor1.getFuelTemperature()))
  • – End Reactor 1
  • sleep(1)
  • end




print(“Management B Program Active”)
while true do
local reactor = peripheral.wrap(“BigReactors-Reactor_4”)
local low = 100000
local high = 5000000

if reactor.getEnergyStored() <=low then
reactor.setAllControlRodLevels(0)
end

if reactor.getEnergyStored() >=high then
reactor.setAllControlRodLevels(100)
end

sleep(2)

end

not my scripts. all of them are different ones. but i want to run them all at once. and I get no errors its just that doing:

shell.run("ManageA")
shell.run("ManageB")
shell.run("ReactorA")
shell.run("ReactorB")

only does one at a time. it only starts managea. when i term that then it starts manage b.
Bomb Bloke #4
Posted 24 November 2014 - 05:10 AM
Generally, yeah, only one script runs at a time.

If you're on CC 1.6 (or later), you could try multishell - just build an advanced computer and try shell.openTab() instead of shell.run().
Apples903 #5
Posted 24 November 2014 - 07:02 AM
So I would do

shell.openTab("ManageA")
shell.openTab("ManageB")
etc.?
Bomb Bloke #6
Posted 24 November 2014 - 07:38 AM
That's the idea.