Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("back")
- Running = "true"
- -- Try and fetch the previous status --
- if fs.exists("OnlineStatus") then
- StatusReader= fs.open("OnlineStatus", "r")
- Status = StatusReader.readAll()
- if Status == "Off" then
- rs.setOutput("top", true)
- elseif Status == "On" then
- rs.setOutput("top", false)
- end
- StatusReader.close()
- end
- --Try and fetch the previous current mob --
- if fs.exists("OnlineStatus") then
- MobReader = fs.open("CurrentMob", "r")
- Mob = MobReader.readAll()
- if Mob == "Off" then
- rs.setOutput("top", true)
- elseif Mob == "On" then
- rs.setOutput("top", false)
- end
- StatusReader.close()
- end
- function getCurrentMob(Mob)
- print("get current mob")
- end
- function SwitchMob(slot)
- u()
- turtle.suckUp()
- turtle.select(slot)
- turtle.dropUp()
- end
- function RemoveMob()
- turtle.suckUp()
- end
- function handleMessage(Message)
- if(Message == 1) then SwitchMob(1)
- elseif(Message == 2) then SwitchMob(2)
- elseif(Message == 3) then SwitchMob(3)
- elseif(Message == 4) then SwitchMob(4)
- elseif(Message == 5) then SwitchMob(5)
- elseif(Message == 6) then SwitchMob(6)
- elseif(Message == 7) then SwitchMob(7)
- elseif(Message == 8) then SwitchMob(8)
- elseif(Message == 9) then SwitchMob(9)
- elseif(Message == 10) then SwitchMob(10)
- elseif(Message == "Stop") then RemoveMob()
- elseif Message == "off" then
- rs.setOutput("top", true)
- shell.run("delete status")
- ab = fs.open("status", "w")
- ab.write("off")
- ab.close()
- elseif Message == "on" then
- rs.setOutput("top", false)
- shell.run("delete status")
- ab = fs.open("status", "w")
- ab.write("on")
- ab.close()
- end
- end
- repeat
- computerID, Message = rednet.receive()
- handleMessage(Message)
- until Running = "False"
Advertisement
Add Comment
Please, Sign In to add comment