Advertisement
Guest User

select

a guest
Feb 13th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.84 KB | None | 0 0
  1. function idColor(id)
  2.   while id > 11 do
  3.     id = id - 11
  4.   end
  5.  
  6.   if id == 1 then
  7.     return colors.white
  8.   elseif id == 2 then
  9.     return colors.black
  10.   elseif id == 3 then
  11.     return colors.pink
  12.   elseif id == 4 then
  13.     return colors.magenta
  14.   elseif id == 5 then
  15.     return colors.purple
  16.   elseif id == 6 then
  17.     return colors.blue
  18.   elseif id == 7 then
  19.     return colors.lightBlue
  20.   elseif id == 8 then
  21.     return colors.green
  22.   elseif id == 9 then
  23.     return colors.lime
  24.   elseif id == 10 then
  25.     return colors.yellow
  26.   elseif id == 11 then
  27.     return colors.orange
  28.   end
  29. end
  30.  
  31. function spin(stopnum)
  32.   print("inital stopnum: " .. stopnum)
  33.      stopnum = stopnum + 22
  34.   print("added 2 rounds: " .. stopnum)
  35.   current = 0
  36.   for i=1, stopnum, 1 do
  37.     current = i
  38.     redstone.setOutput("left", false)
  39.         redstone.setBundledOutput("back", 0)
  40.     redstone.setOutput("left", true)
  41.         redstone.setBundledOutput("back", idColor(i))
  42.         time = time + 0.005
  43.         os.sleep(time)
  44.   end
  45.     print("Stopped on " .. stop)
  46.   redstone.setBundledOutput("top", idColor(current))
  47.   redstone.setOutput("left", false)
  48.   os.sleep(5)
  49.     redstone.setBundledOutput("back", 0)
  50.   redstone.setOutput("back", false)
  51.   redstone.setOutput("right", true)
  52.   os.sleep(0.2)
  53.   redstone.setBundledOutput("top", 0)
  54.   redstone.setOutput("right", false)
  55.     return true
  56. end
  57.  
  58. function main()
  59.   while true do
  60.     os.sleep(0.1)
  61.     redstone.setOutput("left", false)
  62.     if redstone.getInput("bottom") then
  63.       print("Spinning")
  64.       time = 0.1
  65.             stop = math.random(110)
  66.       if stop == 99 then
  67.         stop = 7
  68.       elseif stop >= 70 and stop < 80 then
  69.         stop = stop - math.random(30)
  70.         stop = stop - 10
  71.       else
  72.         stop = math.floor(stop / 10)
  73.             spin(stop)
  74.         os.sleep(5)
  75.       end
  76.     end
  77.   end
  78. end
  79.  
  80. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement