Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sFile = "casino"
- fileread = assert(fs.open(sFile, "r"))
- casinomoney = fileread.readLine()
- fileread.close()
- money = 25
- select = 1
- function animationspin(num)
- num = num +24
- timesspun = math.random(2, 4)
- for i = 1, timesspun do
- term.setCursorPos(num, 2)
- if term.isColor then
- term.setTextColor(colors.blue)
- end
- write("7")
- os.sleep(0.2)
- term.setCursorPos(num, 2)
- if term.isColor then
- term.setTextColor(colors.red)
- end
- write("C")
- os.sleep(0.2)
- term.setCursorPos(num, 2)
- if term.isColor then
- term.setTextColor(colors.green)
- end
- write("L")
- os.sleep(0.2)
- term.setCursorPos(num, 2)
- if term.isColor then
- term.setTextColor(colors.yellow)
- end
- write("L")
- os.sleep(0.2)
- term.setCursorPos(num, 2)
- if term.isColor then
- term.setTextColor(colors.purple)
- end
- write("G")
- term.setTextColor(colors.white)
- end
- end
- function spingraphics()
- animationspin(1)
- if spinned == 1 then
- term.setCursorPos(25, 2)
- if term.isColor then
- term.setTextColor(colors.green)
- end
- write("L")
- end
- if spinned == 2 then
- term.setCursorPos(25, 2)
- if term.isColor then
- term.setTextColor(colors.red)
- end
- write("C")
- end
- if spinned == 3 then
- term.setCursorPos(25, 2)
- if term.isColor then
- term.setTextColor(colors.yellow)
- end
- write("L")
- end
- if spinned == 4 then
- term.setCursorPos(25, 2)
- if term.isColor then
- term.setTextColor(colors.blue)
- end
- write("7")
- end
- if spinned == 5 then
- term.setCursorPos(25, 2)
- if term.isColor then
- term.setTextColor(colors.purple)
- end
- write("G")
- end
- animationspin(2)
- if spinned2 == 1 then
- term.setCursorPos(26, 2)
- if term.isColor then
- term.setTextColor(colors.green)
- end
- write("L")
- end
- if spinned2 == 2 then
- term.setCursorPos(26, 2)
- if term.isColor then
- term.setTextColor(colors.red)
- end
- write("C")
- end
- if spinned2 == 3 then
- term.setCursorPos(26, 2)
- if term.isColor then
- term.setTextColor(colors.yellow)
- end
- write("L")
- end
- if spinned2 == 4 then
- term.setCursorPos(26, 2)
- if term.isColor then
- term.setTextColor(colors.blue)
- end
- write("7")
- end
- if spinned2 == 5 then
- term.setCursorPos(26, 2)
- if term.isColor then
- term.setTextColor(colors.purple)
- end
- write("G")
- end
- animationspin(3)
- if spinned3 == 1 then
- term.setCursorPos(27, 2)
- if term.isColor then
- term.setTextColor(colors.green)
- end
- write("L")
- end
- if spinned3 == 2 then
- term.setCursorPos(27, 2)
- if term.isColor then
- term.setTextColor(colors.red)
- end
- write("C")
- end
- if spinned3 == 3 then
- term.setCursorPos(27, 2)
- if term.isColor then
- term.setTextColor(colors.yellow)
- end
- write("L")
- end
- if spinned3 == 4 then
- term.setCursorPos(27, 2)
- if term.isColor then
- term.setTextColor(colors.blue)
- end
- write("7")
- end
- if spinned3 == 5 then
- term.setCursorPos(27, 2)
- if term.isColor then
- term.setTextColor(colors.purple)
- end
- write("G")
- end
- term.setTextColor(colors.white)
- term.setCursorPos(1, 4)
- end
- function rawspin(slot)
- spinr = math.random(1, 20)
- if spinr == 7 then
- if slot == 1 then
- spinned = 4
- end
- if slot == 2 then
- spinned2 = 4
- end
- if slot == 3 then
- spinned3 = 4
- end
- end
- if spinr == 1 or spinr == 2 or spinr == 3 or spinr == 4 or spinr == 5 then
- if slot == 1 then
- spinned = 1
- end
- if slot == 2 then
- spinned2 = 1
- end
- if slot == 3 then
- spinned3 = 1
- end
- end
- if spinr == 6 or spinr == 8 or spinr == 9 or spinr == 10 or spinr == 11 or spinr == 12 then
- if slot == 1 then
- spinned = 2
- end
- if slot == 2 then
- spinned2 = 2
- end
- if slot == 3 then
- spinned3 = 2
- end
- end
- if spinr == 13 or spinr == 14 or spinr == 15 or spinr == 16 or spinr == 17 then
- if slot == 1 then
- spinned = 3
- end
- if slot == 2 then
- spinned2 = 3
- end
- if slot == 3 then
- spinned3 = 3
- end
- end
- if spinr == 18 or spinr == 19 or spinr == 20 then
- if slot == 1 then
- spinned = 5
- end
- if slot == 2 then
- spinned2 = 5
- end
- if slot == 3 then
- spinned3 = 5
- end
- end
- end
- function match()
- matched = 0
- if spinned == 1 and spinned2 == 1 and spinned3 == 1 then
- matched = 1
- end
- if spinned == 2 and spinned2 == 2 and spinned3 == 2 then
- matched = 2
- end
- if spinned == 3 and spinned2 == 3 and spinned3 == 3 then
- matched = 3
- end
- if spinned == 4 and spinned2 == 4 and spinned3 == 4 then
- matched = 4
- end
- if spinned == 5 and spinned2 == 5 and spinned3 == 5 then
- matched = 5
- end
- if spinned == 2 and spinned2 == 2 or spinned == 2 and spinned3 == 2 or spinned2 == 2 and spinned3 == 2 then
- matched = 2
- end
- end
- function prize()
- if casinomoney == 0 then
- print("The casino is bankrupt!")
- spinagain = 0
- else
- crprize = 0
- if matched == 1 or matched == 2 or matched == 3 or matched == 4 or matched == 5 then
- if matched == 2 then
- crprize = 10
- money = money +10
- casinomoney = casinomoney -10
- elseif matched == 1 then
- crprize = 25
- money = money +25
- casinomoney = casinomoney -25
- elseif matched == 3 then
- crprize = 30
- money = money +30
- casinomoney = casinomoney -30
- elseif matched == 4 then
- crprize = 500
- money = money +500
- casinomoney = casinomoney -500
- elseif matched == 5 then
- crprize = 75
- money = money +75
- casinomoney = casinomoney -75
- end
- end
- end
- end
- spinagain = 1
- while spinagain == 1 do
- num = 0
- print("Type: yes if you want to spin again!")
- again = read()
- if again == "Yes" or again == "y" or again == "yes" or again == "YES" or again == "yeah" or again == "yesh" or again == "YEAH" or again == "Yeah" or again == "YESH" or again == "Yesh" then
- spinagain = 1
- else
- spinagain = 0
- end
- term.clear()
- if money == 0 then
- print("You are bankrupt!")
- spinagain = 0
- end
- if spinagain == 1 then
- money = money -5
- casinomoney = casinomoney +5
- end
- if spinagain == 1 then
- rawspin(1)
- rawspin(2)
- rawspin(3)
- match()
- prize()
- spingraphics()
- print("You won: ")
- print(crprize)
- print("Money: ")
- print(money)
- end
- end
- print("Goodbye!")
- fwrite = fs.open(sFile, "w")
- fwrite.write(casinomoney)
- fwrite.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement