carydavid85

Portal v1.0

Jan 6th, 2016
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. os.loadAPI("button")
  2. m=peripheral.wrap("top")
  3. m.clear()
  4. dial=peripheral.wrap("ep_dialling_device_0")
  5.  
  6. portals=dial.getStoredCount()
  7.  
  8. for i=0,portals-1,1 do
  9. if dial.getStoredName(i)=="Hiler's" then
  10. hilers=i
  11. --print("hiler=" .. i)
  12. end
  13. if dial.getStoredName(i)=="Garm's" then
  14. garms=i
  15. --print("garm=" .. i)
  16. end
  17. if dial.getStoredName(i)=="Space" then
  18. spaces=i
  19. --print("space=" .. i)
  20. end
  21. if dial.getStoredName(i)=="Moon" then
  22. moons=i
  23. --print("moon=" .. i)
  24. end
  25. end
  26.  
  27.  
  28. function fillTable()
  29. button.setTable("Hiler", hiler, 2, 10, 2, 4)
  30. button.setTable("Garm", garm, 2, 10, 6, 8)
  31. button.setTable("Moon", moon, 2, 10, 10, 12)
  32. button.setTable("Space", space, 2, 10, 14, 16)
  33. button.screen()
  34. end
  35.  
  36. function getClick()
  37. event,side,x,y = os.pullEvent("monitor_touch")
  38. button.checkxy(x,y)
  39. end
  40.  
  41. function hiler()
  42. print("Hiler")
  43. button.flash("Hiler")
  44. dial.dialStored(hilers)
  45. sleep(3)
  46. dial.terminate()
  47. end
  48.  
  49. function garm()
  50. print("Garm")
  51. button.flash("Garm")
  52. dial.dialStored(garms)
  53. sleep(3)
  54. dial.terminate()
  55. end
  56.  
  57. function space()
  58. print("Space")
  59. button.flash("Space")
  60. dial.dialStored(spaces)
  61. sleep(3)
  62. dial.terminate()
  63. end
  64.  
  65. function moon()
  66. print("moon")
  67. button.flash("Moon")
  68. dial.dialStored(moons)
  69. sleep(3)
  70. dial.terminate()
  71. end
  72.  
  73. fillTable()
  74. while true do
  75. getClick()
  76. end
Add Comment
Please, Sign In to add comment