Kierra

Untitled

Apr 13th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. -- Programme : Transmetteur redstone longue distance via computercraft.
  2. -- Liens : Recepteur redstone longue distance via computer :
  3. -- Bugs connus : Possibilité de bugs dus à l'utilisation de l'API parralels assez merdée.
  4.  
  5. --- Variables ---
  6.  
  7. id = 0
  8. emit = false
  9.  
  10. --- Récupération des variables ---
  11.  
  12. print("Quelle est l'id de l'ordinateur recepteur ?")
  13. id = read
  14. id = tonumber(id)
  15.  
  16. --- Functions ---
  17.  
  18. function detect()
  19. while true do
  20. front = redstone.getInput("front")
  21. if front == nil then
  22. front = false
  23. end
  24. back = redstone.getInput("back")
  25. if back == nil then
  26. back = false
  27. end
  28. left = redstone.getInput("left")
  29. if left == nil then
  30. left = false
  31. end
  32. right = redstone.getInput("right")
  33. if right == nil then
  34. right = false
  35. end
  36. bottom = redstone.getInput("bottom")
  37. if bottom == nil then
  38. bottom = false
  39. end
  40.  
  41. if front or back or left or right or bottom or right == true then
  42. emit = true
  43. else
  44. emit = false
  45. end
  46. end
  47. end
  48.  
  49. function Emit()
  50. while true do
  51. repeat
  52. rednet.send(id, "OK")
  53. until emit == true
  54. end
  55. end
  56.  
  57. function GUI()
  58. while true do
  59. print("Affichage des faces recevant un courant de redstone")
  60. print("Face de devant :"..front)
  61. print("Face de derriere :"..back)
  62. print("Face inferieure:"..bottom)
  63. print("Face latterale gauche :"..left)
  64. print("Face latterale droite :"..right)
  65. term.clear()
  66. sleep(0.5)
  67. end
  68. end
  69.  
  70. --- Programme --
  71.  
  72. detect()
  73. GUI()
Advertisement
Add Comment
Please, Sign In to add comment