SHOW:
|
|
- or go back to the newest paste.
| 1 | ;Blackjack, against bot, !bj (start) !hm (hit me) !stand (stand/hold); | |
| 2 | - | ;Made By nick1 for eCasino/JammyPear Original: Weasel/Twango severe edits but I probably still have your shell. |
| 2 | + | ;Made By nick1 for eCasino/JammyPear Original: Weasel/Twango severe edits but I probably still have that shell. |
| 3 | - | on $*:text:/^[!](bj|blackjack)(\s|$)/Si:#eCasino.blackjack: {
|
| 3 | + | ;Another edit February 2014 for Chromatic on qi_interesting justinTV to show cards differently |
| 4 | on $*:text:/^[!](bj|blackjack)(\s|$)/Si:#qi_interesting: {
| |
| 5 | var %Balance = $read(CasinoChips.txt, s, $nick)) | |
| 6 | if ($($+(%,bj.,$nick,.cards),2)) {
| |
| 7 | msg $chan $+($nick,$chr(44)) 2you still have a game in progress! | |
| 8 | msg $chan $+($nick,$chr(44)) 2your cards are: $($+(%,bj.,$nick,.cards),2) = $($+(%,bj.,$nick,.ctotal),2) | |
| 9 | } | |
| 10 | - | msg $chan $nick $+ , 2that is not a valid bet, try $1 10 |
| 10 | + | |
| 11 | msg $chan $nick $+ , 2that is not a valid bet, try $1 10 | |
| 12 | } | |
| 13 | elseif ($2 < 10) {
| |
| 14 | msg $chan $nick $+ , 2the minimum bet is 10 chips. | |
| 15 | } | |
| 16 | elseif ($2 > 500) {
| |
| 17 | msg $chan $nick $+ , 2the maximum bet is 500 chips. | |
| 18 | } | |
| 19 | elseif (!%Balance) {
| |
| 20 | msg $chan $nick $+ , 2you don't have any chips, contact an operator. | |
| 21 | } | |
| 22 | elseif ($2 < 10) {
| |
| 23 | msg $chan $nick $+ , 2the minimum bet is 10 chips. | |
| 24 | } | |
| 25 | elseif ($left($2,1) == $chr(45)) {
| |
| 26 | msg $chan $nick $+ , 2you can not use negative numbers. | |
| 27 | } | |
| 28 | elseif ($2 <= 0) {
| |
| 29 | msg $chan $nick $+ , 2please use a positive number. | |
| 30 | } | |
| 31 | elseif ($2) && (%Balance < $2) {
| |
| 32 | msg $chan $nick $+ , 2you can not wager that much because you only have %Balance chips. | |
| 33 | } | |
| 34 | else {
| |
| 35 | unset $+(%,bj.,$nick,.*) | |
| 36 | set $+(%,bj.,$nick,.bet) $2 | |
| 37 | set $+(%,bj.,$nick,.cards) $instok($($+(%,bj.,$nick,.cards),2),$getcard,1,43) | |
| 38 | set $+(%,bj.,$nick,.cards) $instok($($+(%,bj.,$nick,.cards),2),$getcard,1,43) | |
| 39 | set $+(%,bj.,$nick,.ctotal) $gettotal($($+(%,bj.,$nick,.cards),2)) | |
| 40 | set $+(%,bj.,$nick,.bcards) $instok($($+(%,bj.,$nick,.bcards),2),$getcard,1,43) | |
| 41 | set $+(%,bj.,$nick,.bcards) $instok($($+(%,bj.,$nick,.bcards),2),$getcard,1,43) | |
| 42 | set $+(%,bj.,$nick,.btotal) $gettotal($($+(%,bj.,$nick,.bcards),2)) | |
| 43 | msg $chan $+($nick,$chr(44)) 2your cards are: $($+(%,bj.,$nick,.cards),2) = $($+(%,bj.,$nick,.ctotal),2) | |
| 44 | ;In regular blackjack at this point the game would show you the dealers face card (use $gettok to get the last card) | |
| 45 | - | if ($($+(%,bj.,$nick,.ctotal),2) > 21) {
|
| 45 | + | |
| 46 | - | msg $chan $+(2,$nick) has gone bust and [eCasino] wins ([eCasino] $+ 's score:3 $($+(%,bj.,$nick,.btotal),2) 2- $nick $+ 's score:4 $($+(%,bj.,$nick,.ctotal),2) $+ ) |
| 46 | + | if ($($+(%,bj.,$nick,.ctotal),2) > 21) {
|
| 47 | msg $chan $+(2,$nick) has gone bust and [Qi_bot] wins ([Qi_bot] $+ 's score:3 $($+(%,bj.,$nick,.btotal),2) 2- $nick $+ 's score:4 $($+(%,bj.,$nick,.ctotal),2) $+ ) | |
| 48 | msg $chan $+(2,$nick) you lose $($+(%,bj.,$nick,.bet),2) chips. | |
| 49 | var %chips $calc($read(CasinoChips.txt, s, $nick) - $($+(%,bj.,$nick,.bet),2)) | |
| 50 | write -ds $nick CasinoChips.txt | |
| 51 | - | unset $+(%,bj.,$nick,.*) |
| 51 | + | |
| 52 | unset $+(%,bj.,$nick,.*) | |
| 53 | } | |
| 54 | elseif ($($+(%,bj.,$nick,.ctotal),2) == 21) {
| |
| 55 | - | msg $chan $+(2,$nick) got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2([eCasino] $+ 's score:4 $($+(%,bj.,$nick,.btotal),2) 2- $+($nick,'s) score:3 $($+(%,bj.,$nick,.ctotal),2) $+ ) |
| 55 | + | |
| 56 | msg $chan $+(2,$nick) got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2([Qi_bot] $+ 's score:4 $($+(%,bj.,$nick,.btotal),2) 2- $+($nick,'s) score:3 $($+(%,bj.,$nick,.ctotal),2) $+ ) | |
| 57 | if ($($+(%,bj.,$nick,.btotal),2) == 21) {
| |
| 58 | var %Chips $calc($read(CasinoChips.txt, s, $nick) - $($+(%,bj.,$nick,.bet),2)) | |
| 59 | write -ds $nick CasinoChips.txt | |
| 60 | - | msg $chan 2[eCasino] got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2[eCasino] $+ 's cards:3 $($+(%,bj.,$nick,.bcards),2) |
| 60 | + | |
| 61 | msg $chan 2[Qi_bot] got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2[Qi_bot] $+ 's cards:3 $($+(%,bj.,$nick,.bcards),2) | |
| 62 | msg $chan $+(2,$nick) you lose $($+(%,bj.,$nick,.bet),2) chips. | |
| 63 | unset $+(%,bj.,$nick,.*) | |
| 64 | } | |
| 65 | - | var %chips $calc($read(CasinoChips.txt, s, $nick) + $($+(%,bj.,$nick,.bet),2) * 2) |
| 65 | + | |
| 66 | var %chips $calc($read(CasinoChips.txt, s, $nick) + $($+(%,bj.,$nick,.bet),2) * 2) | |
| 67 | write -ds $+ $nick CasinoChips.txt | |
| 68 | write CasinoChips.txt $nick %Chips | |
| 69 | msg $chan $+(2,$nick) you win $($+(%,bj.,$nick,.bet),2) chips. | |
| 70 | unset $+(%,bj.,$nick,.*) | |
| 71 | } | |
| 72 | } | |
| 73 | } | |
| 74 | alias getcard {
| |
| 75 | - | if (%r = 1) {
|
| 75 | + | |
| 76 | - | return Ace |
| 76 | + | if (%r == 1) { return Ace of $suit }
|
| 77 | elseif (%r == 10) { return 10 of $suit }
| |
| 78 | - | elseif (%r >= 10) {
|
| 78 | + | elseif (%r == 11) { return Jack of $suit }
|
| 79 | - | return 10 |
| 79 | + | elseif (%r == 12) { return Queen of $suit }
|
| 80 | elseif (%r == 13) { return King of $suit }
| |
| 81 | else { return %r of $suit }
| |
| 82 | - | return %r |
| 82 | + | |
| 83 | alias suit {
| |
| 84 | var %r $r(1,4) | |
| 85 | if (%r == 1) { return Spades }
| |
| 86 | elseif (%r == 2) { return Hearts }
| |
| 87 | elseif (%r == 3) { return Diamonds }
| |
| 88 | - | var %tok $gettok($1-,%x,43) |
| 88 | + | elseif (%r == 4) { return Clubs }
|
| 89 | - | if (%tok !isnum) {
|
| 89 | + | |
| 90 | - | var %t $calc(%t + 11) |
| 90 | + | |
| 91 | var %x 1 | |
| 92 | while (%x <= $numtok($1-,43)) {
| |
| 93 | - | var %t $calc(%t + %tok) |
| 93 | + | var %tok $gettok($gettok($1-,%x,43),1,32) |
| 94 | if (%tok == Ace) { var %t $calc(%t + 11) }
| |
| 95 | elseif (%tok == Jack) { var %t $calc(%t + 10) }
| |
| 96 | elseif (%tok == Queen) { var %t $calc(%t + 10) }
| |
| 97 | elseif (%tok == King) { var %t $calc(%t + 10) }
| |
| 98 | else { var %t $calc(%t + %tok) }
| |
| 99 | - | on $*:text:/^[!](hit)(\s|$)/Si:#eCasino.blackjack: {
|
| 99 | + | |
| 100 | } | |
| 101 | return %t | |
| 102 | } | |
| 103 | on $*:text:/^[!](hit)(\s|$)/Si:#qi_interesting: {
| |
| 104 | if (!$($+(%,bj.,$nick,.ctotal),2)) { msg # $nick $+ , 2to start a game type !Blackjack <bet> to start a new game | halt }
| |
| 105 | set $+(%,bj.,$nick,.cards) $instok($($+(%,bj.,$nick,.cards),2),$getcard,1,43) | |
| 106 | set $+(%,bj.,$nick,.ctotal) $gettotal($($+(%,bj.,$nick,.cards),2)) | |
| 107 | msg $chan $+($nick,$chr(44)) 2your cards are: $($+(%,bj.,$nick,.cards),2) = $($+(%,bj.,$nick,.ctotal),2) | |
| 108 | ;Could run a check at this point to see if they got a five card charlie | |
| 109 | - | msg $chan $+(2,$nick) has gone bust and [eCasino] wins ([eCasino] $+ 's score:3 $($+(%,bj.,$nick,.btotal),2) 2- $nick $+ 's score:4 $($+(%,bj.,$nick,.ctotal),2) $+ ) |
| 109 | + | |
| 110 | var %chips $calc($read(CasinoChips.txt, s, $nick) - $($+(%,bj.,$nick,.bet),2)) | |
| 111 | write -ds $nick CasinoChips.txt | |
| 112 | write CasinoChips.txt $nick %chips | |
| 113 | msg $chan $+(2,$nick) has gone bust and [Qi_bot] wins ([Qi_bot] $+ 's score:3 $($+(%,bj.,$nick,.btotal),2) 2- $nick $+ 's score:4 $($+(%,bj.,$nick,.ctotal),2) $+ ) | |
| 114 | - | msg $chan $+(2,$nick) got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2([eCasino] $+ 's score:4 $($+(%,bj.,$nick,.btotal),2) 2- $+($nick,'s) score:3 $($+(%,bj.,$nick,.ctotal),2) $+ ) |
| 114 | + | |
| 115 | unset $+(%,bj.,$nick,.*) | |
| 116 | } | |
| 117 | elseif ($($+(%,bj.,$nick,.ctotal),2) == 21) {
| |
| 118 | msg $chan $+(2,$nick) got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2([Qi_bot] $+ 's score:4 $($+(%,bj.,$nick,.btotal),2) 2- $+($nick,'s) score:3 $($+(%,bj.,$nick,.ctotal),2) $+ ) | |
| 119 | botHits | |
| 120 | - | msg $chan 2[eCasino] got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2[eCasino] $+ 's cards:3 $($+(%,bj.,$nick,.bcards),2) |
| 120 | + | |
| 121 | var %Chips $calc($read(CasinoChips.txt, s, $nick) - $($+(%,bj.,$nick,.bet),2)) | |
| 122 | write -ds $nick CasinoChips.txt | |
| 123 | write CasinoChips.txt $nick %chips | |
| 124 | msg $chan 2[Qi_bot] got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2[Qi_bot] $+ 's cards:3 $($+(%,bj.,$nick,.bcards),2) | |
| 125 | - | var %chips $calc($read(CasinoChips.txt, s, $nick) + $($+(%,bj.,$nick,.bet),2) * 2) |
| 125 | + | |
| 126 | unset $+(%,bj.,$nick,.*) | |
| 127 | } | |
| 128 | else {
| |
| 129 | var %chips $calc($read(CasinoChips.txt, s, $nick) + $($+(%,bj.,$nick,.bet),2) * 2) | |
| 130 | write -ds $+ $nick CasinoChips.txt | |
| 131 | write CasinoChips.txt $nick %Chips | |
| 132 | msg $chan $+(2,$nick) you win $($+(%,bj.,$nick,.bet),2) chips. | |
| 133 | - | on $*:text:/^[!](stand)(\s|$)/Si:#eCasino.blackjack: {
|
| 133 | + | |
| 134 | } | |
| 135 | } | |
| 136 | - | msg $chan $+($nick,$chr(44)) 2your cards are: $($+(%,bj.,$nick,.cards),2) = $($+(%,bj.,$nick,.ctotal),2) [eCasino] $+ 's cards: $($+(%,bj.,$nick,.bcards),2) = $($+(%,bj.,$nick,.btotal),2) |
| 136 | + | |
| 137 | on $*:text:/^[!](stand|stay)(\s|$)/Si:#qi_interesting: {
| |
| 138 | if (!$($+(%,bj.,$nick,.ctotal),2)) { msg # $nick $+ , 2to start a game type !Blackjack <bet> to start a new game | halt }
| |
| 139 | botHits | |
| 140 | msg $chan $+($nick,$chr(44)) 2your cards are: $($+(%,bj.,$nick,.cards),2) = $($+(%,bj.,$nick,.ctotal),2) [Qi_bot] $+ 's cards: $($+(%,bj.,$nick,.bcards),2) = $($+(%,bj.,$nick,.btotal),2) | |
| 141 | - | msg $chan 2[eCasino] has gone bust and $nick wins! ([eCasino] $+ 's score:4 $($+(%,bj.,$nick,.btotal),2) 2- $nick $+ 's score:3 $($+(%,bj.,$nick,.ctotal),2) $+ ) |
| 141 | + | |
| 142 | var %Chips $calc($read(CasinoChips.txt, s, $nick) + $($+(%,bj.,$nick,.bet),2)) | |
| 143 | write -ds $nick CasinoChips.txt | |
| 144 | write CasinoChips.txt $nick %chips | |
| 145 | msg $chan 2[Qi_bot] has gone bust and $nick wins! ([Qi_bot] $+ 's score:4 $($+(%,bj.,$nick,.btotal),2) 2- $nick $+ 's score:3 $($+(%,bj.,$nick,.ctotal),2) $+ ) | |
| 146 | msg $chan $+(2,$nick) you win $($+(%,bj.,$nick,.bet),2) chips. | |
| 147 | unset $+(%,bj.,$nick,.*) | |
| 148 | } | |
| 149 | - | msg $chan 2[eCasino] got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2([eCasino] $+ 's score:3 $($+(%,bj.,$nick,.btotal),2) 2- $+($nick,'s) score:4 $($+(%,bj.,$nick,.ctotal),2) $+ ) |
| 149 | + | |
| 150 | var %Chips $calc($read(CasinoChips.txt, s, $nick) - $($+(%,bj.,$nick,.bet),2)) | |
| 151 | write -ds $nick CasinoChips.txt | |
| 152 | write CasinoChips.txt $nick %chips | |
| 153 | msg $chan 2[Qi_bot] got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2([Qi_bot] $+ 's score:3 $($+(%,bj.,$nick,.btotal),2) 2- $+($nick,'s) score:4 $($+(%,bj.,$nick,.ctotal),2) $+ ) | |
| 154 | msg $chan $+(2,$nick) you lose $($+(%,bj.,$nick,.bet),2) chips. | |
| 155 | unset $+(%,bj.,$nick,.*) | |
| 156 | } | |
| 157 | - | msg $chan $+($nick,2) stands and [eCasino] wins 2([eCasino] $+ 's score:3 $($+(%,bj.,$nick,.btotal),2) 2- $+($nick,'s) score:4 $($+(%,bj.,$nick,.ctotal),2) $+ ) |
| 157 | + | |
| 158 | var %Chips $calc($read(CasinoChips.txt, s, $nick) - $($+(%,bj.,$nick,.bet),2)) | |
| 159 | write -ds $nick CasinoChips.txt | |
| 160 | write CasinoChips.txt $nick %chips | |
| 161 | msg $chan $+($nick,2) stands and [Qi_bot] wins 2([Qi_bot] $+ 's score:3 $($+(%,bj.,$nick,.btotal),2) 2- $+($nick,'s) score:4 $($+(%,bj.,$nick,.ctotal),2) $+ ) | |
| 162 | - | msg $chan $+($nick,2) stands and wins 2([eCasino] $+ 's score:4 $($+(%,bj.,$nick,.btotal),2) 2- $+($nick,'s) score:3 $($+(%,bj.,$nick,.ctotal),2) $+ ) |
| 162 | + | |
| 163 | unset $+(%,bj.,$nick,.*) | |
| 164 | - | var %chips $calc($read(CasinoChips.txt, s, $nick) + $($+(%,bj.,$nick,.bet),2)) |
| 164 | + | |
| 165 | else {
| |
| 166 | msg $chan $+($nick,2) stands and wins 2([Qi_bot] $+ 's score:4 $($+(%,bj.,$nick,.btotal),2) 2- $+($nick,'s) score:3 $($+(%,bj.,$nick,.ctotal),2) $+ ) | |
| 167 | msg $chan $+(2,$nick) you win $($+(%,bj.,$nick,.bet),2) chips. | |
| 168 | var %chips $calc($read(CasinoChips.txt, s, $nick) + $($+(%,bj.,$nick,.bet),2)) | |
| 169 | write -ds $+ $nick CasinoChips.txt | |
| 170 | write CasinoChips.txt $nick %Chips | |
| 171 | unset $+(%,bj.,$nick,.*) | |
| 172 | } | |
| 173 | } | |
| 174 | alias botHits {
| |
| 175 | while ($($+(%,bj.,$nick,.btotal),2) < 17) {
| |
| 176 | set $+(%,bj.,$nick,.bcards) $instok($($+(%,bj.,$nick,.bcards),2),$getcard,1,43) | |
| 177 | set $+(%,bj.,$nick,.btotal) $gettotal($($+(%,bj.,$nick,.bcards),2)) | |
| 178 | } | |
| 179 | } |