The3vilM0nk3y

Untitled

Jan 29th, 2016
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. chest = peripheral.wrap("back")
  2. dir = "EAST"
  3. chest.pullItem(dir,1)
  4. sleep(1)
  5. local numBooks = #chest.getAllStacks()
  6. print("Portal Randomizer")
  7. print("-----------------")
  8. print("Number of Locations: " .. numBooks)
  9. local useSlot = 1
  10. function showInfo()
  11. local powered = rs.getInput("top")
  12. refreshLine("Powered: " .. tostring(powered),7)
  13. if powered then
  14. refreshLine("Using: " .. useSlot,8)
  15. end
  16. end
  17. function refreshLine(t,l)
  18. term.setCursorPos(1,l)
  19. term.clearLine()
  20. term.setCursorPos(1,l)
  21. term.write(t)
  22. end
  23. while true do
  24. if rs.getInput("top") then
  25. useSlot = math.random(numBooks)
  26. showInfo()
  27. chest.pushItem(dir,useSlot)
  28. sleep(1)
  29. chest.pullItem(dir,1)
  30. else
  31. showInfo()
  32. sleep(1)
  33. end
  34. end
Advertisement
Add Comment
Please, Sign In to add comment