Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[so how do i get comControl to catch fansOn and lightsOff and put them into
- fanStat and lightStat]]
- rednet.open("back")
- local fanStat
- local lightStat
- local getFanStat = false
- local getLightStat = false
- local who
- local event, param1, param2, param3
- local Keys = {
- [16] = function() --Q
- getFanStat = true
- rednet.broadcast("fansCheck")
- end,
- [17] = function() --W
- rednet.broadcast("fansOn")
- fanStat = true
- end,
- [18] = function() --E
- rednet.broadcast("fansOff")
- fanStat = true
- end,
- [30] = function() --A
- getLightStat = true
- rednet.broadcast("lightsCheck")
- end,
- [31] = function() --S
- rednet.broadcast("lightsOn")
- lightStat = true
- end,
- [32] = function() --D
- rednet.broadcast("lightsOff")
- lightStat = false
- end
- }
- term.setCursorPos(1,1)
- term.clear()
- Keys[16]()
- Keys[30]()
- while true do
- event, param1, param2, param3 = os.pullEvent()
- if event == "rednet_message" then
- local senderID, message = param1, param2
- if getFanStat == true then
- fanStat = message
- if senderID == 4 then
- who = "lights"
- term.setCursorPos(1,1)
- term.clearLine()
- elseif senderID == 5 then
- who = "fans"
- term.setCursorPos(1,2)
- term.clearLine()
- end
- print(who .. " : " .. tostring(message))
- elseif getLightStat == true then
- lightStat = message
- term.clear()
- term.setCursorPos(1,1)
- if senderID == 4 then
- who = "lights"
- term.setCursorPos(1,1)
- term.clearLine()
- elseif senderID == 5 then
- who = "fans"
- term.setCursorPos(1,2)
- term.clearLine()
- end
- print(who .. " : " .. tostring(message))
- end
- elseif event == "key" then
- local key = param1
- if Keys[key] ~= nil then
- Keys[key]()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement