Skip to content

Instantly share code, notes, and snippets.

@scruffyfox
Last active September 24, 2024 11:48
Show Gist options
  • Save scruffyfox/f129c210becfca4786c45ab5304b3733 to your computer and use it in GitHub Desktop.
Save scruffyfox/f129c210becfca4786c45ab5304b3733 to your computer and use it in GitHub Desktop.
#
# CASINO
#
OnAction PayUser
Variable Global exists {in1}_points
If 3 {exists} == false
Chat Send "/me Thank you @{in1} for opening a bank account! You have been given a complimentary §25,000"
Variable Global Set {in1}_points 25000
Skip 13
Function ' return { "user": "{in1}", "toPay": parseInt("{in2}") || 0, "verbose": {in3} } '
Variable Global banker
Param Copy amount tmpBankerAmount
Param Subtract tmpBankerAmount {toPay}
Variable Global Set {banker}_points {tmpBankerAmount}
Variable Global Points {user}_points
Param Copy amount tempUserAmount
Param Add tempUserAmount {toPay}
Variable Global Set {user}_points {tempUserAmount}
FormatAmount {tempUserAmount}
Param Copy formatted userFormatted
FormatAmount {tmpBankerAmount}
Param Copy formatted bankerFormatted
If 1 {verbose} = true
Chat Send "/me @{user} You now have §{userFormatted}. The banker now has §{bankerFormatted}."
OnAction FormatAmount
Function 'return { "formatted": (parseInt("{in1}") || 0).toLocaleString(undefined, { minimumFractionDigits: 0 }) }'
OnCommand e 0 !bank !banker
Variable Global banker
FormatAmount {amount}
Chat Send "The banker is currently @{banker} with §{formatted}"
OnCommand e 0 !coins !wallet !balance !points !money
If 4 {after} != ""
Variable Global Points {after}_points
FormatAmount {amount}
Chat Send "/me @{after} currently has §{formatted}."
Exit
Variable Global Points {user}_points
FormatAmount {amount}
Chat Send "/me @{user} You currently have §{formatted}."
OnCommand e 0 !loancoins !givecoins !give
Function 'var data = [after]; return {fromUser: "{user}", toUser: data.split(" ")[0].replace("@", ""), toPay: parseInt(data.split(" ")[1])}'
Variable Global Points {user}_points
If 2 {toPay} <= 0
Chat Send "/me @{user} You can not give a negative amount!"
Exit
If 2 {amount} < {toPay}
Chat Send "/me @{user} You do not have that much to give!"
Exit
If 2 {amount} <= 0
Chat Send "/me @{user} You do not have any money!"
Exit
Variable Global Points {toUser}_points
Param Create userPoints {amount}
Param Add userPoints {toPay}
Variable Global Set {toUser}_points {userPoints}
Variable Global Points {fromUser}_points
Param Create userPoints {amount}
Param Subtract userPoints {toPay}
Variable Global Set {fromUser}_points {userPoints}
FormatAmount {toPay}
Chat Send "/me @{fromUser} you have given @{toUser} §{formatted}."
OnChannelPoint "Free Money"
Function 'return {amount: Math.floor((Math.random() * 23) * 2000)}'
PayUser {user} {amount} true
OnChannelPoint "Lucky Dip"
Function 'return {amount: Math.floor(Math.random() * 20000), win: Math.floor(Math.random() * 100) >= 50}'
If 4 {win} == true
PayUser {user} {amount} false
FormatAmount {toPay}
Chat Send '/me @{user} You won §{formatted}!'
Exit
Chat Send '/me @{user} You get nothing! You lose! Good day!'
OBS SceneSource "Clips" youlose on
Delay 4
OBS SceneSource "Clips" youlose off
OnCommand e 0 !gamble
Variable Global Points {user}_points
Param Create userPoints {amount}
Function 'var p = Math.abs(parseInt([after].split(" ")[0])); return {invalid: (Math.abs(p) || 0) < 0 || (Math.abs(p) || 0) > parseInt({amount}) && [after].split(" ")[0].indexOf("%") == -1};'
If 2 {invalid} == true
Chat Send "/me @{user} you do not have that much to gamble!"
Exit
If 2 {amount} <= 0
Chat Send "/me @{user} you do not have any money. Buy coins via the Channel Point redemption."
Exit
Variable Global banker
Param Create bankerPoints {amount}
Function 'var input = [after].split(" ")[0]; var a = input.indexOf("%") > -1 ? Math.floor((Math.abs(Math.min(parseInt(input), 100)) / 100) * {userPoints}) : parseInt(Math.abs(input)) || 1000; var t = input == "all" ? {userPoints} : a; var c = {bankerPoints} > t; return {amount: t, win: Math.floor(Math.random() * 130) % 3 == 0}'
If 9 {win} == true
Param Create userPoints {amount}
PayUser {user} {amount} false
FormatAmount {userPoints}
Chat Send "/me @{user} you gambled and won §{formatted}!"
Variable Global Load topscore
If 2 {amount} > {topscore}
Variable Global Set topscore {amount}
Variable Global Set topscore_user "{user}"
Skip 4
Param Create userPoints {amount}
PayUser {user} -{userPoints} false
FormatAmount {userPoints}
Chat Send "/me @{user} you gambled and lost your §{formatted}!"
OnCommand e 20 !slots
Variable Global Points {user}_points
If 2 {amount} <= 0
Chat Send "/me @{user} you do not have any money. Buy coins via the Channel Point redemption."
Exit
Function 'var emotes = ["scruff72Zoom", "scruff72FoxSpoon", "scruff72FoxSpin", "scruff72FoxSpun", "scruff72FoxSpan", "scruff72Wave", "scruff72Loki", "scruff72Happy", "scruff72HuskPop"]; var i1 = emotes.length * Math.random() | 0; var i2 = emotes.length * Math.random() | 0; var i3 = emotes.length * Math.random() | 0; var slots = [emotes[i1], emotes[i2], emotes[i3]]; return {result: slots[0] + " | " + slots[1] + " | " + slots[2], win:[...new Set(slots)].length == 2, jackpot: slots[0] == slots[1] && slots[1] == slots[2], emote: slots[0], emoteIndex1: i1, emoteIndex1: i2, emoteIndex1: i3, payAmount: 5000 + (10 * i1 *i2 * i3)}'
If 9 {win} == true
PayUser {user} {payAmount} false
FormatAmount {payAmount}
Chat Send "/me @{user} you rolled {result} and won §{formatted}!"
Variable Global Load topscore
If 2 {payAmount} > {topscore}
Variable Global Set topscore {payAmount}
Variable Global Set topscore_user "{user}"
CheckDeficit {user}
Exit
If 11 {jackpot} == true
Variable Global Load SlotsJackpot
PayUser {user} {SlotsJackpot} false
FormatAmount {SlotsJackpot}
Chat Send "/me @{user} you rolled {result} and won a jackpot of §{formatted}!"
Chat Send "!scroll {emote} {emote} {emote} JACKPOT! @{user} JACKPOT! {emote} {emote} {emote} "
Variable Global Set SlotsJackpot 0
Variable Global Load topscore
If 2 {SlotsJackpot} > {topscore}
Variable Global Set topscore {SlotsJackpot}
Variable Global Set topscore_user "{user}"
Exit
PayUser {user} -1000 false
Variable Global Load SlotsJackpot
Param Copy SlotsJackpot tmpSlotsJackpot
Param Add tmpSlotsJackpot 1000
Variable Global Set SlotsJackpot {tmpSlotsJackpot}
FormatAmount {SlotsJackpot}
Chat Send "/me @{user} you rolled {result} and lost §1,000. Jackpot now at §{formatted}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment