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 that shell.
- ;Another edit February 2014 for Chromatic on qi_interesting justinTV to show cards differently
- on $*:text:/^[!](bj|blackjack)(\s|$)/Si:#qi_interesting: {
- 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 [Qi_bot] wins ([Qi_bot] $+ '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([Qi_bot] $+ '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[Qi_bot] got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2[Qi_bot] $+ '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 of $suit }
- elseif (%r == 10) { return 10 of $suit }
- elseif (%r == 11) { return Jack of $suit }
- elseif (%r == 12) { return Queen of $suit }
- elseif (%r == 13) { return King of $suit }
- else { return %r of $suit }
- }
- alias suit {
- var %r $r(1,4)
- if (%r == 1) { return Spades }
- elseif (%r == 2) { return Hearts }
- elseif (%r == 3) { return Diamonds }
- elseif (%r == 4) { return Clubs }
- }
- alias gettotal {
- var %x 1
- while (%x <= $numtok($1-,43)) {
- var %tok $gettok($gettok($1-,%x,43),1,32)
- if (%tok == Ace) { var %t $calc(%t + 11) }
- elseif (%tok == Jack) { var %t $calc(%t + 10) }
- elseif (%tok == Queen) { var %t $calc(%t + 10) }
- elseif (%tok == King) { var %t $calc(%t + 10) }
- else { var %t $calc(%t + %tok) }
- inc %x
- }
- return %t
- }
- on $*:text:/^[!](hit)(\s|$)/Si:#qi_interesting: {
- 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 [Qi_bot] wins ([Qi_bot] $+ '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([Qi_bot] $+ '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[Qi_bot] got 11,01B10,01l13,01a10,01c11,01k09,01j08,01a7,01c04,01k! 2[Qi_bot] $+ '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|stay)(\s|$)/Si:#qi_interesting: {
- 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) [Qi_bot] $+ '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[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) $+ )
- 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[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) $+ )
- 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 [Qi_bot] wins 2([Qi_bot] $+ '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([Qi_bot] $+ '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