--Variables To Store Data For Later UI
local Reactor = peripheral.wrap("right")
local Con_State = false
local FuelAmmount = 0
local WasteAmmount = 0
local CoolantAmmount = 0
local SteamPressure = 0
UpdateBlock = function()
--Updates UI Display
term.clear()
term.setCursorPos(1,1)
--Prints Opening ASCII Graphics Banner
print "---------------------------------------------------"
print "|| Reactor Monitor V0.1a ||"
print "---------------------------------------------------"
term.setCursorPos(1,5)
--States Weather Reactors Active And Status Headers
print ("Active = " .. tostring(Reactor.callRemote("BigReactors-Reactor_0", "getActive")))
print ("Fuel | Waste | Cool | Steam | Temp")
--Shows Fuel Level (Max 48000)
term.setCursorPos(3,7)
for pointer=10, 0, -1 do
if Reactor.callRemote("BigReactors-Reactor_0", "getFuelAmount") >= (pointer * 4800) then
print ("#")
else
print ""
end
end
--Shows Waste Level (Max 48000)
term.setCursorPos(11,7)
for pointer=10, 0, -1 do
if Reactor.callRemote("BigReactors-Reactor_0", "getWasteAmount") >= (pointer * 4800) then
print ("#")
else
print ""
end
end
--Shows Coolant Level (Max 10000)
term.setCursorPos(19,7)
for pointer=10, 0, -1 do
if Reactor.callRemote("BigReactors-Reactor_0", "getCoolantAmount") >= (pointer * 1000) then
print ("#")
else
print ""
end
end
--Shows Steam Level (Max 10000)
term.setCursorPos(27,7)
for pointer=10, 0, -1 do
if Reactor.callRemote("BigReactors-Reactor_0", "getHotFluidAmount") >= (pointer * 1000) then
print ("#")
else
print ""
end
end
term.setCursorPos(35,7)
--Test If Reactor Heat Critical (Max I've Left Is 2800 Before Warning)
while (Reactor.callRemote("BigReactors-Reactor_0", "getFuelTemperature") >= 2800) do
term.clear()
print ("WARNING REACTOR TEMPERATURE HIGH")
end
--Shows Reactor Temperature Level (Max 3000)
for pointer=10, 0, -1 do
--print (tostring(Reactor.callRemote("BigReactors-Reactor_0", "getFuelTemperature")))
if ((Reactor.callRemote("BigReactors-Reactor_0", "getFuelTemperature")) >= (pointer * 300)) then
term.write("It Worked")
term.write("#")
else
print ""
end
end
end--Ensures Connection Available
Con_State = Reactor.callRemote("BigReactors-Reactor_0", "getConnected")
--Test If Connected
if (Con_State == false) then
print ("Error, Please Ensure The Reactor Is Connected")
else
--Runs Program Until Lost Connection
while ((Reactor.callRemote("BigReactors-Reactor_0", "getConnected")) == true) do
--Runs GUI Update
UpdateBlock()
sleep(5)
end
--Ends Program
term.clear()
print "Error, Can't Connect To Reactor"
end
2 replies to this topic
#1
Posted 06 November 2015 - 08:39 AM
With the term.setCursorPos its disposed to ensure the bars are centered under there header, but for example term.setCursorPos(3,5) sets the cursor to position (1,5) instead of having an x position of 3. This program is disposed to monitor a reactor and report back the status to me.
#2
Posted 06 November 2015 - 01:18 PM
After writing the text you passed it, print() moves the cursor to the start of the next line down. You'll hence need to call term.setCursorPos() within your "pointer" loops, eg:
It also looks like if you tweaked this:
... to this:
... then you'd be able to change the likes of this:
... to this:
--Shows Fuel Level (Max 48000)
local fuelAmount = Reactor.callRemote("BigReactors-Reactor_0", "getFuelAmount") -- This check is slow, so best to only perform it once per screen update.
for pointer=10, 0, -1 do
if fuelAmount >= (pointer * 4800) then
term.setCursorPos(3, 17 - pointer)
term.write ("#")
end
end
It also looks like if you tweaked this:
local Reactor = peripheral.wrap("right") -- This is wrapping a wired modem on the side of the computer.
... to this:
local Reactor = peripheral.wrap("BigReactors-Reactor_0") -- This wraps the reactor on the end of the modem.
... then you'd be able to change the likes of this:
Reactor.callRemote("BigReactors-Reactor_0", "getFuelAmount") -- This has the modem call the reactor's function.
... to this:
Reactor.getFuelAmount() -- This calls the reactor's function directly.
Edited by Bomb Bloke, 06 November 2015 - 01:45 PM.
#3
Posted 06 November 2015 - 10:40 PM
sorry i didn't actually think of that, thnx.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











