Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Blackjack, against bot, !bj (start) !hm (hit me) !stand (stand/hold);
- ;Made By nick1 for eCasino/JammyPear Original: Weasel/Twango severe edits but I probably still have your shell.
- on $*:text:/^[!](bj|blackjack)(\s|$)/Si:#eCasino.blackjack: {
- var %Balance = $read(CasinoChips.txt, s, $nick))
- if ($($+(%,bj.,$nick,.cards),2)) {
- msg $chan $+($nick,$chr(44)) 2you still have a game in progress!
- msg $chan $+($nick,$chr(44)) 2your cards are: $($+(%,bj.,$nick,.cards),2) = $($+(%,bj.,$nick,.ctotal),2)
- }
- elseif ($2 !isnum) {
- msg $chan $nick $+ , 2that is not a valid bet, try $1 10
- }
- elseif ($2 < 10) {
- msg $chan $nick $+ , 2the minimum bet is 10 chips.
- }
- elseif ($2 > 500) {
- msg $chan $nick $+ , 2the maximum bet is 500 chips.
- }
- elseif (!%Balance) {
- msg $chan $nick $+ , 2you don't have any chips, contact an operator.
- }
- elseif ($2 < 10) {
- msg $chan $nick $+ , 2the minimum bet is 10 chips.
- }
- elseif ($left($2,1) == $chr(45)) {
- msg $chan $nick $+ , 2you can not use negative numbers.
- }
- elseif ($2 <= 0) {
- msg $chan $nick $+ , 2please use a positive number.
- }
- elseif ($2) && (%Balance < $2) {
- msg $chan $nick $+ , 2you can not wager that much because you only have %Balance chips.
- }
- else {
- unset $+(%,bj.,$nick,.*)
- set $+(%,bj.,$nick,.bet) $2
- set $+(%,bj.,$nick,.cards) $instok($($+(%,bj.,$nick,.cards),2),$getcard,1,43)
- set $+(%,bj.,$nick,.cards) $instok($($+(%,bj.,$nick,.cards),2),$getcard,1,43)
- set $+(%,bj.,$nick,.ctotal) $gettotal($($+(%,bj.,$nick,.cards),2))
- set $+(%,bj.,$nick,.bcards) $instok($($+(%,bj.,$nick,.bcards),2),$getcard,1,43)
- set $+(%,bj.,$nick,.bcards) $instok($($+(%,bj.,$nick,.bcards),2),$getcard,1,43)
- set $+(%,bj.,$nick,.btotal) $gettotal($($+(%,bj.,$nick,.bcards),2))
- msg $chan $+($nick,$chr(44)) 2your cards are: $($+(%,bj.,$nick,.cards),2) = $($+(%,bj.,$nick,.ctotal),2)
- ;In regular blackjack at this point the game would show you the dealers face card (use $gettok to get the last card)
- }
- if ($($+(%,bj.,$nick,.ctotal),2) > 21) {
- 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) $+ )
- msg $chan $+(2,$nick) you lose $($+(%,bj.,$nick,.bet),2) chips.
- var %chips $calc($read(CasinoChips.txt, s, $nick) - $($+(%,bj.,$nick,.bet),2))
- write -ds $nick CasinoChips.txt
- write CasinoChips.txt $nick %chips
- unset $+(%,bj.,$nick,.*)
- }
- elseif ($($+(%,bj.,$nick,.ctotal),2) == 21) {
- botHits
- 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) $+ )
- if ($($+(%,bj.,$nick,.btotal),2) == 21) {
- var %Chips $calc($read(CasinoChips.txt, s, $nick) - $($+(%,bj.,$nick,.bet),2))
- write -ds $nick CasinoChips.txt
- write CasinoChips.txt $nick %chips
- msg $chan 2[eCasino] got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2[eCasino] $+ 's cards:3 $($+(%,bj.,$nick,.bcards),2)
- msg $chan $+(2,$nick) you lose $($+(%,bj.,$nick,.bet),2) chips.
- unset $+(%,bj.,$nick,.*)
- }
- else {
- var %chips $calc($read(CasinoChips.txt, s, $nick) + $($+(%,bj.,$nick,.bet),2) * 2)
- write -ds $+ $nick CasinoChips.txt
- write CasinoChips.txt $nick %Chips
- msg $chan $+(2,$nick) you win $($+(%,bj.,$nick,.bet),2) chips.
- unset $+(%,bj.,$nick,.*)
- }
- }
- }
- alias getcard {
- var %r $r(1,13)
- if (%r = 1) {
- return Ace
- }
- elseif (%r >= 10) {
- return 10
- }
- else {
- return %r
- }
- }
- alias gettotal {
- var %x 1
- while (%x <= $numtok($1-,43)) {
- var %tok $gettok($1-,%x,43)
- if (%tok !isnum) {
- var %t $calc(%t + 11)
- }
- else {
- var %t $calc(%t + %tok)
- }
- inc %x
- }
- return %t
- }
- on $*:text:/^[!](hit)(\s|$)/Si:#eCasino.blackjack: {
- if (!$($+(%,bj.,$nick,.ctotal),2)) { msg # $nick $+ , 2to start a game type !Blackjack <bet> to start a new game | halt }
- set $+(%,bj.,$nick,.cards) $instok($($+(%,bj.,$nick,.cards),2),$getcard,1,43)
- set $+(%,bj.,$nick,.ctotal) $gettotal($($+(%,bj.,$nick,.cards),2))
- msg $chan $+($nick,$chr(44)) 2your cards are: $($+(%,bj.,$nick,.cards),2) = $($+(%,bj.,$nick,.ctotal),2)
- ;Could run a check at this point to see if they got a five card charlie
- if ($($+(%,bj.,$nick,.ctotal),2) >= 22) {
- var %chips $calc($read(CasinoChips.txt, s, $nick) - $($+(%,bj.,$nick,.bet),2))
- write -ds $nick CasinoChips.txt
- write CasinoChips.txt $nick %chips
- 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) $+ )
- msg $chan $+(2,$nick) you lose $($+(%,bj.,$nick,.bet),2) chips.
- unset $+(%,bj.,$nick,.*)
- }
- elseif ($($+(%,bj.,$nick,.ctotal),2) == 21) {
- 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) $+ )
- botHits
- if ($($+(%,bj.,$nick,.btotal),2) == 21) {
- var %Chips $calc($read(CasinoChips.txt, s, $nick) - $($+(%,bj.,$nick,.bet),2))
- write -ds $nick CasinoChips.txt
- write CasinoChips.txt $nick %chips
- msg $chan 2[eCasino] got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2[eCasino] $+ 's cards:3 $($+(%,bj.,$nick,.bcards),2)
- msg $chan $+(2,$nick) you lose $($+(%,bj.,$nick,.bet),2) chips.
- unset $+(%,bj.,$nick,.*)
- }
- else {
- var %chips $calc($read(CasinoChips.txt, s, $nick) + $($+(%,bj.,$nick,.bet),2) * 2)
- write -ds $+ $nick CasinoChips.txt
- write CasinoChips.txt $nick %Chips
- msg $chan $+(2,$nick) you win $($+(%,bj.,$nick,.bet),2) chips.
- unset $+(%,bj.,$nick,.*)
- }
- }
- }
- on $*:text:/^[!](stand)(\s|$)/Si:#eCasino.blackjack: {
- if (!$($+(%,bj.,$nick,.ctotal),2)) { msg # $nick $+ , 2to start a game type !Blackjack <bet> to start a new game | halt }
- botHits
- 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)
- if ($($+(%,bj.,$nick,.btotal),2) >= 22) {
- var %Chips $calc($read(CasinoChips.txt, s, $nick) + $($+(%,bj.,$nick,.bet),2))
- write -ds $nick CasinoChips.txt
- write CasinoChips.txt $nick %chips
- 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) $+ )
- msg $chan $+(2,$nick) you win $($+(%,bj.,$nick,.bet),2) chips.
- unset $+(%,bj.,$nick,.*)
- }
- elseif ($($+(%,bj.,$nick,.btotal),2) == 21) {
- var %Chips $calc($read(CasinoChips.txt, s, $nick) - $($+(%,bj.,$nick,.bet),2))
- write -ds $nick CasinoChips.txt
- write CasinoChips.txt $nick %chips
- 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) $+ )
- msg $chan $+(2,$nick) you lose $($+(%,bj.,$nick,.bet),2) chips.
- unset $+(%,bj.,$nick,.*)
- }
- elseif ($($+(%,bj.,$nick,.btotal),2) >= $($+(%,bj.,$nick,.ctotal),2)) {
- var %Chips $calc($read(CasinoChips.txt, s, $nick) - $($+(%,bj.,$nick,.bet),2))
- write -ds $nick CasinoChips.txt
- write CasinoChips.txt $nick %chips
- 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) $+ )
- msg $chan $+(2,$nick) you lose $($+(%,bj.,$nick,.bet),2) chips.
- unset $+(%,bj.,$nick,.*)
- }
- else {
- 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) $+ )
- msg $chan $+(2,$nick) you win $($+(%,bj.,$nick,.bet),2) chips.
- var %chips $calc($read(CasinoChips.txt, s, $nick) + $($+(%,bj.,$nick,.bet),2))
- write -ds $+ $nick CasinoChips.txt
- write CasinoChips.txt $nick %Chips
- unset $+(%,bj.,$nick,.*)
- }
- }
- alias botHits {
- while ($($+(%,bj.,$nick,.btotal),2) < 17) {
- set $+(%,bj.,$nick,.bcards) $instok($($+(%,bj.,$nick,.bcards),2),$getcard,1,43)
- set $+(%,bj.,$nick,.btotal) $gettotal($($+(%,bj.,$nick,.bcards),2))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement