1ng0

CC - Teleport Portal Control

May 28th, 2015
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.78 KB | None | 0 0
  1. local portal = peripheral.wrap("right")
  2. local monitor = peripheral.wrap("monitor_1")
  3.  
  4. local w, h = monitor.getSize()
  5.  
  6. newLine = function()
  7. local _,cY = monitor.getCursorPos()
  8. monitor.setCursorPos((w/2)-5,cY+1)
  9. end
  10.  
  11. monitor.setTextScale(2)
  12. local color = colors.black
  13.  
  14. monitor.setBackgroundColor(colors.black)
  15.  
  16. monitor.clear()
  17. monitor.setCursorPos(3,1)
  18.  
  19. for i=0, portal.getStoredCount()-1 do
  20. monitor.setBackgroundColor(color)
  21. color = color/2
  22. monitor.write(" " .. portal.getStoredName(i) .. " ")
  23. newLine()
  24. end
  25.  
  26. while(true) do
  27. ecent, side, xPos, yPos = os.pullEvent("monitor_touch")
  28. portal.terminate()
  29. if yPos == 2 then
  30. portal.dialStored(1)
  31. elseif yPos == 3 then
  32. portal.dialStored(2)
  33. elseif uPos == 4 then
  34. portal.dialStored(3)
  35. end
  36. os.sleep(0.05)
  37. portal.terminate()
  38. end
Add Comment
Please, Sign In to add comment