Guest User

screen

a guest
Apr 28th, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.17 KB | None | 0 0
  1. -- Wrap the modem and monitor
  2. local mon = peripheral.wrap("top")
  3. local wmod = peripheral.wrap("back")
  4.  
  5. -- Open different channels for different liquids
  6. wmod.open(3) --For Lava Tank
  7. wmod.open(4) --For Oil Tank
  8. wmod.open(5) --For Fuel Tank
  9. wmod.open(6) --For OtherTanks
  10.  
  11. mon.clear()
  12. mon.setCursorPos(1,1)
  13. mon.write("Liquid status:")
  14.  
  15. -- Main loop, never stop
  16. while true do
  17.  
  18.   -- Check for incoming data on any open channel
  19.   local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
  20.  
  21.   -- Add one case for every liquid
  22.   -- Change channel and text for each
  23.  
  24.   if senderChannel == 3 then
  25.     mon.setCursorPos(1,2)
  26.     mon.write(message .."        ")
  27.     print(message .." from Lava tank,")
  28.   elseif senderChannel == 4 then
  29.     mon.setCursorPos(1,3)
  30.     mon.write(message .."        ")
  31.     print(message .." from Oil tank.")
  32.   elseif senderChannel == 5 then
  33.     mon.setCursorPos(1,4)
  34.     mon.write(message .."        ")
  35.     print(message .." from Fuel tank,")
  36.   elseif senderChannel == 6 then
  37.     mon.setCursorPos(1,5)
  38.     mon.write(message .."        ")
  39.     print(message .." from Other tanks,")  
  40.   end
  41.  
  42. end
Advertisement
Add Comment
Please, Sign In to add comment