Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("smeltery dings v0.3")
- local monAdr = "back"
- local netSide = "left"
- local RecIds = {5,7,6,9,11,10}
- local RecNames = {"Mixer ","Smeltery ","Storage A ","Storage B ","Ingot Cast","VOID "}
- local RecAct = {false,false,false,false,false,false}
- local RecOptions = {16,0,0,0,0,42}
- local numRec = 6
- --disables
- --ioioio
- --CCBBAA
- RecStatesA = {"-","-","-","-","-","-","-","-"}
- RecStatesB = {"-","-","-","-","-","-","-","-"}
- RecStatesC = {"-","-","-","-","-","-","-","-"}
- rednet.open(netSide)
- rednet.broadcast("533")
- local mon = peripheral.wrap("back")
- mon.setTextScale(1)
- os.queueEvent("monitor_touch",manAdr,111,111)
- while true do
- Event, EventAdress, EventPosX, EventPosY = os.pullEvent("monitor_touch")
- mon.setTextColor(1)
- mon.setCursorPos(1,1)
- mon.setBackgroundColor(512)
- mon.write("Smeltery v0.2 ")
- local RecN
- print(string.format("event: %s adr: %s X: %d Y: %d",Event, EventAdress, EventPosX, EventPosY))
- cur = 1
- while cur <= numRec do
- RecN = cur
- local opts = 0
- print(RecStatesA[RecN])
- if EventPosY == cur+2 then
- if EventPosX <= 10 then
- RecAct[RecN] = not RecAct[RecN]
- end
- if EventPosX == 12 then
- if RecStatesA[RecN] == "-" then
- RecStatesA[RecN] = "i"
- elseif RecStatesA[RecN] == "i" then
- RecStatesA[RecN] = "o"
- elseif RecStatesA[RecN] == "o" then
- RecStatesA[RecN] = "-"
- end
- opts = bit.band(RecOptions[RecN],3)
- if opts == 1 then
- if RecStatesA[RecN] == "i" then
- RecStatesA[RecN] = "o"
- end
- elseif opts == 2 then
- if RecStatesA[RecN] == "o" then
- RecStatesA[RecN] = "-"
- end
- elseif opts == 3 then
- RecStatesA[RecN] = ""
- end
- end
- if EventPosX == 14 then
- if RecStatesB[RecN] == "-" then
- RecStatesB[RecN] = "i"
- elseif RecStatesB[RecN] == "i" then
- RecStatesB[RecN] = "o"
- elseif RecStatesB[RecN] == "o" then
- RecStatesB[RecN] = "-"
- end
- opts = bit.band(RecOptions[RecN],12)
- if opts == 4 then
- if RecStatesB[RecN] == "i" then
- RecStatesB[RecN] = "o"
- end
- elseif opts == 8 then
- if RecStatesB[RecN] == "o" then
- RecStatesB[RecN] = "-"
- end
- elseif opts == 12 then
- RecStatesB[RecN] = ""
- end
- end
- if EventPosX == 16 then
- if RecStatesC[RecN] == "-" then
- RecStatesC[RecN] = "i"
- elseif RecStatesC[RecN] == "i" then
- RecStatesC[RecN] = "o"
- elseif RecStatesC[RecN] == "o" then
- RecStatesC[RecN] = "-"
- end
- opts = bit.band(RecOptions[RecN],48)
- if opts == 16 then
- if RecStatesC[RecN] == "i" then
- RecStatesC[RecN] = "o"
- end
- elseif opts == 32 then
- if RecStatesC[RecN] == "o" then
- RecStatesC[RecN] = "-"
- end
- elseif opts == 48 then
- RecStatesC[RecN] = ""
- end
- end
- --rednet
- magik = 0
- if RecStatesA[RecN] == "-" then
- magik = magik + 1
- elseif RecStatesA[RecN] == "i" then
- magik = magik + 0
- elseif RecStatesA[RecN] == "o" then
- magik = magik + 2
- end
- if RecStatesB[RecN] == "-" then
- magik = magik + 4
- elseif RecStatesB[RecN] == "i" then
- magik = magik + 0
- elseif RecStatesB[RecN] == "o" then
- magik = magik + 8
- end
- if RecStatesC[RecN] == "-" then
- magik = magik + 16
- elseif RecStatesC[RecN] == "i" then
- magik = magik + 0
- elseif RecStatesC[RecN] == "o" then
- magik = magik + 32
- end
- if not RecAct[RecN] then
- magik = 533
- end
- rednet.send(RecIds[RecN],magik)
- end
- mon.setCursorPos(1,cur + 2)
- if RecAct[RecN] then
- mon.setBackgroundColor(colors.green)
- else
- mon.setBackgroundColor(colors.red)
- end
- mon.write(RecNames[RecN])
- mon.setCursorPos(12,cur + 2)
- if RecStatesA[RecN] == "i" then
- mon.setBackgroundColor(colors.green)
- end
- if RecStatesA[RecN] == "o" then
- mon.setBackgroundColor(colors.blue)
- end
- if RecStatesA[RecN] == "-" then
- mon.setBackgroundColor(colors.red)
- end
- mon.write(RecStatesA[RecN])
- mon.setCursorPos(14,cur + 2)
- if RecStatesB[RecN] == "i" then
- mon.setBackgroundColor(colors.green)
- end
- if RecStatesB[RecN] == "o" then
- mon.setBackgroundColor(colors.blue)
- end
- if RecStatesB[RecN] == "-" then
- mon.setBackgroundColor(colors.red)
- end
- mon.write(RecStatesB[RecN])
- mon.setCursorPos(16,cur + 2)
- if RecStatesC[RecN] == "i" then
- mon.setBackgroundColor(colors.green)
- end
- if RecStatesC[RecN] == "o" then
- mon.setBackgroundColor(colors.blue)
- end
- if RecStatesC[RecN] == "-" then
- mon.setBackgroundColor(colors.red)
- end
- mon.write(RecStatesC[RecN])
- cur = cur + 1
- end
- --mon.clear()
- end
Advertisement
Comments
-
- my boss is mad for writing logs and shit like this too, love it tho
Add Comment
Please, Sign In to add comment
Advertisement