FordLawnmower
Warning Level : Posts : 3 Points : 51719 Reputation : 0 Join date : 2010-03-10
| Subject: Video Poker for mIRC Wed Mar 10, 2010 9:52 am | |
| This is Video Poker in a mIRC Dialog. All of the controls in the game should be self explanatory. To use: Load in Remotes. From any menu Click - Initialize Video Poker Deck. This will take 13 seconds. After the Deck is done, click Video Poker from any menu. **Note** If you load this script with the load command, it will initialize the deck on load. - Code:
-
;Video Poker by Ford_Lawnmower irc.mindforge.org #USA-Chat menu * { $iif($isdir(Poker),Video Poker,Initialize Video Poker Deck): { if (!$isdir(Poker)) GetPokerDeck else dialog $iif($dialog(VideoPoker),-v,-md) VideoPoker VideoPoker } } dialog VideoPoker { title "Video Poker" size -1 -1 151 189 option dbu icon 1, 7 116 22 31 icon 2, 35 116 22 31 icon 3, 63 116 22 31 icon 4, 91 116 22 31 icon 5, 120 116 22 31 text "", 6, 8 106 22 8, center text "", 7, 36 106 22 8, center text "", 8, 64 106 22 8, center text "", 9, 92 106 22 8, center text "", 10, 121 106 22 8, center button "Deal", 11, 103 173 37 12 button "Bet+", 12, 10 173 17 12 button "Bet-", 13, 29 173 17 12 text "Current Bet $", 14, 51 175 35 8, right text "1", 15, 86 175 15 8 text "Royal Flush 250 to 1", 16, 23 9 108 8, center text "Straight Flush 100 to 1", 17, 23 19 108 8, center text "Four of a Kind 75 to 1", 18, 23 29 108 8, center text "Full House 50 to 1", 19, 23 39 108 8, center text "Flush 30 to 1", 20, 23 49 109 8, center text "Straight 20 to 1", 21, 23 59 109 8, center text "Three of a Kind 10 to 1", 22, 23 69 108 8, center text "Two Pair 5 to 1", 23, 22 79 110 8, center box "Payouts", 24, 12 2 129 91 text "Your Cash $", 25, 11 153 31 8 edit "500", 26, 42 152 50 10, read autohs text "", 27, 12 163 128 8, center text "Click Deal to Begin.", 28, 8 96 136 8, center } On *:Dialog:VideoPoker:init:*: { did -g $dname 1-5 Poker\0.png } On *:Dialog:VideoPoker:Sclick:*: { if ($did) && ($did < 6) && ($did($dname,11) == Draw) { var %hold $calc($did + 5) if ($did($dname,%hold)) { did -a $dname %hold } else { did -a $dname %hold Hold } } elseif ($did == 11) { $did($dname,$did) } elseif ($did == 12) && ($did($dname,11) == Deal) { if ($did($dname,15) < 10) { did -a $dname 15 $calc($did($dname,15) + 1) } else { did -a $dname 27 Max Bet Has Been Reached. .timer 1 3 did -a $dname 27 } } elseif ($did == 13) && ($did($dname,11) == Deal) { if ($did($dname,15) > 1) { did -a $dname 15 $calc($did($dname,15) - 1) } else { did -a $dname 27 You Must Bet At Least One Dollar. .timer 1 3 did -a $dname 27 } } } alias -l SuitMatch { if ($wildtok($1-,$1,0,32) == 5) { return 1 } } alias OrderMatch { tokenize 32 $sorttok($1-,32,n) tokenize 32 $sorttok($iif($1 == 1 && $2 != 2,14,$1) $2-,32,n) if ($Plus1($1,$2)) && ($Plus1($2,$3)) && ($Plus1($3,$4)) && ($Plus1($4,$5)) { return 1 } } alias -l Plus1 if ($calc($1 + 1) == $2) return 1 alias -l Matches { var %Matches $calc($wildtok($1-,$1,0,32) + $wildtok($1-,$2,0,32) + $wildtok($1-,$3,0,32) + $wildtok($1-,$4,0,32) + $wildtok($1-,$5,0,32)) if (%Matches < 9) { return 0 } elseif (%Matches == 9) { return 2 } elseif (%Matches == 11) { return 3 } elseif (%Matches == 13) { return 5 } elseif (%Matches == 17) { return 4 } } alias -l Checkhand { tokenize 32 $mid($1,2-) $left($1,1) $mid($2,2-) $left($2,1) $mid($3,2-) $left($3,1) $mid($4,2-) $left($4,1) $mid($5,2-) $left($5,1) if ($SuitMatch($2,$4,$6,$8,$10)) { if ($OrderMatch($1,$3,$5,$7,$9)) { if ($istok($1 $3 $5 $7 $9,1,32)) { return Royal Flush } else { return Straight Flush } } else { return Flush } } elseif ($OrderMatch($1,$3,$5,$7,$9)) { return Straight } elseif ($Matches($1,$3,$5,$7,$9)) { var %Match $v1 if (%Match == 2) { return 2 Pair } elseif (%Match == 3) { return 3 of A Kind } elseif (%Match == 5) { return Full House } elseif (%Match == 4) { return 4 of A Kind } } } alias -l MakeDeck { if (!$hget(PokerDeck)) { hmake PokerDeck 5 } var %count 1 while (%count <= 13) { hadd PokerDeck %count R H %count hadd PokerDeck $calc(%count + 13) B C %count hadd PokerDeck $calc(%count + 26) B S %count hadd PokerDeck $calc(%count + 39) R D %count inc %count } } alias -l swap { var %a $r(1,52), %b $r(1,52), %adata $hget(PokerDeck,%a), %bdata $hget(PokerDeck,%b) hadd PokerDeck %a %bdata hadd PokerDeck %b %adata } alias -l shuffle { var %count 1 while (%count <= 100) { swap inc %count } } alias -l Draw { if ($dialog(VideoPoker)) { var %card, %count 1 while (%count <= 5) { if (!$did(VideoPoker,$calc(%count + 5))) { %card = $+(%card,$chr(32),%count) } inc %count } tokenize 32 %card %count = 1 var %counter $gettok(%card,0,32) while (%count <= %counter) { did -g VideoPoker $gettok(%card,%count,32) $+(Poker\,$remove($hget(PokerDeck,$calc(%count + 5)),$chr(32)),.png) inc %count } Score VideoPoker did -a VideoPoker 11 Deal } } alias -l Deal { did -a VideoPoker 6-10 if ($dialog(VideoPoker)) { if (!$did(VideoPoker,26)) { did -a VideoPoker 28 Game Over!! Out of Cash!! } elseif ($did(VideoPoker,26) < $did(VideoPoker,15)) { did -a VideoPoker 27 You don't have that much cash!! Lower your bet!! .timer 1 3 did -a VideoPoker 27 } else { MakeDeck Shuffle did -a VideoPoker 11 Draw var %card 1 while (%card <= 5) { did -g VideoPoker %card $+(Poker\,$remove($hget(PokerDeck,%card),$chr(32)),.png) inc %card } did -a VideoPoker 28 Click the cards you want to keep then Click Draw. } } } alias -l Score { tokenize 32 $remove($mid($nopath($did($1,1)),2-) $mid($nopath($did($1,2)),2-) $mid($nopath($did($1,3)),2-) $mid($nopath($did($1,4)),2-) $mid($nopath($did($1,5)),2-),.png) var %cash $did(VideoPoker,26), %bet $did(VideoPoker,15) if ($checkhand($1,$2,$3,$4,$5)) { var %Winner $v1, %Prize if (%Winner == 2 Pair) { %Prize = 5 } elseif (%Winner == 3 of A Kind) { %Prize = 10 } elseif (%Winner == Straight) { %Prize = 20 } elseif (%Winner == Flush) { %Prize = 30 } elseif (%Winner == Full House) { %Prize = 50 } elseif (%Winner == 4 of A Kind) { %Prize = 75 } elseif (%Winner == Straight Flush) { %Prize = 100 } elseif (%Winner == Royal Flush) { %Prize = 250 } did -a VideoPoker 28 Winner!! %Winner - Prize $+($chr(36),$calc(%Prize * %bet)) - Click Deal to Play Again. did -ra VideoPoker 26 $calc(%cash + [ %bet * %Prize ] ) } else { did -a VideoPoker 28 You Lose :( Click Deal to Play Again did -ra VideoPoker 26 $calc(%cash - %bet) } } alias -l GetPokerDeck { echo -a Initializing Video Poker Deck. This will take about 13 Seconds. Please Wait...... var %count 1 while (%count <= 13) { .timer 1 %count GetCard worldofsolitaire.com $+(/decks/anglo/2/,%count,h.png) Poker $+(RH,%count,.png) .timer 1 %count GetCard worldofsolitaire.com $+(/decks/anglo/2/,%count,c.png) Poker $+(BC,%count,.png) .timer 1 %count GetCard worldofsolitaire.com $+(/decks/anglo/2/,%count,s.png) Poker $+(BS,%count,.png) .timer 1 %count GetCard worldofsolitaire.com $+(/decks/anglo/2/,%count,d.png) Poker $+(RD,%count,.png) inc %count } GetCard worldofsolitaire.com /decks/anglo/2/base_foundation.png Poker 0.png GetCard worldofsolitaire.com /decks/anglo/2/back.png Poker back.png .timer 1 %count echo -a Video Poker Deck is complete. Enjoy the Game. } alias -l GetCard { if ($isfile($qt($+($3,\,$4)))) { .remove $qt($+($3,\,$4)) } var %sockname $+(GetCard,$ticks,$r(1,$ticks)) if (!$isdir($qt($3))) { mkdir $qt($3) } sockopen %sockname $1 80 sockmark %sockname $1- } On *:sockopen:GetCard*:{ sockwrite -nt $sockname GET $gettok($sock($sockname).mark,2,32) HTTP/1.0 sockwrite -n $sockname Host: $gettok($sock($sockname).mark,1,32) $+ $crlf $+ $crlf } On *:sockread:GetCard*:{ if (!$gettok($sock($sockname).mark,5,32)) { var %GetCard | sockread %GetCard if (!%GetCard) { sockmark $sockname $addtok($sock($sockname).mark,1,32) } } else { sockread &GetCard bwrite -s $qt($+($gettok($sock($sockname).mark,3,32),\,$gettok($sock($sockname).mark,4,32))) -1 -1 &GetCard } } On *:Load: { if (!$isdir(Poker)) GetPokerDeck }
| |
|