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

my code notworking! [try to control draconic reactor with computercraft]

Started by armkrub, 12 January 2018 - 09:37 AM
armkrub #1
Posted 12 January 2018 - 10:37 AM
i've trying to coding advance computer to control my draconic reactor with this code


local reactor
reactor = peripheral.wrap("back")
local info
info = reactor.getReactorInfo()
local fluxout
fluxout = peripheral.wrap("right")
local fluxin
fluxin = peripheral.wrap("flux_gate_0")
local fluxoutnow
fluxin.setSignalLowFlow(2147483647)
reactor.chargeReactor()
sleep(2)
fluxin.setSiglanLowFlow(130000)
reactor.activateReactor()
print("finishing  start")
print("Reactor Started")
sleep(1)
print("test")
while true do
info.fuelConversion <= 9331 or ri.fuelConversion <= 9331 or info.status == online do
ri = reactor.getReactorInfo()
fluxoutnow = fluxout.getSignalLowFlow()
if info.temperator <= 7990 then
fluxout.setSignalLowFlow(fluxoutnow+1000)
end
if info.temperator >= 8100 then
fluxout.setSignalLowFlow(fluxoutnow-3000)
end
sleep(1)
end
end
end
reactor.stopReactor()
sleep(10)

my reactor start very well and my code terminated after print("test") and under print("test") not working without error


discord : Wireless_#4024
sorry if my english is suck
Edited on 17 January 2018 - 10:59 AM
Stekeblad #2
Posted 13 January 2018 - 08:12 AM
What is the value of ri.fuelconversion the first time you reach the loop?
You assign it a value first the line after while.
Try calling getReactorInformation once before the while loop and assign the result to ri.

And I think you want sleep(10) inside the loop and not after.
Edited on 13 January 2018 - 07:15 AM