Advertisement
Mr_redstone5230

RedNote API

Oct 23rd, 2019
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. -- The function
  2. function redstoneSound(note,instrument)
  3. if note > 23 then
  4. return printError("You can't have more than 23 notes on 1 instrument !\n(Notes are going from 0 to 23)")
  5. end
  6. if instrument > 5 then
  7. return printError("There is no more than 5 instruments !")
  8. end
  9. redstone.setAnalogOutput("bottom",0)
  10. instrument = instrument - 1
  11. if note > 15 then
  12. notePlus = note - 16
  13. redstone.setAnalogOutput("top",notePlus)
  14. redstone.setAnalogOutput("left",15)
  15. else
  16. redstone.setAnalogOutput("left",note)
  17. end
  18. redstone.setAnalogOutput("back",instrument)
  19. redstone.setAnalogOutput("bottom",1)
  20. sleep(0.1)
  21. redstone.setAnalogOutput("top",0)
  22. redstone.setAnalogOutput("left",0)
  23. redstone.setAnalogOutput("back",0)
  24. redstone.setAnalogOutput("bottom",0)
  25. end
  26. --
  27.  
  28. --Exemple command: redstoneSound(10,5) is going to play the note #10 with the fifth instrument
  29. --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement