Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function idColor(id)
- while id > 11 do
- id = id - 11
- end
- if id == 1 then
- return colors.white
- elseif id == 2 then
- return colors.black
- elseif id == 3 then
- return colors.pink
- elseif id == 4 then
- return colors.magenta
- elseif id == 5 then
- return colors.purple
- elseif id == 6 then
- return colors.blue
- elseif id == 7 then
- return colors.lightBlue
- elseif id == 8 then
- return colors.green
- elseif id == 9 then
- return colors.lime
- elseif id == 10 then
- return colors.yellow
- elseif id == 11 then
- return colors.orange
- end
- end
- function spin(stopnum)
- print("inital stopnum: " .. stopnum)
- stopnum = stopnum + 22
- print("added 2 rounds: " .. stopnum)
- current = 0
- for i=1, stopnum, 1 do
- current = i
- redstone.setOutput("left", false)
- redstone.setBundledOutput("back", 0)
- redstone.setOutput("left", true)
- redstone.setBundledOutput("back", idColor(i))
- time = time + 0.005
- os.sleep(time)
- end
- print("Stopped on " .. stop)
- redstone.setBundledOutput("top", idColor(current))
- redstone.setOutput("left", false)
- os.sleep(5)
- redstone.setBundledOutput("back", 0)
- redstone.setOutput("back", false)
- redstone.setOutput("right", true)
- os.sleep(0.2)
- redstone.setBundledOutput("top", 0)
- redstone.setOutput("right", false)
- return true
- end
- function main()
- while true do
- os.sleep(0.1)
- redstone.setOutput("left", false)
- if redstone.getInput("bottom") then
- print("Spinning")
- time = 0.1
- stop = math.random(110)
- if stop == 99 then
- stop = 7
- elseif stop >= 70 and stop < 80 then
- stop = stop - math.random(30)
- stop = stop - 10
- else
- stop = math.floor(stop / 10)
- spin(stop)
- os.sleep(5)
- end
- end
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement