Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- wifi modem test --
- local function openRednet()
- local listOfSides = rs.getSides()
- local listofPossibles = {}
- local counter1 = 0
- while true do
- counter1 = counter1 +1
- if peripheral.isPresent(tostring(listOfSides[counter1])) and peripheral.getType(listOfSides[counter1]) == "modem" then
- table.insert(listofPossibles,tostring(listOfSides[counter1]))
- end
- if counter1 == 6 and table.maxn(listofPossibles) == 0 then
- print("no wifi present")
- return nil
- end
- if counter1 == 6 and table.maxn(listofPossibles) ~= 0 then
- rednet.open(listofPossibles[1])
- return listofPossibles[1]
- end
- end
- end
- modemOn = openRednet()
- if modemOn == nil then
- print("No WIFI Modem")
- print("Will shutdown in 3 seconds")
- sleep(3)
- os.shutdown()
- else
- print("Opened wifi on "..modemOn.." side")
- end
- -- wifi modem test end --
Add Comment
Please, Sign In to add comment