Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sideofreac
- local sideofmon
- local max
- local min
- local reactor
- local monitor
- local maxstored
- loacl scale
- function createsettings()
- local settings={}
- print("Side of Reactor")
- settings[1]=read()
- print("Side of Monitor:")
- settings[2]=read()
- print("Max Amount of Energy Stored want (in /%):")
- settings[3]=tonumber(read())
- print("Min Amount of Energy Stored you want (in /%):")
- settings[4]=tonumber(read())
- print("Max Amount of Energy Stored of the Reactor (in RF):")
- settings[5]=tonumber(read())
- print("Scale:")
- settings[6]=tonumber(read())
- save(settings,"settings.txt")
- end
- function loadsettings()
- local settings=load("settings.txt")
- sideofreac=settings[1]
- sideofmon=settings[2]
- max=settings[3]
- min=settings[4]
- maxstored=settings[5]
- scale=settings[6]
- end
- function split(inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- t = str
- break
- end
- return t
- end
- function save(table,name)
- local file = fs.open(name,"w")
- file.write(textutils.serialize(table))
- file.close()
- end
- function load(name)
- local file = fs.open(name,"r")
- local data = file.readAll()
- file.close()
- return textutils.unserialize(data)
- end
- function setup()
- local cable=peripheral.wrap("sideofmon")
- local names=cable.getNamesRemote()
- for i=1,#names do
- if string.sub(names[i],1,2)=="mon" then
- monitor=names[i]
- end
- end
- local cable=peripheral.wrap("sideofreac")
- local names=cable.getNamesRemote()
- for i=1,#names do
- if string.sub(names[i],1,2)=="Big" then
- reactor=names[i]
- end
- end
- end
- function display()
- mon=peripheral.wrap(monitor)
- reac=peripheral.wrap(reactor)
- local l,h=mon.getSize()
- local stored=rea.getEnergyStored()
- local info={"","Energy Output:",tostring(rea.getEnergyProducedLastTick()),"","Temperature",split(tostring(rea.getFuelTemperature(),","),"","Fuel Burnout",tostring(rea.getFuelConsumedLastTick())}
- local used=0
- for i=1,#info do
- if used > string.len(info[i]) then
- used = string.len(info[i])
- end
- if i==#info then l-used end
- end
- for i=1,#info do
- mon.write(info[i],1,i)
- end
- end
- local hsize=l*0,60
- local lsize=(h-10)
- ---------------------------------------------------
- if not exist("settings.txt") then
- createsettings()
- end
- loadsettings()
- setup()
- while true do
- display()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement