on *:EXIT:{ unset %nlhe.#* } alias nlhe.msg { if (($me !ison $1) || (!$2)) return var %delay = $iif(%nlhe.msgdelay != $null,%nlhe.msgdelay,1000) inc %nlhe. [ $+ [ $1 ] $+ .msgtime ] %delay .timer -do $+ $iif(%delay < 300,h,m) 1 [ %nlhe. [ $+ [ $1 ] $+ .msgtime ] ] dec % $+ nlhe. $+ $1 $+ .msgtime %delay $chr(124) msg $1 $iif(c isincs $gettok($chan($1).mode,1,32),$!strip( $2- ),$2-) } alias nlhe.notice { if (($2 !ison $1) || (!$3)) return var %delay = $iif(%nlhe.msgdelay != $null,%nlhe.msgdelay,1000) inc %nlhe. [ $+ [ $1 ] $+ .msgtime ] %delay .timer -do $+ $iif(%delay < 300,h,m) 1 [ %nlhe. [ $+ [ $1 ] $+ .msgtime ] ] dec % $+ nlhe. $+ $1 $+ .msgtime %delay $chr(124) $iif($2 == $me,echo -act notice,.notice $2) $1 > $3- } menu channel { NLHE .$iif($nlhe.menutest($chan),$iif([ %nlhe. [ $+ [ $chan ] $+ .regging ] ] || [ %nlhe. [ $+ [ $chan ] $+ .running ] ],re) $+ start NLHE game registration in $chan):{ nlhe.start $chan } .$iif([ %nlhe. [ $+ [ $chan ] $+ .regging ] ],commence NLHE game in $chan):{ nlhe.begin $chan } .$iif([ %nlhe. [ $+ [ $chan ] $+ .regging ] ] || [ %nlhe. [ $+ [ $chan ] $+ .running ] ],stop NLHE game in $chan):{ nlhe.stop $chan } .- .$submenu($nlhe.setdefaults($1)) } alias nlhe.menutest { if (([ %nlhe. [ $+ [ $1 ] $+ .regging ] ]) || ([ %nlhe. [ $+ [ $1 ] $+ .running ] ])) { if ([ %nlhe. [ $+ [ $1 ] $+ .cid ] ] == $cid) { return 1 } } if (([ %nlhe. [ $+ [ $1 ] $+ .regging ] ] == $null) && ([ %nlhe. [ $+ [ $1 ] $+ .running ] ] == $null)) { return 1 } } alias nlhe.setdefaults { if ((!%nlhe.startblind) || (%nlhe.startblind < 2) || (2 \\ %nlhe.startblind)) { set %nlhe.startblind 50 } if ((!%nlhe.startmoney) || (%nlhe.startmoney < 2) || (1 \\ %nlhe.startmoney)) { set %nlhe.startmoney 10000 } if ((!%nlhe.timeblinds) || (%nlhe.timeblinds < 1) || (1 \\ %nlhe.timeblinds)) { set %nlhe.timeblinds 5 } if ((!%nlhe.timetoact) || (%nlhe.timetoact < 15) || (1 \\ %nlhe.timetoact)) { set %nlhe.timetoact 60 } if ((%nlhe.msgdelay == $null) || (%nlhe.msgdelay < 0) || (%nlhe.msgdelay > 3000) || (1 \\ %nlhe.msgdelay)) { set %nlhe.msgdelay 1000 } var %p1 = starting money = %nlhe.startmoney var %p2 = starting big blind = %nlhe.startblind var %p3 = interval of raising the blinds = %nlhe.timeblinds mins var %p4 = players' time to act = %nlhe.timetoact secs var %p5 = message delay = %nlhe.msgdelay $+ ms if ($1 == begin) return %p1 :{ nlhe.setdefaults sm } if ($1 == 1) return %p2 :{ nlhe.setdefaults sb } if ($1 == 2) return %p3 :{ nlhe.setdefaults tb } if ($1 == 3) return %p4 :{ nlhe.setdefaults ta } if ($1 == 4) return %p5 :{ nlhe.setdefaults md } if ($1 == 5) return - if ($1 == end) return $style(2) v1.02 created by Dav, 2007:{ } if ($1 == sm) { var %q = $input($chr(32),eo,Enter the starting money,%nlhe.startmoney) if ((%q > 1) && (1 // %q)) set %nlhe.startmoney $calc(%q) } if ($1 == sb) { var %q = $input(Enter an even number:,eo,Enter the starting big blind,%nlhe.startblind) if ((%q > 1) && (2 // %q)) set %nlhe.startblind $calc(%q) } if ($1 == tb) { var %q = $input(Enter the number of minutes between 1 and 120:,eo,Enter the time between raising of the blinds,%nlhe.timeblinds) if ((%q > 0) && (1 // %q) && (%q <= 120)) { set %nlhe.timeblinds $calc(%q) var %tname = nlhe. $+ $active $+ .blinds if (($timer(%tname).type == offline) && ([ %nlhe. [ $+ [ $active ] $+ .cid ] ] == $cid)) { .timer $+ %tname off .timer $+ %tname -o 0 $calc(%nlhe.timeblinds * 60) nlhe.raiseblinds $active } } } if ($1 == ta) { var %q = $input(Enter the number of seconds between 15 and 300:,eo,Enter the time players have to act before they will automatically be sat out,%nlhe.timetoact) if ((%q > 14) && (1 // %q) && (%q <= 300)) set %nlhe.timetoact $calc(%q) } if ($1 == md) { var %q = $remove($input(Enter a number between 0 and 3000:,eo,Enter the message delay in ms,%nlhe.msgdelay $+ ms),ms,$chr(32)) if ((%q >= 0) && (1 // %q) && (%q <= 3000)) set %nlhe.msgdelay $calc(%q) } } on *:INPUT:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .regging ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { if (($1 == add) && (!$2)) { nlhe.add $chan $nick } if ($1 == remove) { if (!$2) { nlhe.remove $chan $nick } } } if (([ %nlhe. [ $+ [ $chan ] $+ .running ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .turn ] ] == $nick) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { if ([ %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] ]) { nlhe.sitout $chan $nick in } if (($1 == call) && (!$2)) { nlhe.action $chan $nick call } if (($1 == raise) && ($2)) { if (($iif($2 == to,$3,$2) < 1) || (1 \\ $iif($2 == to,$3,$2))) { nlhe.notice $chan $nick Illegal raise. Use whole numbers only. return } nlhe.action $chan $nick raise $2- } if (($1 == bet) && ($2)) { if (($2 < 1) || (1 \\ $2)) { nlhe.notice $chan $nick Illegal bet. Use whole numbers only. return } nlhe.action $chan $nick bet $2 } if (($1 == fold) && (!$2)) { nlhe.action $chan $nick fold } if (($1 == check) && (!$2)) { nlhe.action $chan $nick check } if (($1- == allin) || ($1- == all in)) { nlhe.allin $chan $nick } } if (([ %nlhe. [ $+ [ $chan ] $+ .running ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { if (($1 == remove) && ($2)) { nlhe.removequitter $chan $2 } if (($1 == add) && ($3)) { nlhe.addnew $chan $2 $3 } if (($1-2 == sit out) && (!$3)) { nlhe.sitout $chan $nick out } if (($1-2 == sit in) && (!$3)) { nlhe.sitout $chan $nick in } if (($1 == back) && (!$2)) { nlhe.sitout $chan $nick in } } } on *:TEXT:add:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .regging ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { nlhe.add $chan $nick } } on *:TEXT:remove*:#:{ if ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid) { if ([ %nlhe. [ $+ [ $chan ] $+ .regging ] ]) { nlhe.remove $chan $nick } elseif ($2) { if ($2 !ison $chan) { nlhe.removequitter $chan $2 } } } } on *:TEXT:nlhe start:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .regging ] ] == $null) && ([ %nlhe. [ $+ [ $chan ] $+ .running ] ] == $null)) { nlhe.start $chan $nick } } on *:TEXT:nlhe stop:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .regging ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .regging ] ] == $nick)) { nlhe.stop $chan } } on *:TEXT:begin:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .regging ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .regging ] ] != 1) && ($istok([ %nlhe. [ $+ [ $chan ] $+ .players ] ],$nick,32)) && (!$istok([ %nlhe. [ $+ [ $chan ] $+ .regging.begin ] ],$nick,32)) && ($numtok([ %nlhe. [ $+ [ $chan ] $+ .players ] ],32) > 1)) { set %nlhe. [ $+ [ $chan ] $+ .regging.begin ] $addtok([ %nlhe. [ $+ [ $chan ] $+ .regging.begin ] ],$nick,32) var %nump = $numtok([ %nlhe. [ $+ [ $chan ] $+ .players ] ],32) var %numb = $numtok([ %nlhe. [ $+ [ $chan ] $+ .regging.begin ] ],32) if ($calc(%numb / %nump) > 0.5) { nlhe.begin $chan } else { nlhe.msg $chan The game will begin when more than half of the players agree to begin. } } } on *:TEXT:call:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .running ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .turn ] ] == $nick) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { if ([ %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] ]) { unset %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] } nlhe.action $chan $nick call } } on *:TEXT:raise *:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .running ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .turn ] ] == $nick) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { if (($iif($2 == to,$3,$2) < 1) || (1 \\ $iif($2 == to,$3,$2))) { nlhe.notice $chan $nick Illegal raise. Use whole numbers only. return } if ([ %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] ]) { unset %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] } nlhe.action $chan $nick raise $2- } } on *:TEXT:bet *:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .running ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .turn ] ] == $nick) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { if (($2 < 1) || (1 \\ $2)) { nlhe.notice $chan $nick Illegal bet. Use whole numbers only. return } if ([ %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] ]) { unset %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] } nlhe.action $chan $nick bet $2 } } on *:TEXT:fold:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .running ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .turn ] ] == $nick) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { if ([ %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] ]) { unset %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] } nlhe.action $chan $nick fold } } on *:TEXT:check:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .running ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .turn ] ] == $nick) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { if ([ %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] ]) { unset %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] } nlhe.action $chan $nick check } } on *:TEXT:all in:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .running ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .turn ] ] == $nick) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { if ([ %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] ]) { unset %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] } nlhe.allin $chan $nick } } on *:TEXT:allin:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .running ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .turn ] ] == $nick) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { if ([ %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] ]) { unset %nlhe. [ $+ [ $chan ] $+ . $+ [ $nick ] $+ .sitout ] } nlhe.allin $chan $nick } } on *:TEXT:sit out:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .running ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { nlhe.sitout $chan $nick out } } on *:TEXT:sit in:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .running ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { nlhe.sitout $chan $nick in } } on *:TEXT:back:#:{ if (([ %nlhe. [ $+ [ $chan ] $+ .running ] ]) && ([ %nlhe. [ $+ [ $chan ] $+ .cid ] ] == $cid)) { nlhe.sitout $chan $nick in } } alias nlhe.start { if (($me ison $1) && (%nlhe.startmoney > 1) && (%nlhe.startblind > 1) && (1 // %nlhe.startmoney) && (2 // %nlhe.startblind)) { var %msgt = [ %nlhe. [ $+ [ $1 ] $+ .msgtime ] ] unset %nlhe. [ $+ [ $1 ] $+ .* ] hfree -w nlhe. $+ $1 .timernlhe. $+ $1 $+ .blinds off .timernlhe. $+ $1 $+ .turn* off if (%msgt) { set %nlhe. [ $+ [ $1 ] $+ .msgtime ] %msgt } set %nlhe. [ $+ [ $1 ] $+ .regging ] $iif($2,$2,1) unset %nlhe. [ $+ [ $1 ] $+ .regging.begin ] set %nlhe. [ $+ [ $1 ] $+ .cid ] $cid nlhe.msg $chan A No Limit Hold'em poker game has been started in this chan. Type 'add' or 'remove' to register. } } alias nlhe.stop { if (($me ison $1) && (([ %nlhe. [ $+ [ $1 ] $+ .regging ] ]) || ([ %nlhe. [ $+ [ $1 ] $+ .running ] ]))) { var %msgt = [ %nlhe. [ $+ [ $1 ] $+ .msgtime ] ] unset %nlhe. [ $+ [ $1 ] $+ .* ] hfree -w nlhe. $+ $1 .timernlhe. $+ $1 $+ .blinds off .timernlhe. $+ $1 $+ .turn* off if (%msgt) { set %nlhe. [ $+ [ $1 ] $+ .msgtime ] %msgt } nlhe.msg $chan The No Limit Hold'em poker game has been stopped. } } alias nlhe.begin { if (($me ison $1) && ([ %nlhe. [ $+ [ $1 ] $+ .cid ] ] == $cid) && ([ %nlhe. [ $+ [ $1 ] $+ .regging ] ]) && ($numtok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],32) > 1)) { unset %nlhe. [ $+ [ $1 ] $+ .regging ] unset %nlhe. [ $+ [ $1 ] $+ .regging.begin ] set %nlhe. [ $+ [ $1 ] $+ .running ] 1 set %nlhe. [ $+ [ $1 ] $+ .blind ] %nlhe.startblind var %i = 1 while ($gettok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],%i,32)) { set %nlhe. [ $+ [ $1 ] $+ . $+ [ $ifmatch ] ] %nlhe.startmoney inc %i } .timernlhe. $+ $1 $+ .blinds -o 0 $calc($iif(1 // %nlhe.timeblinds && %nlhe.timeblinds > 0,%nlhe.timeblinds,10) * 60) nlhe.raiseblinds $1 nlhe.msg $chan The No Limit Hold'em poker game has commenced. set %nlhe. [ $+ [ $1 ] $+ .button ] $gettok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],-1,32) nlhe.nextround $1 } } alias nlhe.add { if (($2 ison $1) && (!$istok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],$2,32)) && ([ %nlhe. [ $+ [ $1 ] $+ .regging ] ])) { if (($2 == blind) || ($2 == nextblind) || (allin*pot* iswm $2) || (playerspot* iswm $2) || (betpot* iswm $2) || ($2 == bb) || ($2 == allallin) || ($2 == cid) || ($2 == deck) || ($2 == msgtime) || ($2 == sb) || ($2 == raiser) || ($2 == bet) || ($2 == players) || ($2 == running) || ($2 == regging) || ($2 == stage) || ($2 == turn) || ($2 == button)) { nlhe.msg $1  $+ $2 $+ : illegal nickname. } elseif ($numtok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],32) > 9) { nlhe.notice $1 $2 Player limit has already been reached } else { set %nlhe. [ $+ [ $1 ] $+ .players ] [ %nlhe. [ $+ [ $1 ] $+ .players ] ] $2 nlhe.notice $1 $2 Added. $iif([ %nlhe. [ $+ [ $1 ] $+ .regging ] ] != 1,Wait for other players to join and if you want to start the game type: 'begin'.) nlhe.msg $1 Current players:  $+ [ %nlhe. [ $+ [ $1 ] $+ .players ] ] $+ . } } } alias nlhe.addnew { if (($2 ison $1) && (1 // $3) && ($3 > 1) && (!$istok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],$2,32)) && ([ %nlhe. [ $+ [ $1 ] $+ .running ] ])) { if (($2 == blind) || ($2 == nextblind) || (allin*pot* iswm $2) || (playerspot* iswm $2) || (betpot* iswm $2) || ($2 == bb) || ($2 == allallin) || ($2 == cid) || ($2 == deck) || ($2 == msgtime) || ($2 == sb) || ($2 == raiser) || ($2 == bet) || ($2 == players) || ($2 == running) || ($2 == regging) || ($2 == stage) || ($2 == turn) || ($2 == button)) { return } elseif ($numtok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],32) > 9) { return } else { set %nlhe. [ $+ [ $1 ] $+ .players ] [ %nlhe. [ $+ [ $1 ] $+ .players ] ] $2 set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] ] $3 nlhe.notice $1 $2 Added you with $ $+ $3 $+ . nlhe.msg $1  $+ $2 $+  has been manually added to the game by the host with $ $+ $3 $+ . } } } alias nlhe.remove { if (($2 ison $1) && ($istok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],$2,32)) && ([ %nlhe. [ $+ [ $1 ] $+ .regging ] ])) { set %nlhe. [ $+ [ $1 ] $+ .players ] $remtok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],$2,1,32) nlhe.notice $1 $2 Removed. nlhe.msg $1 Current players:  $+ $iif([ %nlhe. [ $+ [ $1 ] $+ .players ] ],[ %nlhe. [ $+ [ $1 ] $+ .players ] ],(none)) $+ . } } alias nlhe.removequitter { if (($istok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],$2,32)) && ([ %nlhe. [ $+ [ $1 ] $+ .running ] ])) { if ([ %nlhe. [ $+ [ $1 ] $+ .turn ] ] != $2) { var %i = "" while ((%i < 10) || (!%i)) { var %cp = [ %nlhe. [ $+ [ $1 ] $+ .playerspot $+ [ %i ] ] ] if (%cp) { set %nlhe. [ $+ [ $1 ] $+ .playerspot $+ [ %i ] ] $remtok(%cp,$2,1,32) } inc %i } unset %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .action ] set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] ] 0 nlhe.msg $1  $+ $2 $+  has been forcibly removed from the game. } } } alias nlhe.sitout { if ($3) { if (($istok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],$2,32)) && ([ %nlhe. [ $+ [ $1 ] $+ .running ] ])) { var %curr = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .sitout ] ] if (($3 == out) && (!%curr)) { set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .sitout ] 1 if ([ %nlhe. [ $+ [ $1 ] $+ .turn ] ] == $2) { nlhe.action $1 $2 fold } nlhe.msg $1  $+ $2 is sitting out. $+  nlhe.notice $1 $2 04You are sitting out. Type 'back' if you have returned. } if (($3 == in) && (%curr)) { nlhe.msg $1  $+ $2 is back in the game. $+  nlhe.notice $1 $2 04You are back in the game. unset %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .sitout ] } } } } alias nlhe.nxtblind { if ($1 isnum 2-) { var %o = $1, %osb = $round($calc(%o / 2),0), %n if (%o >= 1000) { var %div = 1 $+ $str(0,$calc($len(%o) - 3)) %o = %o / %div %osb = %osb / %div } if (%o isnum 2-8) { %n = $round($calc((%o + %osb) / 2),0) } elseif (%o isnum 10-108) { %n = $calc($round($calc((%o + %osb) / 10),0) * 5) } elseif (%o isnum 110-282) { %n = $calc($round($calc((%o + %osb) / 50),0) * 25) } elseif (%o isnum 284-) { %n = $calc($round($calc((%o + %osb) / 200),0) * 100) } if (%div) { %n = %n * %div } if (%n) { var %nbb = %n * 2 } return %nbb } } alias nlhe.raiseblinds { if ($1) { if (([ %nlhe. [ $+ [ $1 ] $+ .running ] ]) && ($me ison $1)) { var %cb = [ %nlhe. [ $+ [ $1 ] $+ .blind ] ] set %nlhe. [ $+ [ $1 ] $+ .nextblind ] $nlhe.nxtblind(%cb) } else { .timernlhe. $+ $1 $+ .blinds off } } } alias nlhe.nextp { if ($3) { var %allplist = [ %nlhe. [ $+ [ $1 ] $+ .players ] ], %plist = [ %nlhe. [ $+ [ $1 ] $+ .players $+ [ $2 ] ] ], %nump = $numtok(%allplist,32), %i = $findtok(%allplist,$3,1,32) if ((%nump < 2) || (!%i)) { return $3 } inc %i if (%i > %nump) { %i = 1 } while (%i != $findtok(%allplist,$3,1,32)) { var %c = $gettok(%allplist,%i,32) if (([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] ] ] <= 0) || (!$findtok(%plist,%c,1,32))) { goto inc } return %c :inc inc %i if (%i > %nump) { %i = 1 } } return $3 } } alias nlhe.prevp { if ($3) { var %allplist = [ %nlhe. [ $+ [ $1 ] $+ .players ] ], %plist = [ %nlhe. [ $+ [ $1 ] $+ .players $+ [ $2 ] ] ], %nump = $numtok(%allplist,32), %i = $findtok(%allplist,$3,1,32) if ((%nump < 2) || (!%i)) { return $3 } dec %i if (%i < 1) { %i = %nump } while (%i != $findtok(%allplist,$3,1,32)) { var %c = $gettok(%allplist,%i,32) if (([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] ] ] <= 0) || (!$findtok(%plist,%c,1,32))) { goto dec } return %c :dec dec %i if (%i < 1) { %i = %nump } } return $3 } } alias nlhe.cindex { return $mid(23456789TJQKA,$1,1) } alias nlhe.rcindex { return $pos(23456789TJQKA,$left($1,1),1) } alias nlhe.wordindex { var %c = $left($1,1) if (($len($1) > 1) && ($left($1,1) == $right($1,1))) { var %plur = 1 } if (%c == 2) { return Deuce $+ $iif(%plur,s) } if (%c == 3) { return Three $+ $iif(%plur,s) } if (%c == 4) { return Four $+ $iif(%plur,s) } if (%c == 5) { return Five $+ $iif(%plur,s) } if (%c == 6) { return Six $+ $iif(%plur,es) } if (%c == 7) { return Seven $+ $iif(%plur,s) } if (%c == 8) { return Eight $+ $iif(%plur,s) } if (%c == 9) { return Nine $+ $iif(%plur,s) } if (%c == T) { return Ten $+ $iif(%plur,s) } if (%c == J) { return Jack $+ $iif(%plur,s) } if (%c == Q) { return Queen $+ $iif(%plur,s) } if (%c == K) { return King $+ $iif(%plur,s) } if (%c == A) { return Ace $+ $iif(%plur,s) } } alias nlhe.sortrank { tokenize 32 $1- var %k = 13, %1 = $left($1,1), %2 = $left($2,1), %3 = $left($3,1), %4 = $left($4,1), %5 = $left($5,1), %6 = $left($6,1), %7 = $left($7,1), %cards = %1 %2 %3 %4 %5 %6 %7, %remaining = %cards, %count = 1 while (%k > 0) { if ($matchtok(%remaining,$nlhe.cindex(%k),0,32)) { var %result = %result $gettok($1-,$findtok(%cards,$nlhe.cindex(%k),%count,32),32) %remaining = $remtok(%remaining,$nlhe.cindex(%k),1,32) if ($prop == single) dec %k else inc %count } else { dec %k var %count = 1 } } return %result } alias nlhe.ranking { tokenize 32 $1- var %1 = $left($1,1), %2 = $left($2,1), %3 = $left($3,1), %4 = $left($4,1), %5 = $left($5,1), %6 = $left($6,1), %7 = $left($7,1) var %suits = $right($1,1) $+ $right($2,1) $+ $right($3,1) $+ $right($4,1) $+ $right($5,1) $+ $right($6,1) $+ $right($7,1) var %cards = %1 %2 %3 %4 %5 %6 %7, %hand ; ; STRAIGHT FLUSH ; var %sorted = $nlhe.sortrank($1-) if ($count(%suits,c) >= 5) { var %flushsuit = c } if ($count(%suits,d) >= 5) { var %flushsuit = d } if ($count(%suits,h) >= 5) { var %flushsuit = h } if ($count(%suits,s) >= 5) { var %flushsuit = s } if (%flushsuit) { var %flushcards if ($right($gettok(%sorted,1,32),1) = %flushsuit) { %flushcards = %flushcards $left($gettok(%sorted,1,32),1) } if ($right($gettok(%sorted,2,32),1) = %flushsuit) { %flushcards = %flushcards $left($gettok(%sorted,2,32),1) } if ($right($gettok(%sorted,3,32),1) = %flushsuit) { %flushcards = %flushcards $left($gettok(%sorted,3,32),1) } if ($right($gettok(%sorted,4,32),1) = %flushsuit) { %flushcards = %flushcards $left($gettok(%sorted,4,32),1) } if ($right($gettok(%sorted,5,32),1) = %flushsuit) { %flushcards = %flushcards $left($gettok(%sorted,5,32),1) } if ($right($gettok(%sorted,6,32),1) = %flushsuit) { %flushcards = %flushcards $left($gettok(%sorted,6,32),1) } if ($right($gettok(%sorted,7,32),1) = %flushsuit) { %flushcards = %flushcards $left($gettok(%sorted,7,32),1) } %sorted = $nlhe.sortrank(%flushcards).single if ((A K Q J T isin %sorted) || (K Q J T 9 isin %sorted) || (Q J T 9 8 isin %sorted) || (J T 9 8 7 isin %sorted) || (T 9 8 7 6 isin %sorted) || (9 8 7 6 5 isin %sorted) || (8 7 6 5 4 isin %sorted) || (7 6 5 4 3 isin %sorted) || (6 5 4 3 2 isin %sorted) || ((A isin %sorted) && (5 4 3 2 isin %sorted))) { var %hand.strenght = 9, %kicker = $left($ifmatch,1) goto vl } else { %flushcards = "" } } %sorted = "" ; ; QUADS ; var %i = 0 while (%i <= 13) { inc %i if ($matchtok(%cards,$nlhe.cindex(%i),0,32) == 4) { var %hand = $str($nlhe.cindex(%i),4), %hand.strenght = 8, %remaining = $1- if (%1 = $nlhe.cindex(%i)) { %remaining = $remtok(%remaining,$1,1,32) } if (%2 = $nlhe.cindex(%i)) { %remaining = $remtok(%remaining,$2,1,32) } if (%3 = $nlhe.cindex(%i)) { %remaining = $remtok(%remaining,$3,1,32) } if (%4 = $nlhe.cindex(%i)) { %remaining = $remtok(%remaining,$4,1,32) } if (%5 = $nlhe.cindex(%i)) { %remaining = $remtok(%remaining,$5,1,32) } if (%6 = $nlhe.cindex(%i)) { %remaining = $remtok(%remaining,$6,1,32) } if (%7 = $nlhe.cindex(%i)) { %remaining = $remtok(%remaining,$7,1,32) } var %j = 13 while (%j > 0) { if ($matchtok(%remaining,$nlhe.cindex(%j),0,32)) { var %kicker = $nlhe.cindex(%j) goto vl } dec %j } } } ; ; FULL HOUSE ; var %sorted = $nlhe.sortrank(%cards), %i = 13 while (%i > 0) { if ($matchtok(%sorted,$nlhe.cindex(%i),0,32) == 3) { var %hand = $str($nlhe.cindex(%i),3), %remaining = %sorted while ($findtok(%remaining,$nlhe.cindex(%i),0,32)) { %remaining = $remtok(%remaining,$nlhe.cindex(%i),1,32) } var %j = 13 while (%j > 0) { if ($matchtok(%remaining,$nlhe.cindex(%j),0,32) >= 2) { var %kicker = $str($nlhe.cindex(%j),2), %hand.strenght = 7 goto vl } dec %j } if (!%hand.strenght) { var %sorted = "", %hand = "" } } dec %i } ; ; FLUSH ; if ($count(%suits,c) >= 5) { var %flushsuit = c } if ($count(%suits,d) >= 5) { var %flushsuit = d } if ($count(%suits,h) >= 5) { var %flushsuit = h } if ($count(%suits,s) >= 5) { var %flushsuit = s } if (%flushsuit) { var %hand.strenght = 6, %flushcards if ($right($1,1) = %flushsuit) { %flushcards = %flushcards %1 } if ($right($2,1) = %flushsuit) { %flushcards = %flushcards %2 } if ($right($3,1) = %flushsuit) { %flushcards = %flushcards %3 } if ($right($4,1) = %flushsuit) { %flushcards = %flushcards %4 } if ($right($5,1) = %flushsuit) { %flushcards = %flushcards %5 } if ($right($6,1) = %flushsuit) { %flushcards = %flushcards %6 } if ($right($7,1) = %flushsuit) { %flushcards = %flushcards %7 } %hand = $remove($gettok($nlhe.sortrank(%flushcards),1-5,32),$chr(32)) goto vl } ; ; STRAIGHT ; var %sorted = $nlhe.sortrank(%cards).single if ((A K Q J T isin %sorted) || (K Q J T 9 isin %sorted) || (Q J T 9 8 isin %sorted) || (J T 9 8 7 isin %sorted) || (T 9 8 7 6 isin %sorted) || (9 8 7 6 5 isin %sorted) || (8 7 6 5 4 isin %sorted) || (7 6 5 4 3 isin %sorted) || (6 5 4 3 2 isin %sorted) || ((A isin %sorted) && (5 4 3 2 isin %sorted))) { var %hand.strenght = 5, %kicker = $left($ifmatch,1) goto vl } ; ; TRIPS ; var %sorted = $nlhe.sortrank(%cards), %i = 13 while (%i > 0) { if ($matchtok(%sorted,$nlhe.cindex(%i),0,32) == 3) { var %hand = $str($nlhe.cindex(%i),3), %hand.strenght = 4, %remaining = %sorted while ($findtok(%remaining,$nlhe.cindex(%i),0,32)) { %remaining = $remtok(%remaining,$nlhe.cindex(%i),1,32) } var %kicker = $gettok(%remaining,1,32) $+ $gettok(%remaining,2,32) goto vl } dec %i } ; ; TWO PAIR ; var %i = 13, %remaining = %sorted while (%i > 0) { if ($matchtok(%sorted,$nlhe.cindex(%i),0,32) == 2) { var %hand = $str($nlhe.cindex(%i),2) while ($findtok(%remaining,$nlhe.cindex(%i),0,32)) { %remaining = $remtok(%remaining,$nlhe.cindex(%i),1,32) } var %j = 13 while (%j > 0) { if ($matchtok(%remaining,$nlhe.cindex(%j),0,32) == 2) { var %hand = %hand $+ $str($nlhe.cindex(%j),2), %hand.strenght = 3 while ($findtok(%remaining,$nlhe.cindex(%j),0,32)) { %remaining = $remtok(%remaining,$nlhe.cindex(%j),1,32) } var %kicker = $gettok(%remaining,1,32) goto vl } dec %j } ; ; PAIR ; var %hand.strenght = 2, %kicker = $gettok(%remaining,1,32) $+ $gettok(%remaining,2,32) $+ $gettok(%remaining,3,32) goto vl } dec %i } ; ; HIGH CARD ; var %hand.strenght = 1, %kicker = $remove($gettok(%sorted,1-5,32),$chr(32)) :vl var %ret = %hand.strenght if (%hand) { %ret = $instok(%ret,%hand,2,46) } if (%kicker) { %ret = $instok(%ret,%kicker,3,46) } return %ret } alias nlhe.showdown { tokenize 32 $1- var %i = 0, %winner while (%i < $0) { inc %i var %p [ $+ [ %i ] ] [ $ $+ [ %i ] ] var %pp [ $+ [ %i ] ] 0 } var %j = 10, %k = 9 while (%j > 0) { if (%p [ $+ [ %j ] ]) { while (%k > 0) { if ($nlhe.value(%p [ $+ [ %j ] ],%p [ $+ [ %k ] ]) == 1) dec %pp [ $+ [ %k ] ] elseif ($nlhe.value(%p [ $+ [ %j ] ],%p [ $+ [ %k ] ]) == 2) dec %pp [ $+ [ %j ] ] dec %k } } dec %j %k = %j - 1 } var %j = 10 while (%j > 0) { if (%pp [ $+ [ %j ] ] == 0) { %winner = %j %winner } dec %j } return %winner } alias nlhe.value { var %1.rank = $gettok($1,1,46), %2.rank = $gettok($2,1,46), %1.hand = $gettok($1,2,46), %2.hand = $gettok($2,2,46), %1.kicker = $gettok($1,$iif($gettok($1,3,46),3,2),46), %2.kicker = $gettok($2,$iif($gettok($2,3,46),3,2),46) if (%1.rank > %2.rank) return 1 elseif (%1.rank == %2.rank) { if (%1.rank == 9) { if ($nlhe.rcindex(%1.kicker) > $nlhe.rcindex(%2.kicker)) return 1 elseif ($nlhe.rcindex(%1.kicker) == $nlhe.rcindex(%2.kicker)) return 3 else return 2 } if ((%1.rank == 8) || (%1.rank == 7)) { if ($nlhe.rcindex(%1.hand) > $nlhe.rcindex(%2.hand)) return 1 elseif ($nlhe.rcindex(%1.hand) == $nlhe.rcindex(%2.hand)) { if ($nlhe.rcindex(%1.kicker) > $nlhe.rcindex(%2.kicker)) return 1 elseif ($nlhe.rcindex(%1.kicker) == $nlhe.rcindex(%2.kicker)) return 3 else return 2 } else return 2 } if ((%1.rank == 6) || (%1.rank == 1)) { if ($nlhe.rcindex($mid(%1.hand,1,1)) == $nlhe.rcindex($mid(%2.hand,1,1))) { if ($nlhe.rcindex($mid(%1.hand,2,1)) == $nlhe.rcindex($mid(%2.hand,2,1))) { if ($nlhe.rcindex($mid(%1.hand,3,1)) == $nlhe.rcindex($mid(%2.hand,3,1))) { if ($nlhe.rcindex($mid(%1.hand,4,1)) == $nlhe.rcindex($mid(%2.hand,4,1))) { if ($nlhe.rcindex($mid(%1.hand,5,1)) == $nlhe.rcindex($mid(%2.hand,5,1))) { return 3 } elseif ($nlhe.rcindex($mid(%1.hand,5,1)) > $nlhe.rcindex($mid(%2.hand,5,1))) return 1 else return 2 } elseif ($nlhe.rcindex($mid(%1.hand,4,1)) > $nlhe.rcindex($mid(%2.hand,4,1))) return 1 else return 2 } elseif ($nlhe.rcindex($mid(%1.hand,3,1)) > $nlhe.rcindex($mid(%2.hand,3,1))) return 1 else return 2 } elseif ($nlhe.rcindex($mid(%1.hand,2,1)) > $nlhe.rcindex($mid(%2.hand,2,1))) return 1 else return 2 } elseif ($nlhe.rcindex($mid(%1.hand,1,1)) > $nlhe.rcindex($mid(%2.hand,1,1))) return 1 else return 2 } if (%1.rank == 5) { if ($nlhe.rcindex(%1.kicker) > $nlhe.rcindex(%2.kicker)) return 1 elseif ($nlhe.rcindex(%1.kicker) == $nlhe.rcindex(%2.kicker)) return 3 else return 2 } if (%1.rank == 4) { if ($nlhe.rcindex(%1.hand) > $nlhe.rcindex(%2.hand)) return 1 elseif ($nlhe.rcindex(%1.hand) == $nlhe.rcindex(%2.hand)) { if ($nlhe.rcindex(%1.kicker) > $nlhe.rcindex(%2.kicker)) return 1 elseif ($nlhe.rcindex(%1.kicker) == $nlhe.rcindex(%2.kicker)) { if ($nlhe.rcindex($mid(%1.kicker,2,1)) > $nlhe.rcindex($mid(%2.kicker,2,1))) return 1 elseif ($nlhe.rcindex($mid(%1.kicker,2,1)) == $nlhe.rcindex($mid(%2.kicker,2,1))) { return 3 } else return 2 } else return 2 } else return 2 } if (%1.rank == 3) { if ($nlhe.rcindex(%1.hand) > $nlhe.rcindex(%2.hand)) return 1 elseif ($nlhe.rcindex(%1.hand) == $nlhe.rcindex(%2.hand)) { if ($nlhe.rcindex($mid(%1.hand,3,1)) > $nlhe.rcindex($mid(%2.hand,3,1))) return 1 elseif ($nlhe.rcindex($mid(%1.hand,3,1)) == $nlhe.rcindex($mid(%2.hand,3,1))) { if ($nlhe.rcindex(%1.kicker) > $nlhe.rcindex(%2.kicker)) return 1 elseif ($nlhe.rcindex(%1.kicker) == $nlhe.rcindex(%2.kicker)) { return 3 } else return 2 } else return 2 } else return 2 } if (%1.rank == 2) { if ($nlhe.rcindex(%1.hand) > $nlhe.rcindex(%2.hand)) return 1 elseif ($nlhe.rcindex(%1.hand) == $nlhe.rcindex(%2.hand)) { if ($nlhe.rcindex(%1.kicker) > $nlhe.rcindex(%2.kicker)) return 1 elseif ($nlhe.rcindex(%1.kicker) == $nlhe.rcindex(%2.kicker)) { if ($nlhe.rcindex($mid(%1.kicker,2,1)) > $nlhe.rcindex($mid(%2.kicker,2,1))) return 1 elseif ($nlhe.rcindex($mid(%1.kicker,2,1)) == $nlhe.rcindex($mid(%2.kicker,2,1))) { if ($nlhe.rcindex($mid(%1.kicker,3,1)) > $nlhe.rcindex($mid(%2.kicker,3,1))) return 1 elseif ($nlhe.rcindex($mid(%1.kicker,3,1)) == $nlhe.rcindex($mid(%2.kicker,3,1))) { return 3 } else return 2 } else return 2 } else return 2 } else return 2 } } else return 2 } alias nlhe.valuewords { var %rank = $gettok($1,1,46), %hand = $gettok($1,2,46), %kicker = $gettok($1,$iif($gettok($1,3,46),3,2),46), %line if (!%hand) return if ((%rank == 9) || (%rank == 5)) { %line = Straight $+ $iif(%rank == 9,$chr(32) $+ Flush) $+ $chr(44) var %to = $nlhe.wordindex(%kicker) if (%kicker == 5) { var %from = Ace } else { var %from = $nlhe.wordindex($nlhe.cindex($calc($nlhe.rcindex(%kicker) - 4))) } if ((%rank == 9) && (%kicker == A)) { return Royal Flush } return %line %from to %to } if (%rank == 8) { return Four Of A Kind $+ $chr(44) $nlhe.wordindex(%hand) + %kicker kicker } if (%rank == 7) { return Full House $+ $chr(44) $nlhe.wordindex(%hand) full of $nlhe.wordindex(%kicker) } if (%rank == 6) { return Flush $+ $chr(44) $nlhe.wordindex($left(%kicker,1)) high ( $+ %kicker $+ ) } if (%rank == 4) { return Three Of A Kind $+ $chr(44) $nlhe.wordindex(%hand) + %kicker kickers } if (%rank == 3) { return Two Pair $+ $chr(44) $nlhe.wordindex($left(%hand,2)) over $nlhe.wordindex($right(%hand,2)) + %kicker kicker } if (%rank == 2) { return Pair of $nlhe.wordindex(%hand) $+  + %kicker kickers } if (%rank == 1) { return  $+ $nlhe.wordindex($left(%kicker,1)) High ( $+ %kicker $+ ) } } alias nlhe.action { if ([ %nlhe. [ $+ [ $1 ] $+ .running ] ]) { var %amount, %currentmoney = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] ] ] if (([ %nlhe. [ $+ [ $1 ] $+ .allinpot ] ]) && ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .investedpot ] ] >= [ %nlhe. [ $+ [ $1 ] $+ .allinamountpot ] ])) { var %i = 0 while (%i < 10) { inc %i var %cinvv = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .investedpot $+ [ %i ] ] ] var %cbett = $iif([ %nlhe. [ $+ [ $1 ] $+ .allinpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .allinamountpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .betpot $+ [ %i ] ] ]) if (%cinvv < %cbett) { var %currentpot = pot $+ %i goto foundpot } elseif ((!%cbett) && (!%currentpot)) { var %currentpot = pot $+ %i goto foundpot } elseif ((%cinvv == %cbett) && (%cbett) && ([ %nlhe. [ $+ [ $1 ] $+ .allinpot $+ [ %i ] ] ] == $null)) { var %currentpot = pot $+ %i } } } if (!%currentpot) { var %currentpot = pot } :foundpot var %i = $iif($remove(%currentpot,pot),$remove(%currentpot,pot),0) while (%i < 10) { inc %i if ([ %nlhe. [ $+ [ $1 ] $+ .playerspot $+ [ %i ] ] ] == $null) { var %nextpot = pot $+ %i goto foundnextpot } } :foundnextpot if ($3 == sb) { %amount = [ %nlhe. [ $+ [ $1 ] $+ .blind ] ] %amount = $round($calc(%amount / 2),0) if (%currentmoney < %amount) { var %tp = %currentmoney } else { var %tp = %amount } set %nlhe. [ $+ [ $1 ] $+ .pot ] %tp set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .investedpot ] %tp dec %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] ] %tp .timer -m 1 1 nlhe.action $1 [ %nlhe. [ $+ [ $1 ] $+ .bb ] ] bb if (%tp == %currentmoney) { set %nlhe. [ $+ [ $1 ] $+ .betpot ] %tp set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .action ] raise set %nlhe. [ $+ [ $1 ] $+ .raiser ] $2 set %nlhe. [ $+ [ $1 ] $+ .allinamountpot ] %tp set %nlhe. [ $+ [ $1 ] $+ .allinpot ] $2 nlhe.msg $1  $+ $2 $+  goes all in in the small blind for $ $+ %tp $+ . return } else { nlhe.msg $1  $+ $2 $+  posts the small blind of $ $+ %tp $+ . } } if ($3 == bb) { if ([ %nlhe. [ $+ [ $1 ] $+ .allinamountpot ] ]) { var %sbamount = $ifmatch, %amount = [ %nlhe. [ $+ [ $1 ] $+ .blind ] ], %tp = $calc(%amount - %sbamount) if (%tp) { set %nlhe. [ $+ [ $1 ] $+ .betpot1 ] %tp } if (%currentmoney < %amount) { nlhe.msg $1  $+ $2 $+  posts $ $+ %currentmoney $+  of the big blind. } else { nlhe.msg $1  $+ $2 $+  posts the big blind of $ $+ %amount $+ . } .timer -m 1 1 nlhe.action $1 $2 call silent return } %amount = [ %nlhe. [ $+ [ $1 ] $+ .blind ] ] if (%currentmoney < %amount) { var %tp = %currentmoney } else { var %tp = %amount } if (%tp == %currentmoney) { var %mpot = [ %nlhe. [ $+ [ $1 ] $+ .pot ] ], %sblind = [ %nlhe. [ $+ [ $1 ] $+ .sb ] ] if ((%mpot > %tp) && ($nlhe.nextp($1,pot,%sblind) != %sblind)) { set %nlhe. [ $+ [ $1 ] $+ .pot ] $calc(%tp * 2) set %nlhe. [ $+ [ $1 ] $+ .pot1 ] $calc(%mpot - %tp) set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .investedpot ] %tp set %nlhe. [ $+ [ $1 ] $+ . $+ [ %sblind ] $+ .investedpot ] %tp set %nlhe. [ $+ [ $1 ] $+ . $+ [ %sblind ] $+ .investedpot1 ] $calc(%mpot - %tp) set %nlhe. [ $+ [ $1 ] $+ .playerspot1 ] [ %nlhe. [ $+ [ $1 ] $+ .sb ] ] dec %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] ] %tp } else { inc %nlhe. [ $+ [ $1 ] $+ .pot ] %tp set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .investedpot ] %tp dec %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] ] %tp } set %nlhe. [ $+ [ $1 ] $+ .betpot ] %tp if ($nlhe.nextp($1,pot,%sblind) != %sblind) { var %betnewpot = $calc(%nlhe. [ $+ [ $1 ] $+ .blind ] - %tp) if (%betnewpot) { set %nlhe. [ $+ [ $1 ] $+ .betpot1 ] %betnewpot } } set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .action ] raise set %nlhe. [ $+ [ $1 ] $+ .raiser ] $2 set %nlhe. [ $+ [ $1 ] $+ .allinamountpot ] %tp set %nlhe. [ $+ [ $1 ] $+ .allinpot ] $2 nlhe.msg $1  $+ $2 $+  goes all in in the big blind for $ $+ %tp $+ . .timer -m 1 1 nlhe.nextturn $1 return } else { inc %nlhe. [ $+ [ $1 ] $+ .pot ] %tp set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .investedpot ] %tp dec %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] ] %tp set %nlhe. [ $+ [ $1 ] $+ .betpot ] %amount nlhe.msg $1  $+ $2 $+  posts the big blind of $ $+ %amount $+ . .timer -m 1 1 nlhe.nextturn $1 } } if ($3 == call) { if ($5 != $null) { var %currentpot = $4, %tb = [ %nlhe. [ $+ [ $1 ] $+ .bet $+ [ %currentpot ] ] ], %ti = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .invested $+ [ %currentpot ] ] ] %tb = $iif([ %nlhe. [ $+ [ $1 ] $+ .allin $+ [ %currentpot ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .allinamount $+ [ %currentpot ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .bet $+ [ %currentpot ] ] ]) if (%currentmoney < $5) { var %tp = %currentmoney } else { var %tp = $5 } var %tx = $calc(%tp + %ti) if (%tp != $5) { ; TO CALL ALL IN var %i = 1, %plist = [ %nlhe. [ $+ [ $1 ] $+ .players $+ [ %currentpot ] ] ], %allinamount = %tx while ($gettok(%plist,%i,32)) { var %c = $ifmatch, %invv = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .invested $+ [ %currentpot ] ] ] if ((%c != $2) && (%invv >= %tx)) { var %split = $calc(%split + (%invv - %tx)) set %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .invested $+ [ %currentpot ] ] %tx if (%c != $2) { set %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .invested $+ [ %nextpot ] ] $calc(%invv - %allinamount) set %nlhe. [ $+ [ $1 ] $+ .players $+ [ %nextpot ] ] $addtok([ %nlhe. [ $+ [ $1 ] $+ .players $+ [ %nextpot ] ] ],%c,32) } } inc %i } var %cpamount = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ %currentpot ] ] ] set %nlhe. [ $+ [ $1 ] $+ .players $+ [ %currentpot ] ] $addtok([ %nlhe. [ $+ [ $1 ] $+ .players $+ [ %currentpot ] ] ],$2,32) set %nlhe. [ $+ [ $1 ] $+ . $+ [ %currentpot ] ] $calc(%cpamount + %tp - %split) set %nlhe. [ $+ [ $1 ] $+ . $+ [ %nextpot ] ] %split if ([ %nlhe. [ $+ [ $1 ] $+ .allinamount $+ [ %currentpot ] ] ]) { set %nlhe. [ $+ [ $1 ] $+ .allinamount $+ [ %nextpot ] ] $calc(%tb - %tx) } if ([ %nlhe. [ $+ [ $1 ] $+ .allin $+ [ %currentpot ] ] ]) { set %nlhe. [ $+ [ $1 ] $+ .allin $+ [ %nextpot ] ] $ifmatch } set %nlhe. [ $+ [ $1 ] $+ .allinamount $+ [ %currentpot ] ] %tx set %nlhe. [ $+ [ $1 ] $+ .bet $+ [ %currentpot ] ] %tx set %nlhe. [ $+ [ $1 ] $+ .bet $+ [ %nextpot ] ] $calc(%tb - %tx) } else { set %nlhe. [ $+ [ $1 ] $+ .players $+ [ %currentpot ] ] $addtok([ %nlhe. [ $+ [ $1 ] $+ .players $+ [ %currentpot ] ] ],$2,32) inc %nlhe. [ $+ [ $1 ] $+ . $+ [ %currentpot ] ] %tp } inc %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .invested $+ [ %currentpot ] ] %tp dec %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] ] %tp set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .action ] call if (([ %nlhe. [ $+ [ $1 ] $+ .raiser ] ] != $2) && ($7 != silent)) { nlhe.msg $1  $+ $2 $+  calls +$ $+ %tp $+  $+ $iif($4 != pot,$chr(32) $+ into side pot $remove($4,pot) $+ .,.) } if ($6) { if ([ %nlhe. [ $+ [ $1 ] $+ .raiser ] ] != $2) { .timer -m 1 1 nlhe.nextturn $1 } else { .timer -m 1 1 nlhe.action $1 $2 bet [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .raiseamount ] ] } } } else { var %xbet = [ %nlhe. [ $+ [ $1 ] $+ .bet $+ [ %currentpot ] ] ], %xinv = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .invested $+ [ %currentpot ] ] ] if (%xinv == $null) { %xinv = 0 } if ((%xbet != $null) && (%xinv < %xbet)) { var %i = $remove(%currentpot,pot), %amount = 0 if (!%i) { %i = "" } while ((%i < 10) || (!%i)) { var %cinvv = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .investedpot $+ [ %i ] ] ] var %cbett = $iif([ %nlhe. [ $+ [ $1 ] $+ .allinpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .allinamountpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .betpot $+ [ %i ] ] ]) if (%cinvv < %cbett) { var %amount = $calc(%amount + %cbett - %cinvv) var %lastamount = %i if (%amount >= %currentmoney) { %i = 11 } } inc %i } var %i = $remove(%currentpot,pot), %amount = 0 if (!%i) { %i = "" } while ((%i < 10) || (!%i)) { var %cinvv = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .investedpot $+ [ %i ] ] ] var %cbett = $iif([ %nlhe. [ $+ [ $1 ] $+ .allinpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .allinamountpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .betpot $+ [ %i ] ] ]) if (%cinvv < %cbett) { var %amount = $calc(%amount + %cbett - %cinvv) .timer -h 1 $calc(10 * %i + 1) nlhe.action $1 $2 call pot $+ %i $calc(%cbett - %cinvv) $iif(%lastamount = %i,1,0) $iif($4 == silent,silent) if (%amount >= %currentmoney) { %i = 11 } } inc %i } if (!%amount) { var %amount = $calc(%xbet - %xinv) .timer -m 1 1 nlhe.action $1 $2 call %currentpot %amount 1 } } elseif ([ %nlhe. [ $+ [ $1 ] $+ .raiser ] ] == $2) { .timer -m 1 1 nlhe.action $1 $2 bet [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .raiseamount ] ] } else { nlhe.notice $1 $2 There is nothing to call. } } } if ($3 == bet) { if (([ %nlhe. [ $+ [ $1 ] $+ .bet $+ [ %currentpot ] ] ]) && ([ %nlhe. [ $+ [ $1 ] $+ .raiser ] ] != $2)) { nlhe.notice $1 $2 You can't bet here. return } elseif ([ %nlhe. [ $+ [ $1 ] $+ .raiser ] ] == $null) { if (($4 < [ %nlhe. [ $+ [ $1 ] $+ .blind ] ]) && ($4 < %currentmoney)) { nlhe.notice $1 $2 You must at bet at least the big blind: $ $+ [ %nlhe. [ $+ [ $1 ] $+ .blind ] ] $+ . return } } if (%currentmoney < $4) { var %tp = %currentmoney } else { var %tp = $4 } set %nlhe. [ $+ [ $1 ] $+ .players $+ [ %currentpot ] ] $addtok([ %nlhe. [ $+ [ $1 ] $+ .players $+ [ %currentpot ] ] ],$2,32) inc %nlhe. [ $+ [ $1 ] $+ . $+ [ %currentpot ] ] %tp inc %nlhe. [ $+ [ $1 ] $+ .bet $+ [ %currentpot ] ] %tp inc %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .invested $+ [ %currentpot ] ] %tp dec %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] ] %tp unset %nlhe. [ $+ [ $1 ] $+ .*.action ] set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .action ] raise if ([ %nlhe. [ $+ [ $1 ] $+ .raiser ] ] != $2) { nlhe.msg $1  $+ $2 $+  bets $ $+ %tp $+  $+ $iif(%currentpot != pot,$chr(32) $+ into side pot $remove(%currentpot,pot) $+ .,.) } set %nlhe. [ $+ [ $1 ] $+ .raiser ] $2 .timer -m 1 1 nlhe.nextturn $1 } if ($3 == raise) { var %xbet = [ %nlhe. [ $+ [ $1 ] $+ .bet $+ [ %currentpot ] ] ], %xmoney = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] ] ], %xinv = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .invested $+ [ %currentpot ] ] ] if (%xinv == $null) { %xinv = 0 } var %i = $remove(%currentpot,pot), %amount = 0 if (!%i) { %i = "" } while ((%i < 10) || (!%i)) { var %cinvv = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .investedpot $+ [ %i ] ] ] var %cbett = $iif([ %nlhe. [ $+ [ $1 ] $+ .allinpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .allinamountpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .betpot $+ [ %i ] ] ]) if (%cinvv < %cbett) { var %totalbet = $calc(%totalbet + %cbett) var %totalinv = $calc(%totalinv + %cinvv) var %amount = $calc(%amount + %cbett - %cinvv) if (%amount >= %currentmoney) { %i = 11 } } inc %i } if (!%amount) { var %amount = $calc(%xbet - %xinv) var %totalbet = %xbet var %totalinv = %xinv } if (!%totalbet) { nlhe.notice $1 $2 You can't raise here. return } var %xraise = $iif($4 == to,$5,$calc($4 + %totalbet)) if (%xraise) { if ($calc(%xmoney + %totalinv) < %xraise) { var %xraise = $calc(%xmoney + %totalinv) } var %prevraiser = [ %nlhe. [ $+ [ $1 ] $+ .raiser ] ] if (%prevraiser != $2) { var %prevraise = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ %prevraiser ] $+ .raiseamount ] ] } if (%amount >= %xmoney) { nlhe.notice $1 $2 You don't have enough money to raise. return } if (($calc(%xraise - %totalbet) < $calc($iif(%prevraise,%prevraise,%totalbet))) && ($calc(%xraise - %totalinv) < %xmoney)) { nlhe.notice $1 $2 Illegal raise. You must at least double the bet. return } unset %nlhe. [ $+ [ $1 ] $+ .*.action ] set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .action ] raise set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .raiseamount ] $calc(%xraise - %totalbet) set %nlhe. [ $+ [ $1 ] $+ .raiser ] $2 nlhe.msg $1  $+ $2 $+  raises $iif(%currentpot != pot,the side pot $remove(%currentpot,pot) bet) from $ $+ %totalbet $+  to $ $+ %xraise $+ . .timer -m 1 1 nlhe.action $1 $2 call } } if ($3 == fold) { var %i = "" while ((%i < 10) || (!%i)) { var %cp = [ %nlhe. [ $+ [ $1 ] $+ .playerspot $+ [ %i ] ] ] if (%cp) { set %nlhe. [ $+ [ $1 ] $+ .playerspot $+ [ %i ] ] $remtok(%cp,$2,1,32) } inc %i } unset %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .action ] nlhe.msg $1  $+ $2 $+  folds. .timer -m 1 1 nlhe.nextturn $1 } if ($3 == check) { var %inv = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .invested $+ [ %currentpot ] ] ], %bet = [ %nlhe. [ $+ [ $1 ] $+ .bet $+ [ %currentpot ] ] ] if ((%inv != $null) && (%bet != $null) && (%inv == %bet) && ([ %nlhe. [ $+ [ $1 ] $+ .stage ] ] == preflop) && ([ %nlhe. [ $+ [ $1 ] $+ .bb ] ] == $2)) { nlhe.msg $1  $+ $2 $+  checks. set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .action ] check .timer -m 1 1 nlhe.nextturn $1 } elseif (!%bet) { nlhe.msg $1  $+ $2 $+  checks. set %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .action ] check .timer -m 1 1 nlhe.nextturn $1 } else { nlhe.notice $1 $2 You can't check here. } } if ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] ] ] <= 0) { if ([ %nlhe. [ $+ [ $1 ] $+ .allinamount $+ [ %currentpot ] ] ] == $null) { set %nlhe. [ $+ [ $1 ] $+ .allinamount $+ [ %currentpot ] ] $iif(%tx,%tx,[ %nlhe. [ $+ [ $1 ] $+ .bet $+ [ %currentpot ] ] ]) } set %nlhe. [ $+ [ $1 ] $+ .allin $+ [ %currentpot ] ] $addtok([ %nlhe. [ $+ [ $1 ] $+ .allin $+ [ %currentpot ] ] ],$2,32) nlhe.msg $1  $+ $2 $+  is all in. } } } alias nlhe.allin { if ([ %nlhe. [ $+ [ $1 ] $+ .running ] ]) { var %amount, %currentmoney = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] ] ] if (([ %nlhe. [ $+ [ $1 ] $+ .allinpot ] ]) && ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .investedpot ] ] >= [ %nlhe. [ $+ [ $1 ] $+ .allinamountpot ] ])) { var %i = 0 while (%i < 10) { inc %i var %cinvv = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .investedpot $+ [ %i ] ] ] var %cbett = $iif([ %nlhe. [ $+ [ $1 ] $+ .allinpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .allinamountpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .betpot $+ [ %i ] ] ]) if (%cinvv < %cbett) { var %currentpot = pot $+ %i goto foundpot } elseif ((!%cbett) && (!%currentpot)) { var %currentpot = pot $+ %i goto foundpot } elseif ((%cinvv == %cbett) && (%cbett) && ([ %nlhe. [ $+ [ $1 ] $+ .allinpot $+ [ %i ] ] ] == $null)) { var %currentpot = pot $+ %i } } } if (!%currentpot) { var %currentpot = pot } :foundpot var %i = $iif($remove(%currentpot,pot),$remove(%currentpot,pot),0) while (%i < 10) { inc %i if ([ %nlhe. [ $+ [ $1 ] $+ .playerspot $+ [ %i ] ] ] == $null) { var %nextpot = pot $+ %i goto foundnextpot } } :foundnextpot if (([ %nlhe. [ $+ [ $1 ] $+ .bet $+ [ %currentpot ] ] ]) && ([ %nlhe. [ $+ [ $1 ] $+ .raiser ] ] != $2)) { } else { nlhe.action $1 $2 bet %currentmoney return } var %xbet = [ %nlhe. [ $+ [ $1 ] $+ .bet $+ [ %currentpot ] ] ], %xmoney = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] ] ], %xinv = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .invested $+ [ %currentpot ] ] ] if (%xinv == $null) { %xinv = 0 } var %i = $remove(%currentpot,pot), %amount = 0 if (!%i) { %i = "" } while ((%i < 10) || (!%i)) { var %cinvv = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ $2 ] $+ .investedpot $+ [ %i ] ] ] var %cbett = $iif([ %nlhe. [ $+ [ $1 ] $+ .allinpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .allinamountpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .betpot $+ [ %i ] ] ]) if (%cinvv < %cbett) { var %totalbet = $calc(%totalbet + %cbett) var %totalinv = $calc(%totalinv + %cinvv) var %amount = $calc(%amount + %cbett - %cinvv) if (%amount >= %currentmoney) { %i = 11 } } inc %i } if (!%amount) { var %amount = $calc(%xbet - %xinv) var %totalbet = %xbet var %totalinv = %xinv } if (!%totalbet) { nlhe.action $1 $2 bet %currentmoney return } elseif (%amount >= %currentmoney) { nlhe.action $1 $2 call return } else { nlhe.action $1 $2 raise %currentmoney return } nlhe.action $1 $2 call } } alias nlhe.takecard { var %deck = $hget(nlhe. $+ $1,deck) if (%deck) { ; var %r = $rand(1,$numtok(%deck,32)) var %r = 1 hadd nlhe. $+ $1 deck $deltok(%deck,%r,32) return $gettok(%deck,%r,32) } } alias nlhe.colorcards { var %j = 1 while ($gettok($1-,%j,32)) { var %ccard = $ifmatch, %color if ($right(%ccard,1) == c) { %color = 03 } if ($right(%ccard,1) == d) { %color = 12 } if ($right(%ccard,1) == h) { %color = 04 } if ($right(%ccard,1) == s) { %color = "" } var %output = %output %color $+  $+ $left(%ccard,1) $+  $+ $right(%ccard,1) $+ $iif(%color,) inc %j } return %output } alias nlhe.nextround { if ([ %nlhe. [ $+ [ $1 ] $+ .running ] ]) { unset %nlhe. [ $+ [ $1 ] $+ .allinpot* ] unset %nlhe. [ $+ [ $1 ] $+ .allinamountpot* ] unset %nlhe. [ $+ [ $1 ] $+ .board ] unset %nlhe. [ $+ [ $1 ] $+ .pot* ] unset %nlhe. [ $+ [ $1 ] $+ .playerspot* ] unset %nlhe. [ $+ [ $1 ] $+ .allallin ] var %cb = [ %nlhe. [ $+ [ $1 ] $+ .blind ] ], %nb = [ %nlhe. [ $+ [ $1 ] $+ .nextblind ] ] if (%nb > %cb) { set %nlhe. [ $+ [ $1 ] $+ .blind ] %nb nlhe.msg $1 The blinds are going up. They are now at:  $+ $round($calc(%nb / 2),0) $+ / $+ %nb $+ . var %allplist = [ %nlhe. [ $+ [ $1 ] $+ .players ] ], %nump = $numtok(%allplist,32), %i = 1, %totalm = 0 while ($gettok(%allplist,%i,32)) { var %c = $ifmatch inc %totalm [ %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] ] ] inc %i } var %avg = $round($calc(%totalm / %nump),0) var %tnb = $nlhe.nxtblind(%nb) if ($calc(%avg / %tnb) < 10) { nlhe.msg $1 The blinds have reached their maximum. .timernlhe. $+ $1 $+ .blinds off } else { %tnb = $nlhe.nxtblind(%tnb) if ($calc(%avg / %tnb) < 10) { var %tname = nlhe. $+ $1 $+ .blinds if ($timer(%tname)) { var %cdelay = $round($calc($timer(%tname).delay / 60),0) var %cstat = $timer(%tname).type if (%cstat == offline) { .timer $+ %tname off .timer $+ %tname 0 $calc(%cdelay * 120) nlhe.raiseblinds $1 nlhe.msg $1  $+ $calc(%cdelay * 2) minutes remain until the blinds reach their maximum. } else { nlhe.msg $1 The blinds will be raised once more, because the number of players has decreased. nlhe.msg $1  $+ %cdelay minutes remain until the blinds reach their maximum. } } } } } set %nlhe. [ $+ [ $1 ] $+ .playerspot ] [ %nlhe. [ $+ [ $1 ] $+ .players ] ] set %nlhe. [ $+ [ $1 ] $+ .button ] $nlhe.nextp($1,pot,[ %nlhe. [ $+ [ $1 ] $+ .button ] ]) if ($numtok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],32) == 2) { set %nlhe. [ $+ [ $1 ] $+ .sb ] [ %nlhe. [ $+ [ $1 ] $+ .button ] ] set %nlhe. [ $+ [ $1 ] $+ .bb ] $nlhe.nextp($1,pot,[ %nlhe. [ $+ [ $1 ] $+ .sb ] ]) } else { set %nlhe. [ $+ [ $1 ] $+ .sb ] $nlhe.nextp($1,pot,[ %nlhe. [ $+ [ $1 ] $+ .button ] ]) set %nlhe. [ $+ [ $1 ] $+ .bb ] $nlhe.nextp($1,pot,[ %nlhe. [ $+ [ $1 ] $+ .sb ] ]) } var %dck = 2c 3c 4c 5c 6c 7c 8c 9c Tc Jc Qc Kc Ac 2d 3d 4d 5d 6d 7d 8d 9d Td Jd Qd Kd Ad 2h 3h 4h 5h 6h 7h 8h 9h Th Jh Qh Kh Ah 2s 3s 4s 5s 6s 7s 8s 9s Ts Js Qs Ks As while (%dck) { var %rd = $rand(1,$numtok(%dck,32)) var %sdck = %sdck $gettok(%dck,%rd,32) var %dck = $deltok(%dck,%rd,32) } hadd -m nlhe. $+ $1 deck %sdck var %oldmsgdelay = %nlhe.msgdelay set %nlhe.msgdelay 5000 nlhe.msg $1 Players set %nlhe.msgdelay %oldmsgdelay var %i = 0 while (%i < $numtok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],32)) { inc %i var %c = $gettok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],%i,32), %prefix = ___ var %clist = %clist [ %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] ] ] hadd nlhe. $+ $1 %c $nlhe.takecard($1) $nlhe.takecard($1) set %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .investedpot ] 0 set %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .investedpot1 ] 0 set %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .investedpot2 ] 0 set %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .investedpot3 ] 0 set %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .investedpot4 ] 0 set %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .investedpot5 ] 0 set %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .investedpot6 ] 0 set %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .investedpot7 ] 0 set %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .investedpot8 ] 0 set %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .investedpot9 ] 0 if (%c == [ %nlhe. [ $+ [ $1 ] $+ .sb ] ]) { %prefix = SB: } if (%c == [ %nlhe. [ $+ [ $1 ] $+ .bb ] ]) { %prefix = BB: } if (%c == [ %nlhe. [ $+ [ $1 ] $+ .button ] ]) { %prefix = DB: } nlhe.msg $1  $+ %prefix $chr(36) $+ ! $+ [ %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] ] ] %c $+ $iif([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %c ] $+ .sitout ] ],$chr(32) $+ - sitting out) $+  nlhe.notice $1 %c Your cards are: $nlhe.colorcards($hget(nlhe. $+ $1,%c)) } set %nlhe. [ $+ [ $1 ] $+ .turn ] [ %nlhe. [ $+ [ $1 ] $+ .bb ] ] set %nlhe. [ $+ [ $1 ] $+ .stage ] preflop nlhe.action $1 [ %nlhe. [ $+ [ $1 ] $+ .sb ] ] sb } } alias nlhe.nextturn { if ([ %nlhe. [ $+ [ $1 ] $+ .running ] ]) { .timernlhe. $+ $1 $+ .turn* off var %current = [ %nlhe. [ $+ [ $1 ] $+ .turn ] ], %next = $nlhe.nextp($1,pot,%current) set %nlhe. [ $+ [ $1 ] $+ .turn ] %next if ($numtok([ %nlhe. [ $+ [ $1 ] $+ .playerspot ] ],32) < 2) { unset %nlhe. [ $+ [ $1 ] $+ .turn ] nlhe.nextstage $1 return } if (%current == %next) { unset %nlhe. [ $+ [ $1 ] $+ .turn ] nlhe.nextstage $1 return } if ($nlhe.nextp($1,pot,%next) == %next) { var %xbet = [ %nlhe. [ $+ [ $1 ] $+ .betpot ] ], %xmoney = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ %next ] ] ], %xinv = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ %next ] $+ .investedpot ] ] if (%xinv == $null) { %xinv = 0 } var %i = "" while ((%i < 10) || (!%i)) { var %cinvv = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ %next ] $+ .investedpot $+ [ %i ] ] ] var %cbett = $iif([ %nlhe. [ $+ [ $1 ] $+ .allinpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .allinamountpot $+ [ %i ] ] ],[ %nlhe. [ $+ [ $1 ] $+ .betpot $+ [ %i ] ] ]) if (%cinvv < %cbett) { var %totalbet = $calc(%totalbet + %cbett) var %totalinv = $calc(%totalinv + %cinvv) var %amount = $calc(%amount + %cbett - %cinvv) } inc %i } if (!%amount) { var %amount = $calc(%xbet - %xinv) } if (!%amount) { unset %nlhe. [ $+ [ $1 ] $+ .turn ] nlhe.nextstage $1 return } } if ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %next ] $+ .action ] ] == raise) { var %loopcheck = $nlhe.nextp($1,pot,%next), %nextst = 1 while (%loopcheck != %next) { if ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %loopcheck ] $+ .action ] ] == call) { var %nextst = 1 } else { var %nextst = 0 goto loopout } %loopcheck = $nlhe.nextp($1,pot,%loopcheck) } if (%nextst) { unset %nlhe. [ $+ [ $1 ] $+ .turn ] nlhe.nextstage $1 return } } if ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %next ] $+ .action ] ] == call) { var %loopcheck = $nlhe.nextp($1,pot,%next), %nextst = 1 while (%loopcheck != %next) { if (([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %loopcheck ] $+ .action ] ] == call) || ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %loopcheck ] $+ .action ] ] == raise)) { var %nextst = 1 } else { var %nextst = 0 goto loopout } %loopcheck = $nlhe.nextp($1,pot,%loopcheck) } if (%nextst) { unset %nlhe. [ $+ [ $1 ] $+ .turn ] nlhe.nextstage $1 return } } if ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %next ] $+ .action ] ] == check) { var %loopcheck = $nlhe.nextp($1,pot,%next), %nextst = 1 while (%loopcheck != %next) { if ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %loopcheck ] $+ .action ] ] == check) { var %nextst = 1 } else { var %nextst = 0 goto loopout } %loopcheck = $nlhe.nextp($1,pot,%loopcheck) } if (%nextst) { unset %nlhe. [ $+ [ $1 ] $+ .turn ] nlhe.nextstage $1 return } } :loopout if ([ %nlhe. [ $+ [ $1 ] $+ .stage ] ] == preflop) { if ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %current ] $+ .action ] ] == check) { unset %nlhe. [ $+ [ $1 ] $+ .turn ] nlhe.nextstage $1 return } } var %sitout = [ %nlhe. [ $+ [ $1 ] $+ . $+ [ %next ] $+ .sitout ] ] if (%sitout) { var %allplayers = [ %nlhe. [ $+ [ $1 ] $+ .players ] ], %p = 1, %sit = 0 while ($gettok(%allplayers,%p,32)) { var %player = $ifmatch if ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %player ] $+ .sitout ] ]) { inc %sit } inc %p } if (%sit == $numtok(%allplayers,32)) { nlhe.msg $1 Everyone's sitting out... nlhe.notice $1 %next It's your turn. } else { .timer -dom 1 [ %nlhe. [ $+ [ $1 ] $+ .msgtime ] ] nlhe.action $1 %next fold } } else { var %msgt = [ %nlhe. [ $+ [ $1 ] $+ .msgtime ] ] %msgt = $round($calc(%msgt / 1000),0) var %tta = $calc($iif(1 // %nlhe.timetoact && %nlhe.timetoact > 9,%nlhe.timetoact,60) + %msgt) if (([ %nlhe. [ $+ [ $1 ] $+ . $+ [ $nlhe.nextp($1,pot,%next) ] $+ .sitout ] ]) && ($numtok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],32) == 2)) { nlhe.msg $1 Waiting for $nlhe.nextp($1,pot,%next) to return... } else { .timernlhe. $+ $1 $+ .turn2 -do 1 $calc(%tta -12) nlhe.notice $1 %next 04You have 10 seconds left to act. $chr(124) nlhe.msg $1  $+ %next has 10 seconds left to act... .timernlhe. $+ $1 $+ .turn -do 1 %tta nlhe.msg $1  $+ %next took longer than $calc(%tta - %msgt) seconds to act. $chr(124) nlhe.sitout $1 %next out nlhe.notice $1 %next It's your turn. } } } } alias nlhe.nextstage { unset %nlhe. [ $+ [ $1 ] $+ .raiser ] unset %nlhe. [ $+ [ $1 ] $+ .betpot* ] unset %nlhe. [ $+ [ $1 ] $+ .*.action ] unset %nlhe. [ $+ [ $1 ] $+ .*.raiseamount ] var %i = "" while ((%i < 10) || (!%i)) { var %allplayers = [ %nlhe. [ $+ [ $1 ] $+ .playerspot $+ [ %i ] ] ] if (([ %nlhe. [ $+ [ $1 ] $+ .allinpot $+ [ %i ] ] ] == $null) && (%allplayers)) { var %j = 1 while ($gettok(%allplayers,%j,32)) { set %nlhe. [ $+ [ $1 ] $+ . $+ [ $ifmatch ] $+ .investedpot $+ [ %i ] ] 0 inc %j } } inc %i } if ($numtok([ %nlhe. [ $+ [ $1 ] $+ .playerspot ] ],32) < 2) { nlhe.distributepots $1 } else { set %nlhe. [ $+ [ $1 ] $+ .turn ] $nlhe.prevp($1,pot,$nlhe.nextp($1,pot,[ %nlhe. [ $+ [ $1 ] $+ .button ] ])) var %current = [ %nlhe. [ $+ [ $1 ] $+ .turn ] ], %next = $nlhe.nextp($1,pot,%current) var %cstage = [ %nlhe. [ $+ [ $1 ] $+ .stage ] ] if (%cstage == preflop) { set %nlhe. [ $+ [ $1 ] $+ .stage ] flop set %nlhe. [ $+ [ $1 ] $+ .board ] $nlhe.takecard($1) $nlhe.takecard($1) $nlhe.takecard($1) } if (%cstage == flop) { set %nlhe. [ $+ [ $1 ] $+ .stage ] turn set %nlhe. [ $+ [ $1 ] $+ .board ] [ %nlhe. [ $+ [ $1 ] $+ .board ] ] $nlhe.takecard($1) } if (%cstage == turn) { set %nlhe. [ $+ [ $1 ] $+ .stage ] river set %nlhe. [ $+ [ $1 ] $+ .board ] [ %nlhe. [ $+ [ $1 ] $+ .board ] ] $nlhe.takecard($1) } if (%cstage == river) { nlhe.distributepots $1 return } var %ai = [ %nlhe. [ $+ [ $1 ] $+ .allallin ] ] if ((%current == %next) && (!%ai)) { set %nlhe. [ $+ [ $1 ] $+ .allallin ] 1 %ai = 1 var %allplayers = [ %nlhe. [ $+ [ $1 ] $+ .playerspot ] ], %p = 1 while ($gettok(%allplayers,%p,32)) { var %player = $ifmatch, %cards = $hget(nlhe. $+ $1,%player) nlhe.msg $1  $+ %player $+  shows: $nlhe.colorcards(%cards) $+ . inc %p } nlhe.msg $1 Here we go... } if (!%ai) { var %i = "" while ((%i < 10) || (!%i)) { var %pot = pot $+ %i if ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %pot ] ] ]) { nlhe.msg $1 The $iif(%i,side pot %i,pot) contains: $ $+ [ %nlhe. [ $+ [ $1 ] $+ . $+ [ %pot ] ] ] $+ . Players in the pot:  $+ $sorttok([ %nlhe. [ $+ [ $1 ] $+ .players $+ [ %pot ] ] ],32) $+ . } inc %i } } else { var %oldmsgdelay = %nlhe.msgdelay set %nlhe.msgdelay 10000 } nlhe.msg $1 The board is: $nlhe.colorcards([ %nlhe. [ $+ [ $1 ] $+ .board ] ]) if (%oldmsgdelay != $null) { set %nlhe.msgdelay %oldmsgdelay } .timer -m 1 1 nlhe.nextturn $1 } } alias nlhe.distributepots { var %i = "", %board = [ %nlhe. [ $+ [ $1 ] $+ .board ] ], %p = 1 var %allplayers = [ %nlhe. [ $+ [ $1 ] $+ .playerspot ] ] if ($numtok(%allplayers,32) == 1) { while ((%i < 10) || (!%i)) { var %pot = pot $+ %i if ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %pot ] ] ]) { var %cpotamount = $ifmatch nlhe.msg $1  $+ %allplayers $+  wins the $iif($remove(%pot,pot),side pot $remove(%pot,pot),pot) of $ $+ %cpotamount $+ . inc %nlhe. [ $+ [ $1 ] $+ . $+ [ %allplayers ] ] %cpotamount } inc %i } } else { while ($gettok(%allplayers,%p,32)) { var %player = $ifmatch, %cards = $hget(nlhe. $+ $1,%player) var %value. [ $+ [ %player ] ] $nlhe.ranking(%board %cards) if (($gettok([ %value. [ $+ [ %player ] ] ],1,46) > 3) || ($gettok([ %value. [ $+ [ %player ] ] ],1,46) == 2)) { var %fora = 1 } else { var %fora = 0 } nlhe.msg $1  $+ %player $+  has $nlhe.colorcards(%cards) for $+ $iif(%fora,$chr(32) $+ a) $+ : $nlhe.valuewords([ %value. [ $+ [ %player ] ] ]) $+ . inc %p } while ((%i < 10) || (!%i)) { var %pot = pot $+ %i var %decced = 0 if ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %pot ] ] ]) { var %cpotamount = $ifmatch, %cplayers = [ %nlhe. [ $+ [ $1 ] $+ .players $+ [ %pot ] ] ] var %j = 1 while ($gettok(%cplayers,%j,32)) { var %cplayer = $ifmatch var %values = %values [ %value. [ $+ [ %cplayer ] ] ] inc %j } var %winners = $nlhe.showdown(%values) if ($numtok(%winners,32) > 1) { var %w = 1 while ($gettok(%winners,%w,32)) { var %cwinner = $gettok(%cplayers,$ifmatch,32) var %winamount = $calc(%cpotamount / $numtok(%winners,32)) if (!%decced) { var %dec = $round($calc((%winamount - $int(%winamount)) * $numtok(%winners,32)),0) if (%dec) { var %winamount = $calc($int(%winamount) + %dec) } %decced = 1 } else { var %winamount = $int(%winamount) } nlhe.msg $1  $+ %cwinner $+  ties for the $iif($remove(%pot,pot),side pot $remove(%pot,pot),pot) and wins $ $+ %winamount $+ . inc %nlhe. [ $+ [ $1 ] $+ . $+ [ %cwinner ] ] %winamount inc %w } } else { var %cwinner = $gettok(%cplayers,%winners,32) nlhe.msg $1  $+ %cwinner $+  wins the $iif($remove(%pot,pot),side pot $remove(%pot,pot),pot) of $ $+ %cpotamount $+ . inc %nlhe. [ $+ [ $1 ] $+ . $+ [ %cwinner ] ] %cpotamount } var %values = "" } inc %i } } var %b = 1, %allp = [ %nlhe. [ $+ [ $1 ] $+ .players ] ] while ($gettok(%allp,%b,32)) { var %player = $ifmatch if ([ %nlhe. [ $+ [ $1 ] $+ . $+ [ %player ] ] ] < 1) { nlhe.msg $1  $+ %player $+  has gone busted! Bye bye. if ([ %nlhe. [ $+ [ $1 ] $+ .button ] ] == %player) { set %nlhe. [ $+ [ $1 ] $+ .button ] $nlhe.prevp($1,pot,%player) } set %nlhe. [ $+ [ $1 ] $+ .players ] $remtok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],%player,1,32) unset %nlhe. [ $+ [ $1 ] $+ . $+ [ %player ] $+ * ] } inc %b } if ($numtok([ %nlhe. [ $+ [ $1 ] $+ .players ] ],32) < 2) { nlhe.msg $1  $+ [ %nlhe. [ $+ [ $1 ] $+ .players ] ] $+  has won the game! var %msgt = [ %nlhe. [ $+ [ $1 ] $+ .msgtime ] ] unset %nlhe. [ $+ [ $1 ] $+ .* ] hfree -w nlhe. $+ $1 .timernlhe. $+ $1 $+ .blinds off .timernlhe. $+ $1 $+ .turn* off if (%msgt) { set %nlhe. [ $+ [ $1 ] $+ .msgtime ] %msgt } return } nlhe.nextround $1 }