Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("monitor_0")
- rs.setBundledOutput("bottom", 0)
- --Determin odds (less numbers = higher odds, more numbers = lower odds)
- sm = { 1, 2, 3, 4, 5, 6, 7,}
- mon.setTextScale(1.5)
- --wait screen labels
- label = {one = "Insert One", two = "Iron Ingot", three = "to Spin", four = "Prizes:", five = "Match 2", six = "Diamond", seven = "Match 3", eight = "Emerald", nine = "All 7's", ten = "Octuple Compressed", eleven = "Cobblestone",}
- --idle screen
- function wait()
- mon.clear()
- mon.setCursorPos(3,1)
- mon.write(label.one)
- mon.setCursorPos(3,2)
- mon.write(label.two)
- mon.setCursorPos(3,3)
- mon.write(label.three)
- sleep(3)
- prizes()
- end
- function prizes()
- mon.clear()
- mon.setCursorPos(3,2)
- mon.write(label.four)
- sleep(3)
- mon.clear()
- mon.setCursorPos(3,1)
- mon.write(label.five)
- mon.setCursorPos(3,2)
- mon.write(label.six)
- sleep(3)
- mon.clear()
- mon.setCursorPos(3,1)
- mon.write(label.seven)
- mon.setCursorPos(3,2)
- mon.write(label.eight)
- sleep(3)
- mon.setCursorPos(3,1)
- mon.write(label.nine)
- mon.setCursorPos(1,2)
- mon.write(label.ten)
- mon.setCursorPos(2,3)
- mon.write(label.eleven)
- sleep(3)
- wait()
- end
- --simulates spinning, attach to note blocks
- function spin()
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.magenta))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.magenta))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.lightBlue))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.lightBlue))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.yellow))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.yellow))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.lime))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.lime))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.magenta))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.magenta))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.lightBlue))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.lightBlue))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.yellow))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.yellow))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.lime))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.lime))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.magenta))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.magenta))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.lightBlue))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.lightBlue))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.yellow))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.yellow))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.lime))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.lime))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.pink))
- sleep(0.1)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.pink))
- sleep(0.1)
- end
- --sets slot machine display
- function display()
- mon.clear()
- mon.setCursorPos(3,2)
- mon.write(w1.." | "..w2.." | "..w3)
- sleep(3)
- end
- --sets output for winnings
- function small()
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.gray))
- sleep(0.5)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.gray))
- sleep(1)
- end
- function medium()
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.lightGray))
- sleep(0.5)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.lightGray))
- sleep(1)
- end
- function jackpot()
- rs.setBundledOutput("bottom", colors.combine(rs.getBundledOutput("bottom"), colors.cyan))
- sleep(0.5)
- rs.setBundledOutput("bottom", colors.subtract(rs.getBundledOutput("bottom"), colors.cyan))
- sleep(1)
- end
- --determines if winning or not
- function winnings()
- if w1 == w2 and w2 == w3 then
- mon.clear()
- mon.setCursorPos(3,2)
- mon.write("Winner!")
- medium()
- sleep(2)
- end
- if w1 == w2 then
- mon.clear()
- mon.setCursorPos(3,2)
- mon.write("Winner!")
- small()
- sleep(2)
- end
- if w1 and w2 and w3 == "7" then
- mon.clear()
- mon.setCursorPos(3,2)
- mon.write("JACKPOT!")
- jackpot()
- sleep(2)
- end
- if w1 ~= w2 then
- mon.clear()
- mon.setCursorPos(3,2)
- mon.write("Sorry Try Again")
- sleep(2)
- end
- end
- while true do
- wait()
- --random number generator
- w1 = math.random(#sm)
- w2 = math.random(#sm)
- w3 = math.random(#sm)
- --spin
- if rs.testBundledInput("bottom", colors.white) then
- mon.clear()
- mon.setCursorPos(2,2)
- mon.write("Payment Received.")
- sleep(1)
- mon.clear()
- mon.setCursorPos(3,2)
- mon.write("Spinning..")
- mon.setCursorPos(3,3)
- mon.write("Good Luck!")
- spin()
- display()
- winnings()
- os.reboot()
- end
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment