Mange

railrun

Nov 17th, 2012
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. -- variable declarations
  2. location = {"Dav","Orrnos","Dani","Mange","Helnrei/Bagger","Slew/Akeroh","City","FantaCWriteR Subway","FantaCWriter Tower","Xerxus","Sriseru","Ke6lgr/","Talon","Callak"}
  3. freqloc = {"red","magenta","pink","brown","orange","yellow","lime","green","gray","light blue","cyan","blue","purple","light gray"}
  4. colorcode = {16384,4,64,4096,2,16,32,8192,128,8,512,2048,1024,256}
  5. x = 0
  6. north = false
  7. east = false
  8. returneast = false
  9. west = false
  10. returnwest = false
  11.  
  12. -- user prompting...note 14 is changed for number of locations
  13. term.clear() -- Clears the screen
  14. term.setCursorPos(1,1) -- Fixes the cursor position
  15. print("Hello. Please choose a destination by number:")
  16. repeat
  17. x=x+1
  18. print (x..": "..location[x])
  19. until x == 14
  20.  
  21. -- user input
  22. input = 0
  23. repeat
  24. input = tonumber(io.read())
  25. if (input <= 0) then
  26. print("Please choose by number.")
  27. elseif (input >x) then
  28. print("Please choose by number.")
  29. elseif (input == nil) then
  30. print("Please choose by number.")
  31. end
  32. until (input <= x) and (input >0)
  33.  
  34. -- assigning frequencies
  35. color = freqloc[input]
  36. freq = 1042 + input
  37. if freq >= 1043 and freq <= 1047 then north = true
  38. end
  39. if freq >= 1056 and freq <= 1058 then east = true
  40. end
  41. if freq > 1052 then west = true
  42. end
  43.  
  44. -- send pulses
  45. -- shell.run("redpulse","back",color,1,0.5)
  46. rs.setBundledOutput("back",colorcode[input])
  47. sleep(1)
  48. rs.setBundledOutput("back",0)
  49. if east then shell.run("redpulse","left",1,0.5)
  50. end
  51. if west then shell.run("redpulse","right",1,0.5)
  52. end
  53. if north or west then shell.run("redpulse","top",1,0.5)
  54. end
  55. print("Please proceed to cart launch and enjoy your journey.")
  56. -- check for east-west passage
  57. -- if east or west then
  58. -- if east then while not returneast do
  59. -- probe = shell.run("redprobe")
  60. -- if (probe == "back = 1 (white)") then returneast = true
  61. -- end
  62. -- end
  63. -- elseif west then while not returnwest do
  64. -- probe = shell.run("redprobe")
  65. -- if (probe == "back = 32768 (black)") then returnwest = true
  66. -- end
  67. -- end
  68. -- end
  69. -- end
Advertisement
Add Comment
Please, Sign In to add comment