Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("bottom")
- local reactor
- reactor = peripheral.wrap("BigReactors-Reactor_1")
- function toggleActive()
- if reactor.getActive()==true then
- reactor.setActive(false)
- else
- reactor.setActive(true)
- end
- end
- function split(str, delim, maxNb)
- if string.find(str, delim) == nil then
- return { str }
- end
- if maxNb == nil or maxNb <1 then
- maxNb = 0
- end
- local result = {}
- local pat = "(.-)"..delim.."()"
- local nb = 0
- local lastPos
- for part, pos in string.gmatch(str,pat) do
- nb = nb+1
- result[nb]=part
- lastPos=pos
- if nb==maxNb then break end
- end
- if nb ~= maxNb then
- result[nb+1] = string.sub(str,lastPos)
- end
- return result
- end
- function round(val, decimal)
- if (decimal) then
- return math.floor( (val * 10^decimal) + 0.5) / (10^decimal)
- else
- return math.floor(val+0.5)
- end
- end
- function writeAt(x,y,text)
- m.setCursorPos(x,y)
- m.write(text)
- end
- function checkMsg()
- local time= os.time()
- local fTime = textutils.formatTime(time,false)
- local event, id, msg = os.pullEvent("rednet_message")
- local Tab = split(msg,"|",2)
- if Tab[1]=="toggleActive" then
- toggleActive()
- end
- end
- print("Program is running <CTRL> <T> to stop")
- while true do
- checkMsg()
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement