Advertisement
totatoto

GeneratePureQuartz

Jan 21st, 2017
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1. os.loadAPI("Chest")
  2. os.loadAPI("Message")
  3. time=0.8
  4.  
  5. wire_side       = "right"
  6. contact_id      = 5
  7. chest_side      = "back"
  8. redstone_dir    = "left"
  9.  
  10. ness=0
  11. nbIn=0
  12. nbDiff=0
  13. chest = Chest.Chest:new(nil,chest_side)
  14. message = Message.Message:new(nil,wire_side,contact_id)
  15.  
  16. while message:receive() ~= "start" do end
  17. sleep(5)
  18.  
  19. while (true)
  20. do
  21.     ness = chest:getDiff()
  22.     nbDiff= ness - nbIn
  23.     if nbDiff ~= 0
  24.     then
  25.         message:send(nbDiff)
  26.         print("Message envoyer : " .. nbDiff)
  27.         nbIn = ness
  28.     end
  29.     if nbIn ~= 0
  30.     then
  31.         mess = message:receive()
  32.         if mess ~= nil
  33.         then
  34.             nbIn = nbIn - mess
  35.             print("Message recu : "..mess)
  36.         end
  37.     end
  38.     sleep(2)
  39.    
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement