Stealth Script — File Browser

StealthScriptv1.0 / StealthScriptv1.0 / Stealth / poker2 / poker2.mrc

poker2.mrc — 26.97 KB — Download this file

; *****
; POKER2.MRC  V 2.2
; *****
; poker2.mrc created by WabbyTwax
; WabbyTwax@aol.com
; This script requires mIRC version 5.3 or later
; *****

alias HelpfulTips {
  /window -fdk +e @Helpful_Tips 250 100 450 400 @Helpful_Tips
  :readlines
  inc %frc.menuhlp
  if (%frc.menuhlp > 28) { unset %frc.menu* | halt }
  set %frc.menutmp $read -nl $+ %frc.menuhlp $mircdir $+ poker2\helpfultips.txt
  if (%frc.menutmp = $null) { /aline @Helpful_Tips   | goto readlines }
  /aline -p @Helpful_Tips %frc.menutmp
  goto readlines
}

alias RankOf {
  /window -fdk +e @Winning_Hands 300 100 400 180 @Helpful_Tips
  :readlines
  inc %frc.menuhlp
  if (%frc.menuhlp > 11) { unset %frc.menu* | halt }
  set %frc.menutmp $read -nl $+ %frc.menuhlp $mircdir $+ poker2\winninghands.txt
  /aline @Winning_Hands %frc.menutmp
  goto readlines
}

on 1:KEYDOWN:@Poker_Table:*:{
  if ($keyval = 49) { dealselfclick 41 48 1 }
  if ($keyval = 50) { dealselfclick 99 48 1 }
  if ($keyval = 51) { dealselfclick 160 48 1 }
  if ($keyval = 52) { dealselfclick 216 48 1 }
  if ($keyval = 53) { dealselfclick 277 48 1 }
  if ($keyval = 97) { dealselfclick 41 48 1 }
  if ($keyval = 98) { dealselfclick 99 48 1 }
  if ($keyval = 99) { dealselfclick 160 48 1 }
  if ($keyval = 100) { dealselfclick 216 48 1 }
  if ($keyval = 101) { dealselfclick 277 48 1 }
  if ($keyval = 13) { dealselfclick 157 132 1 }
  if ($keyval = 66) { dealselfclick 55 333 1 }
  if ($keyval = 77) { dealselfclick 47 301 1 }
  if ($keyval = 72) {
    checkver
    run $mircdir $+ poker2\helpfultips.txt
  }
}

ON 1:LOAD:{
  echo -a 9,1Please wait just a few seconds while Poker2 is installed...
  set %pok.card1.tog draw.bmp
  set %pok.card2.tog draw.bmp
  set %pok.card3.tog draw.bmp
  set %pok.card4.tog draw.bmp
  set %pok.card5.tog draw.bmp
  set %pok.dealnewgame deal.bmp
  if (%pok.owebank == $null) { set %pok.owebank 0 }
  if (%pok.pokerbet == $null) { set %pok.pokerbet 5 }
  if (%pok.totalcredit == $null) { set %pok.totalcredit 95 }
  ; THIS SECTION COPIES BAZOOKA.TTF TO YOUR WINDOWS\FONTS FOLDER
  set %pok.windowsdir $findfile(c:\,win.com,1)
  set %pok.windowsnum $len(%pok.windowsdir)
  set %pok.windowsnum $calc(%pok.windowsnum - 7)
  set %pok.windowsdir $left(%pok.windowsdir, %pok.windowsnum) $+ fonts\
  set %pok.windowsdir2 %pok.windowsdir $+ bazooka.ttf
  if ($exists(%pok.windowsdir2) == $true) { goto skipfontcopy }
  /copy $mircdir $+ poker2\bazooka.ttf %pok.windowsdir $+ bazooka.ttf
  echo -a 11,1This script just copied Bazooka.ttf to your c:\windows\fonts directory
  if ($version < 5.6) { /run %pok.windowsdir }
  else {
    echo -a 11,1 mIRC 5.6 Detected: If you have your /run feature LOCKED Please open the directory c:\windows\fonts\ and close it so that the bazooka font will be properly installed.
  }
  :skipfontcopy
  unset %pok.windowsdir
  unset %pok.windowsdir2
  unset %pok.windowsnum
  echo -a 9,1Right Click and select Wabbit's Poker to play!
}

menu channel {
  -
  Wabbit's Poker
  .Single Player Mode:{
    if (%pok.tablex == $null) { set %pok.tablex 0 | set %pok.tabley 0 }
    /shuffle
  }
  .Rank Of Winning Hands:RankOf
  .Helpful Tips!:HelpfulTips
  .UN-Install Poker:{
    set %pok.ui  $$?="UN-INSTALL? PLEASE TYPE ' YES '"
    if (%pok.ui = YES) { 
      unset %pok.*
      /echo -a 9,1Poker2 Has Been Uninstalled.. You may delete the files you unzipped if you'd like now.
      /unload -rs poker2.mrc
    }
    else {
      /echo -a 9,1Poker2  has NOT been UN-Installed!
    }
  }
}

menu query {
  -
  Wabbit's Poker
  .Single Player Mode:{
    if (%pok.tablex == $null) { set %pok.tablex 0 | set %pok.tabley 0 }
    /shuffle
  }
  .Rank Of Winning Hands:RankOf
  .Helpful Tips!:HelpfulTips
  .UN-Install Poker:{
    set %pok.ui  $$?="UN-INSTALL? PLEASE TYPE ' YES '"
    if (%pok.ui = YES) { 
      unset %pok.*
      /echo -a 9,1Poker2 Has Been Uninstalled.. You may delete the files you unzipped if you'd like now.
      /unload -rs poker2.mrc
    }
    else {
      /echo -a 9,1Poker2  has NOT been UN-Installed!
    }
  }
}

menu status {
  -
  Wabbit's Poker
  .Single Player Mode:{
    if (%pok.tablex == $null) { set %pok.tablex 0 | set %pok.tabley 0 }
    /shuffle
  }
  .Rank Of Winning Hands:RankOf
  .Helpful Tips!:HelpfulTips
  .UN-Install Poker:{
    set %pok.ui  $$?="UN-INSTALL? PLEASE TYPE ' YES '"
    if (%pok.ui = YES) { 
      unset %pok.*
      /echo -a 9,1Poker2 Has Been Uninstalled.. You may delete the files you unzipped if you'd like now.
      /unload -rs poker2.mrc
    }
    else {
      /echo -a 9,1Poker2  has NOT been UN-Installed!
    }
  }
}

menu @Poker_Table {
  sclick:/dealselfclick $mouse.x $mouse.y $mouse.key
  dclick:halt
  Helpful Tips:HelpfulTips
  Rank Of Winning Hands:RankOf
}

alias maketable {
  if ($window(@Poker_Table).status == $null) {
    window -pdok @Poker_Table %pok.tablex %pok.tabley 323 387 @Poker_Table FixedSys 9
  }
  set %pok.tablex $window(@Poker_Table).x
  set %pok.tabley $window(@Poker_Table).y
  /drawfill @Poker_Table 1 1 0 0 %pok.mircdir $+ poker2\table.bmp
  /drawpic -c @Poker_Table 15 10 %pok.mircdir $+ poker2\ $+ %pok.card1
  /drawpic -c @Poker_Table 73 10 %pok.mircdir $+ poker2\ $+ %pok.card2
  /drawpic -c @Poker_Table 131 10 %pok.mircdir $+ poker2\ $+ %pok.card3
  /drawpic -c @Poker_Table 189 10 %pok.mircdir $+ poker2\ $+ %pok.card4
  /drawpic -c @Poker_Table 247 10 %pok.mircdir $+ poker2\ $+ %pok.card5
  /drawpic -tc @Poker_Table 0 17 86 %pok.mircdir $+ poker2\ $+ %pok.card1.tog
  /drawpic -tc @Poker_Table 0 75 86 %pok.mircdir $+ poker2\ $+ %pok.card2.tog
  /drawpic -tc @Poker_Table 0 133 86 %pok.mircdir $+ poker2\ $+ %pok.card3.tog
  /drawpic -tc @Poker_Table 0 191 86 %pok.mircdir $+ poker2\ $+ %pok.card4.tog
  /drawpic -tc @Poker_Table 0 249 86 %pok.mircdir $+ poker2\ $+ %pok.card5.tog
  /drawpic -tc @Poker_Table 0 90 120 %pok.mircdir $+ poker2\ $+ %pok.dealnewgame
  /drawpic -tc @Poker_Table 0 5 150 %pok.mircdir $+ poker2\seperator.bmp
  /drawpic -tc @Poker_Table 0 75 165 %pok.mircdir $+ poker2\yourbest.bmp
  /drawtext -cr @Poker_Table $rgb(6,44,181) bazooka 28 5 190 326 324 %pok.besthand
  /drawtext -cr @Poker_Table $rgb(17,166,255) bazooka 28 7 188 328 322 %pok.besthand
  /drawpic -tc @Poker_Table 0 5 208 %pok.mircdir $+ poker2\seperator.bmp
  if (%pok.dealnewgame = newgame.bmp) {
    if (%pok.winlose = youlose.bmp) { /drawpic -tc @Poker_Table 0 115 230 %pok.mircdir $+ poker2\ $+ %pok.winlose }
    if (%pok.winlose = youwin.bmp) {
      /drawpic -tc @Poker_Table 0 90 230 %pok.mircdir $+ poker2\ $+ %pok.winlose
      /drawtext -cr @Poker_Table $rgb(129,4,109) bazooka 22 185 233 326 324 $ $+ %pok.prize
      /drawtext -cr @Poker_Table $rgb(216,0,174) bazooka 22 187 231 328 322 $ $+ %pok.prize
    }
  }
  if (bank isin %pok.winlose) { /drawpic -tc @Poker_Table 0 65 230 %pok.mircdir $+ poker2\ $+ %pok.winlose }
  if (%pok.youowe = OFF) {
    /drawpic -tc @Poker_Table 0 5 290 %pok.mircdir $+ poker2\youhave.bmp
    /drawtext -cr @Poker_Table $rgb(105,0,0) bazooka 22 126 294 126 324 $ $+ %pok.totalcredit
    /drawtext -cr @Poker_Table $rgb(238,0,0) bazooka 22 128 292 128 322 $ $+ %pok.totalcredit
  }
  if (%pok.youowe = ON) {
    /drawpic -tc @Poker_Table 0 5 290 %pok.mircdir $+ poker2\youowe.bmp
    /drawtext -cr @Poker_Table $rgb(105,0,0) bazooka 22 126 294 326 324 $ $+ %pok.owebank
    /drawtext -cr @Poker_Table $rgb(238,0,0) bazooka 22 128 292 328 322 $ $+ %pok.owebank
  }
  /drawpic -tc @Poker_Table 0 5 320 %pok.mircdir $+ poker2\betamount.bmp
  /drawtext -cr @Poker_Table $rgb(105,0,0) bazooka 22 126 324 126 324 $ $+ %pok.pokerbet
  /drawtext -cr @Poker_Table $rgb(238,0,0) bazooka 22 128 322 128 322 $ $+ %pok.pokerbet
  if (%pok.pokerbet = 5) { /drawpic -tc @Poker_Table 0 210 255 %pok.mircdir $+ poker2\pokerchip5.bmp }
  if (%pok.pokerbet = 10) { /drawpic -tc @Poker_Table 0 210 255 %pok.mircdir $+ poker2\pokerchip10.bmp }
  if (%pok.pokerbet = 15) { /drawpic -tc @Poker_Table 0 210 255 %pok.mircdir $+ poker2\pokerchip15.bmp }
  if (%pok.pokerbet = 20) { /drawpic -tc @Poker_Table 0 210 255 %pok.mircdir $+ poker2\pokerchip20.bmp }
  if (%pok.pokerbet = 25) { /drawpic -tc @Poker_Table 0 210 255 %pok.mircdir $+ poker2\pokerchip25.bmp }
}

alias checkver {
  if ($version > 5.5) { echo -a 9,1mIRC 5.6+ Detected: If you have the /RUN Command Disabled you will have to open this file manually. }
}

alias besthand {
  set %pok.besthand  
  set %pok.oddspace  
  set %pok.pair
  if (%pok.bestcard1 = 1) { set %pok.bestcard1 0 } | if (%pok.bestcard2 = 1) { set %pok.bestcard2 0 } | if (%pok.bestcard3 = 1) { set %pok.bestcard3 0 } | if (%pok.bestcard4 = 1) { set %pok.bestcard4 0 } | if (%pok.bestcard5 = 1) { set %pok.bestcard5 0 }
  set %pok.bestall %pok.bestcard1 $+ %pok.bestcard2 $+ %pok.bestcard3 $+ %pok.bestcard4 $+ %pok.bestcard5
  if (A isin %pok.bestall) { Set %pok.bestcard A | goto besthand }
  if (K isin %pok.bestall) { Set %pok.bestcard K | goto besthand }
  if (Q isin %pok.bestall) { Set %pok.bestcard Q | goto besthand }
  if (J isin %pok.bestall) { Set %pok.bestcard J | goto besthand }
  if (0 isin %pok.bestall) { Set %pok.bestcard 0 | goto besthand }
  if (9 isin %pok.bestall) { Set %pok.bestcard 9 | goto besthand }
  if (8 isin %pok.bestall) { Set %pok.bestcard 8 | goto besthand }
  if (7 isin %pok.bestall) { Set %pok.bestcard 7 | goto besthand }
  if (6 isin %pok.bestall) { Set %pok.bestcard 6 | goto besthand }
  if (5 isin %pok.bestall) { Set %pok.bestcard 5 | goto besthand }
  if (4 isin %pok.bestall) { Set %pok.bestcard 4 | goto besthand }
  if (3 isin %pok.bestall) { Set %pok.bestcard 3 | goto besthand }
  if (2 isin %pok.bestall) { Set %pok.bestcard 2 | goto besthand }
  :besthand
  if (%pok.bestcard1 isin %pok.bestcard2) { set %pok.pair %pok.pair $+ %pok.bestcard1 $+ %pok.bestcard1 }
  if (%pok.bestcard1 isin %pok.bestcard3) { set %pok.pair %pok.pair $+ %pok.bestcard1 $+ %pok.bestcard1 }
  if (%pok.bestcard1 isin %pok.bestcard4) { set %pok.pair %pok.pair $+ %pok.bestcard1 $+ %pok.bestcard1 }
  if (%pok.bestcard1 isin %pok.bestcard5) { set %pok.pair %pok.pair $+ %pok.bestcard1 $+ %pok.bestcard1 }
  if (%pok.bestcard2 isin %pok.bestcard3) { set %pok.pair %pok.pair $+ %pok.bestcard2 $+ %pok.bestcard2 }
  if (%pok.bestcard2 isin %pok.bestcard4) { set %pok.pair %pok.pair $+ %pok.bestcard2 $+ %pok.bestcard2 }
  if (%pok.bestcard2 isin %pok.bestcard5) { set %pok.pair %pok.pair $+ %pok.bestcard2 $+ %pok.bestcard2 }
  if (%pok.bestcard3 isin %pok.bestcard4) { set %pok.pair %pok.pair $+ %pok.bestcard3 $+ %pok.bestcard3 }
  if (%pok.bestcard3 isin %pok.bestcard5) { set %pok.pair %pok.pair $+ %pok.bestcard3 $+ %pok.bestcard3 }
  if (%pok.bestcard4 isin %pok.bestcard5) { set %pok.pair %pok.pair $+ %pok.bestcard4 $+ %pok.bestcard4 }
  set %pok.besthand %pok.bestcard | set %pok.cardleft1 $left(%pok.pair, 1) | set %pok.cardright1 $right(%pok.pair,1) | set %pok.cardmid5 $mid(%pok.pair,5,1)
  if (%pok.besthand = 0) { set %pok.besthand 10 } | if (%pok.cardleft1 = 0) { set %pok.cardleft1 10 } | if (%pok.cardright1 = 0) { set %pok.cardright1 10 } | if (%pok.cardmid5 = 0) { set %pok.cardmid5 10 }
  if (%pok.besthand = 1) { set %pok.besthand 10 } | if (%pok.cardleft1 = 1) { set %pok.cardleft1 10 } | if (%pok.cardright1 = 1) { set %pok.cardright1 10 } | if (%pok.cardmid5 = 1) { set %pok.cardmid5 10 }
  if ($len(%pok.pair) = 2) {
    set %pok.besthand Pair Of %pok.cardleft1
    if (%pok.dealnewgame = newgame.bmp) {
      if (%pok.cardleft1 <= 9) {
        set %pok.winlose youlose.bmp | set %pok.prize  
        goto endgottastraight
      }
      else set %pok.totalcredit $calc(%pok.totalcredit + %pok.pokerbet) | set %pok.winlose youwin.bmp | set %pok.prize %pok.pokerbet | goto endgottastraight
    }
  } 
  if ($len(%pok.pair) = 4) { set %pok.besthand Two Pair: %pok.cardleft1 and %pok.cardright1
    if (%pok.dealnewgame = newgame.bmp) {
      set %pok.totalcredit $calc(%pok.totalcredit + $calc(%pok.pokerbet * 2))
      set %pok.winlose youwin.bmp | set %pok.prize $calc(%pok.pokerbet * 2)
    }
    goto endgottastraight
  }
  if ($len(%pok.pair) = 6) { set %pok.besthand Three Of A Kind: %pok.cardleft1
    if (%pok.dealnewgame = newgame.bmp) {
      set %pok.totalcredit $calc(%pok.totalcredit + $calc(%pok.pokerbet * 3))
      set %pok.winlose youwin.bmp | set %pok.prize $calc(%pok.pokerbet * 3)
    }
    goto endgottastraight
  }
  if ($len(%pok.pair) = 8) {
    if (%pok.cardleft1 = %pok.cardright1) { set %pok.besthand Full House! %pok.cardleft1 and %pok.cardmid5 }
    else set %pok.besthand Full House! %pok.cardleft1 and %pok.cardright1
    if (%pok.dealnewgame = newgame.bmp) {
      set %pok.totalcredit $calc(%pok.totalcredit + $calc(%pok.pokerbet * 8))
      set %pok.winlose youwin.bmp | set %pok.prize $calc(%pok.pokerbet * 8)
    }
    goto endgottastraight
  }
  if ($len(%pok.pair) = 12) { set %pok.besthand Four Of A Kind: %pok.cardleft1
    if (%pok.dealnewgame = newgame.bmp) {
      set %pok.totalcredit $calc(%pok.totalcredit + $calc(%pok.pokerbet * 20))
      set %pok.winlose youwin.bmp | set %pok.prize $calc(%pok.pokerbet * 20)
    }
    goto endgottastraight
  }
  :begingottaflush
  if (spade isin %pok.card1) {
    if (spade isin %pok.card2) {
      if (spade isin %pok.card3) {
        if (spade isin %pok.card4) {
          if (spade isin %pok.card5) {
            set %pok.besthand   A Flush! All Spades!
          } 
        }
      }
    }
  }
  if (club isin %pok.card1) {
    if (club isin %pok.card2) {
      if (club isin %pok.card3) {
        if (club isin %pok.card4) {
          if (club isin %pok.card5) {
            set %pok.besthand   A Flush! All Clubs!
          } 
        }
      }
    }
  }
  if (heart isin %pok.card1) {
    if (heart isin %pok.card2) {
      if (heart isin %pok.card3) {
        if (heart isin %pok.card4) {
          if (heart isin %pok.card5) {
            set %pok.besthand   A Flush! All Hearts!
          } 
        }
      }
    }
  }
  if (diamond isin %pok.card1) {
    if (diamond isin %pok.card2) {
      if (diamond isin %pok.card3) {
        if (diamond isin %pok.card4) {
          if (diamond isin %pok.card5) {
            set %pok.besthand   A Flush! All Diamonds!
          } 
        }
      }
    }
  }
  if (0 isin %pok.card1val) { set %pok.card1val 10 }
  if (A isin %pok.card1val) { set %pok.card1val 14 | set %pok.card6val 1 }
  if (J isin %pok.card1val) { set %pok.card1val 11 }
  if (Q isin %pok.card1val) { set %pok.card1val 12 }
  if (K isin %pok.card1val) { set %pok.card1val 13 }
  if (0 isin %pok.card2val) { set %pok.card2val 10 }
  if (A isin %pok.card2val) { set %pok.card2val 14 | set %pok.card6val 1 }
  if (J isin %pok.card2val) { set %pok.card2val 11 }
  if (Q isin %pok.card2val) { set %pok.card2val 12 }
  if (K isin %pok.card2val) { set %pok.card2val 13 }
  if (0 isin %pok.card3val) { set %pok.card3val 10 }
  if (A isin %pok.card3val) { set %pok.card3val 14 | set %pok.card6val 1 }
  if (J isin %pok.card3val) { set %pok.card3val 11 }
  if (Q isin %pok.card3val) { set %pok.card3val 12 }
  if (K isin %pok.card3val) { set %pok.card3val 13 }
  if (0 isin %pok.card4val) { set %pok.card4val 10 }
  if (A isin %pok.card4val) { set %pok.card4val 14 | set %pok.card6val 1 }
  if (J isin %pok.card4val) { set %pok.card4val 11 }
  if (Q isin %pok.card4val) { set %pok.card4val 12 }
  if (K isin %pok.card4val) { set %pok.card4val 13 }
  if (0 isin %pok.card5val) { set %pok.card5val 10 }
  if (A isin %pok.card5val) { set %pok.card5val 14 | set %pok.card6val 1 }
  if (J isin %pok.card5val) { set %pok.card5val 11 }
  if (Q isin %pok.card5val) { set %pok.card5val 12 }
  if (K isin %pok.card5val) { set %pok.card5val 13 }
  set %pok.straightbesthand   $+ %pok.card6val $+   $+ %pok.card1val $+   $+ %pok.card2val $+   $+ %pok.card3val $+   $+ %pok.card4val $+   $+ %pok.card5val
  if (%pok.oddspace $+ $calc(%pok.card1val + 1) isin %pok.straightbesthand) {
    if (%pok.oddspace $+ $calc(%pok.card1val + 2) isin %pok.straightbesthand) {
      if (%pok.oddspace $+ $calc(%pok.card1val + 3) isin %pok.straightbesthand) {
        if (%pok.oddspace $+ $calc(%pok.card1val + 4) isin %pok.straightbesthand) { goto gottastraight }
        else goto next1
      }
      else goto next1
    }
    else goto next1
  }
  else goto next1
  :next1
  if (%pok.oddspace $+ $calc(%pok.card2val + 1) isin %pok.straightbesthand) {
    if (%pok.oddspace $+ $calc(%pok.card2val + 2) isin %pok.straightbesthand) {
      if (%pok.oddspace $+ $calc(%pok.card2val + 3) isin %pok.straightbesthand) {
        if (%pok.oddspace $+ $calc(%pok.card2val + 4) isin %pok.straightbesthand) { goto gottastraight }
        else goto next2
      }
      else goto next2
    }
    else goto next2
  }
  else goto next2
  :next2
  if (%pok.oddspace $+ $calc(%pok.card3val + 1) isin %pok.straightbesthand) {
    if (%pok.oddspace $+ $calc(%pok.card3val + 2) isin %pok.straightbesthand) {
      if (%pok.oddspace $+ $calc(%pok.card3val + 3) isin %pok.straightbesthand) {
        if (%pok.oddspace $+ $calc(%pok.card3val + 4) isin %pok.straightbesthand) { goto gottastraight }
        else goto next3
      }
      else goto next3
    }
    else goto next3
  }
  else goto next3
  :next3
  if (%pok.oddspace $+ $calc(%pok.card4val + 1) isin %pok.straightbesthand) {
    if (%pok.oddspace $+ $calc(%pok.card4val + 2) isin %pok.straightbesthand) {
      if (%pok.oddspace $+ $calc(%pok.card4val + 3) isin %pok.straightbesthand) {
        if (%pok.oddspace $+ $calc(%pok.card4val + 4) isin %pok.straightbesthand) { goto gottastraight }
        else goto next4
      }
      else goto next4
    }
    else goto next4
  }
  else goto next4
  :next4
  if (%pok.oddspace $+ $calc(%pok.card5val + 1) isin %pok.straightbesthand) {
    if (%pok.oddspace $+ $calc(%pok.card5val + 2) isin %pok.straightbesthand) {
      if (%pok.oddspace $+ $calc(%pok.card5val + 3) isin %pok.straightbesthand) {
        if (%pok.oddspace $+ $calc(%pok.card5val + 4) isin %pok.straightbesthand) { goto gottastraight }
        else goto next5
      }
      else goto next5
    }
    else goto next5
  }
  else goto next5
  :next5
  if (%pok.card6val = 1) {
    if (%pok.oddspace $+ $calc(%pok.card6val + 1) isin %pok.straightbesthand) {
      if (%pok.oddspace $+ $calc(%pok.card6val + 2) isin %pok.straightbesthand) {
        if (%pok.oddspace $+ $calc(%pok.card6val + 3) isin %pok.straightbesthand) {
          if (%pok.oddspace $+ $calc(%pok.card6val + 4) isin %pok.straightbesthand) { set %pok.bestcard 5 | goto gottastraight }
          else goto next6
        }
        else goto next6
      }
      else goto next6
    }
    else goto next6
  }
  :next6
  goto endgottastraight
  :gottastraight
  if (All isin %pok.besthand) {
    set %pok.besthand Straight FLUSH! %pok.bestcard High!
    if (%pok.card6val = 1) {
      if (%pok.bestcard = A) { Set %pok.besthand Straight FLUSH! A High! }
      if (14 isin %pok.straightbesthand) { 
        if (5 isin %pok.straightbesthand) { 
          set %pok.besthand Straight FLUSH!! 5 High!!
        }
      }    
    }
    if (%pok.dealnewgame = newgame.bmp) {
      set %pok.totalcredit $calc(%pok.totalcredit + $calc(%pok.pokerbet * 50))
      set %pok.winlose youwin.bmp | set %pok.prize $calc(%pok.pokerbet * 50)
    }
    goto endgottastraight
  }
  if (%pok.card6val = 1) {
    if (%pok.bestcard = A) { Set %pok.besthand   Straight! A High! }
    if (14 isin %pok.straightbesthand) {
      if (5 isin %pok.straightbesthand) {
        set %pok.besthand   Straight! 5 High!
      }
    }
  }
  if (%pok.bestcard = 0) { set %pok.bestcard 10 }
  set %pok.besthand   Straight! %pok.bestcard High!
  if (%pok.dealnewgame = newgame.bmp) {
    set %pok.totalcredit $calc(%pok.totalcredit + $calc(%pok.pokerbet * 5))
    set %pok.winlose youwin.bmp | set %pok.prize $calc(%pok.pokerbet * 5)
  }
  :endgottastraight
  if (%pok.dealnewgame = newgame.bmp) {
    if (All isin %pok.besthand) {
      set %pok.totalcredit $calc(%pok.totalcredit + $calc(%pok.pokerbet * 7))
      set %pok.winlose youwin.bmp | set %pok.prize $calc(%pok.pokerbet * 7)
    }
    if ($len(%pok.besthand) < 3) { set %pok.winlose youlose.bmp | set %pok.prize   }
  }
  if ($len(%pok.besthand) > 10) {
    set %pok.besthandspace $int($calc((32 - $len(%pok.besthand)) / 2))
    goto spacecow
  }
  if ($len(%pok.besthand) = 1) {
    set %pok.besthandspace $int($calc((43 - $len(%pok.besthand)) / 2))
    goto spacecow
  }
  set %pok.besthandspace $int($calc((40 - $len(%pok.besthand)) / 2))
  :spacecow
  set %pok.besthandspace $left(                        ,%pok.besthandspace)
  set %pok.besthand %pok.besthandspace $+ %pok.besthand
}

alias shuffle {
  set %pok.card1.tog draw.bmp
  set %pok.card2.tog draw.bmp
  set %pok.card3.tog draw.bmp
  set %pok.card4.tog draw.bmp
  set %pok.card5.tog draw.bmp
  set %pok.draw OFF
  set %pok.youowe OFF
  set %pok.dealnewgame deal.bmp
  set %pok.writeline 1
  set %pok.card6val  
  if (%pok.totalcredit = $null) { set %pok.totalcredit 100 }
  if (%pok.owebank = $null) { set %pok.owebank 0 }
  if (%pok.pokerbet = $null) { set %pok.pokerbet 5 }
  if (%pok.fdraw = OFF) {
    set %pok.totalcredit $calc(%pok.totalcredit - %pok.pokerbet)
  }
  :loop
  if (%pok.writeline = 53) {
    dealself
    set %pok.fdraw ON
    halt
  }
  set %pok.readline $read -nl $+ %pok.writeline $mircdir $+ poker2\cards2.txt
  /write -nl $+ %pok.writeline $mircdir $+ poker2\cards.txt %pok.readline
  inc %pok.writeline
  goto loop
}

alias dealselfclick {
  if (%pok.dealnewgame = newgame.bmp) { goto dealnewgame }
  if (($1 > 17) && ($1 < 300 )) {
    if (($2 > 15) && ($2 < 103)) {
      if ($1 < 68) {
        if (%pok.card1.tog = draw.bmp) { set %pok.card1.tog hold.bmp | dealself | halt }
        if (%pok.card1.tog = hold.bmp) { set %pok.card1.tog draw.bmp | dealself | halt }
      }
      if (($1 > 73) && ($1 < 126)) {
        if (%pok.card2.tog = draw.bmp) { set %pok.card2.tog hold.bmp | dealself | halt }
        if (%pok.card2.tog = hold.bmp) { set %pok.card2.tog draw.bmp | dealself | halt }
      }
      if (($1 > 131) && ($1 < 184)) {
        if (%pok.card3.tog = draw.bmp) { set %pok.card3.tog hold.bmp | dealself | halt }
        if (%pok.card3.tog = hold.bmp) { set %pok.card3.tog draw.bmp | dealself | halt }
      }
      if (($1 > 189) && ($1 < 242)) {
        if (%pok.card4.tog = draw.bmp) { set %pok.card4.tog hold.bmp | dealself | halt }
        if (%pok.card4.tog = hold.bmp) { set %pok.card4.tog draw.bmp | dealself | halt }
      }
      if (($1 > 247) && ($1 < 300)) {
        if (%pok.card5.tog = draw.bmp) { set %pok.card5.tog hold.bmp | dealself | halt }
        if (%pok.card5.tog = hold.bmp) { set %pok.card5.tog draw.bmp | dealself | halt }
      }
    }
  }
  :dealnewgame
  if (($1 > 84) && ($1 < 221)) {
    if (($2 > 119) && ($2 < 147)) {
      set %pok.bankclick ON
      if (%pok.dealnewgame = deal.bmp) { set %pok.dealnewgame newgame.bmp | set %pok.draw OFF | dealself | halt }
      set %pok.dealnewgame deal.bmp | shuffle | halt
    }
  }
  if (($1 > 9) && ($1 < 160)) {
    if (($2 > 323) && ($2 < 336)) {
      if (%pok.dealnewgame = deal.bmp) {
        /drawtext -cr @Poker_Table $rgb(105,0,0) bazooka 22 160 324 160 324 CLICK DEAL FIRST
        /drawtext -cr @Poker_Table $rgb(238,0,0) bazooka 22 162 322 162 322 CLICK DEAL FIRST
        halt
      }
      if (%pok.pokerbet = 25) { set %pok.pokerbet 5 }
      else set %pok.pokerbet $calc(%pok.pokerbet + 5)
      maketable
      halt
    }
  }
  if (($1 > 9) && ($1 < 160)) {
    if (($2 > 289) && ($2 < 402)) {
      if (%pok.youowe = OFF) { set %pok.youowe ON | maketable | halt }
      if (%pok.youowe = ON) { set %pok.youowe OFF | maketable | halt }
    }
  }
  if (($1 > 209) && ($1 < 308)) {
    if (($2 > 254) && ($2 < 353)) {
      if (%pok.dealnewgame = deal.bmp) {
        /drawtext -cr @Poker_Table $rgb(105,0,0) bazooka 22 160 324 160 324 CLICK DEAL FIRST
        /drawtext -cr @Poker_Table $rgb(238,0,0) bazooka 22 162 322 162 322 CLICK DEAL FIRST
        halt
      }
      if (%pok.pokerbet = 25) { set %pok.pokerbet 5 }
      else set %pok.pokerbet $calc(%pok.pokerbet + 5)
      maketable
      halt
    }
  }
  halt
}

alias dealself {
  if (%pok.draw = OFF) { deal }
  if (%pok.bankclick = ON) {
    if (%pok.totalcredit <= 0) {
      set %pok.winlose bankloan.bmp
      set %pok.owebank $calc(%pok.owebank + 100)
      set %pok.totalcredit $calc(%pok.totalcredit + 100)
      goto bank
    }
    if (%pok.totalcredit > 200) {
      if (%pok.dealnewgame = deal.bmp) {
        if (%pok.owebank != 0) {
          set %pok.winlose bankpay.bmp
          set %pok.owebank $calc(%pok.owebank - 100)
          set %pok.totalcredit $calc(%pok.totalcredit - 100)
        }
      }
      goto bank
    }
    :bank
    set %pok.bankclick OFF
  }
  maketable
}

alias deal {
  Set %pok.mircdirectory $mircdir $+ poker2\cards.txt
  Set %pok.NmbrCards $lines(%pok.mircdirectory)
  Set %pok.CardPicked $rand(1,%pok.NmbrCards)
  if (%pok.fdraw = ON) {
    if (%pok.card1.tog = hold.bmp) { goto Card2 }
  }
  Set %pok.card1 $read -l $+ %pok.CardPicked %pok.mircdirectory
  set %pok.card1val $upper($left(%pok.card1, 1))
  /write -dl $+ %pok.CardPicked %pok.mircdirectory
  dec %pok.NmbrCards 1
  Set %pok.CardPicked $rand(1,%pok.NmbrCards)
  set %pok.bestcard1 %pok.card1val
  :Card2
  if (%pok.fdraw = ON) {
    if (%pok.card2.tog = hold.bmp) { goto Card3 }
  }
  Set %pok.card2 $read -l $+ %pok.CardPicked %pok.mircdirectory
  set %pok.card2val $upper($left(%pok.card2, 1))
  /write -dl $+ %pok.CardPicked %pok.mircdirectory
  dec %pok.NmbrCards 1
  Set %pok.CardPicked $rand(1,%pok.NmbrCards)
  set %pok.bestcard2 %pok.card2val
  :Card3
  if (%pok.fdraw = ON) {
    if (%pok.card3.tog = hold.bmp) { goto Card4 }
  }
  Set %pok.card3 $read -l $+ %pok.CardPicked %pok.mircdirectory
  set %pok.card3val $upper($left(%pok.card3, 1))
  /write -dl $+ %pok.CardPicked %pok.mircdirectory
  dec %pok.NmbrCards 1
  Set %pok.CardPicked $rand(1,%pok.NmbrCards)
  set %pok.bestcard3 %pok.card3val
  :Card4
  if (%pok.fdraw = ON) {
    if (%pok.card4.tog = hold.bmp) { goto Card5 }
  }
  Set %pok.card4 $read -l $+ %pok.CardPicked %pok.mircdirectory
  set %pok.card4val $upper($left(%pok.card4, 1))
  /write -dl $+ %pok.CardPicked %pok.mircdirectory
  dec %pok.NmbrCards 1
  Set %pok.CardPicked $rand(1,%pok.NmbrCards)
  set %pok.bestcard4 %pok.card4val
  :Card5
  if (%pok.fdraw = ON) {
    if (%pok.card5.tog = hold.bmp) { goto Card6 }
  }
  Set %pok.card5 $read -l $+ %pok.CardPicked %pok.mircdirectory
  set %pok.card5val $upper($left(%pok.card5, 1))
  /write -dl $+ %pok.CardPicked %pok.mircdirectory
  set %pok.bestcard5 %pok.card5val
  :Card6
  Set %pok.cardspace  
  if (%pok.card1val = 1) { set %pok.card1val 0 }
  if (%pok.card2val = 1) { set %pok.card2val 0 }
  if (%pok.card3val = 1) { set %pok.card3val 0 }
  if (%pok.card4val = 1) { set %pok.card4val 0 }
  if (%pok.card5val = 1) { set %pok.card5val 0 }
  set %pok.fdraw OFF
  set %pok.draw ON
  besthand
}