Advertisement
Guest User

startup

a guest
Apr 24th, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.27 KB | None | 0 0
  1. rednet.open( "right" )
  2.  
  3.  
  4.  
  5. function refuel()
  6. r=turtle.refuel()
  7. end
  8.  
  9.  
  10. function sobe(n)
  11. for i= 1,n,1 do
  12. a=peripheral.call("left","move",1,false,false)
  13. if a then
  14. b=turtle.up()
  15. if b==false then
  16. tomove=1
  17. refuel()
  18. end
  19.  end
  20. sleep(0.96)
  21. end
  22. end
  23.  
  24.  
  25. function desce(z)
  26. for i= 1,z,1 do
  27. a=peripheral.call("left","move",0,false,false)
  28. if a then
  29. b=turtle.down()
  30. if b==false then
  31. tomove=-1
  32. refuel()
  33. end
  34.  end
  35. sleep(0.96)
  36. end
  37. end
  38.  
  39.  
  40. function irpara(an)
  41. if tonumber(an)>tonumber(andar) then
  42. local paradescer= tonumber(an)-tonumber(andar)
  43. desce(paradescer*5)
  44. irp=false
  45. andar= an
  46. elseif tonumber(an)<tonumber(andar) then
  47. local parasubir= tonumber(andar)-tonumber(an)
  48. sobe(parasubir*5)
  49. irp=false
  50. andar= an
  51. end
  52. end
  53.  
  54.  
  55.  
  56. while true do
  57.  
  58.  
  59.  
  60. term.clear()
  61. if andar then
  62. print("==========================================")
  63. print("==   ~>> PRO ELEVATOR 2.0 BY JOE <<~   ===")
  64. print("====  =[Deseja ir para qual andar?]=  ====")
  65. print("==========================================")
  66. irp=read()
  67. irpara(irp)
  68.  
  69.  
  70. else
  71. print("==========================================")
  72. print("==   ~>> PRO ELEVATOR 2.0 BY JOE <<~   ===")
  73. print("====     =[Em que andar estamos?]=    ====")
  74. print("==========================================")
  75. andar=read()
  76. term.clear()
  77. end
  78.  
  79. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement