Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function openRednet()
- local listOfSides = rs.getSides()
- for i = 1,6 do
- if peripheral.isPresent(listOfSides[i]) and peripheral.getType(listOfSides[i]) == "modem" then
- rednet.open(listOfSides[i])
- return listOfSides[i]
- end
- end
- end
- modemOn = openRednet()
- if not modemOn then
- print("No WIFI ModemnPress any key to return to menu.")
- os.pullEvent("key")
- return
- else
- print("Opened wifi on "..modemOn.." side")
- end
- term.clear()
- term.setCursorPos(1,1)
- while true do
- e1,e2,e3,e4,e5 = os.pullEvent()
- if e1 == "rednet_message" then
- local sTest = string.sub(e3,1,3)
- if sTest == "WRT" then
- write(string.sub(e3,4,#e3))
- elseif sTest == "CLR" then
- term.clear()
- elseif sTest == "CLL" then
- term.clearline()
- elseif sTest == "SCB" then
- local boolin = string.sub(e3,4,#e3)
- if boolin == "true" then
- term.setCursorBlink(true)
- elseif boolin == "false" then
- term.setCursorBlink(false)
- end
- elseif sTest == "SCP" then
- local curP = textutils.unserialize(string.sub(e3,4,#e3))
- term.setCursorPos(curP[1],curP[2])
- elseif sTest == "GSZ" then -- work on this
- rednet.broadcast("SIZ"..textutils.serialize({term.getSize()}))
- elseif sTest == "GCP" then
- rednet.broadcast("POS"..textutils.serialize({term.getCursorPos()}))
- elseif sTest == "SCR" then
- term.scroll()
- end
- elseif e1 == "key" then
- rednet.broadcast("key"..tostring(e2))
- elseif e1 == "char" then
- rednet.broadcast("cha"..e2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement