Minenat69

Engine clutch

Aug 14th, 2023 (edited)
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. function getnumbersfromtext(txt)
  2. local str = ""
  3. string.gsub(txt, "%d+", function(e) str = str .. e end)
  4. return str;
  5. end
  6.  
  7. function main()
  8. while true do
  9. text = target.getLine(1)
  10. amount = tonumber(getnumbersfromtext(text))
  11. if amount ~= oldAmount then
  12. print(amount)
  13. oldAmount = amount
  14. end
  15.  
  16. if amount == 147456 then
  17. redstone.setOutput(clutchSide, false)
  18. redstone.setOutput("front", false)
  19. else
  20. redstone.setOutput(clutchSide, true)
  21. redstone.setOutput("front", true)
  22. end
  23. sleep(0.2)
  24. end
  25. end
  26.  
  27. oldAmount = -1
  28. target = peripheral.wrap("back")
  29. clutchSide = arg[1]
  30. main()
Advertisement
Add Comment
Please, Sign In to add comment