Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Demo Bot EGO v.1
- =========
- on *:load: {
- set %1 ace
- set %2 2
- set %3 3
- set %4 4
- set %5 5
- set %6 6
- set %7 7
- set %8 8
- set %9 9
- set %10 10
- set %11 jack
- set %12 queen
- set %13 king
- set %chan $?="enter #channel name"
- set %game on
- writeini bj.ini bj player1 none
- writeini bj.ini bj player2 none
- writeini bj.ini bj player3 none
- writeini bj.ini bj player4 none
- writeini bj.ini bj player5 Start game
- echo -a 3,4Thank you for using GigaOptic's Bot Script for mIRC!
- echo -a 1,4Please be wary, I need Master Access in this room for me to use certain commands. Type !Masteronlycommands for more information on this subject
- set %password $$?="Enter the Bot's Password. This will be used for special commands dealing with the password."
- set %Master $$?="Enter the Nick that owns this bot"
- /auser Master %Master
- }
- #KICKTHATASSBAN
- on @*:BAN:#: { if ($nick == $me) { .auser nounban $banmask } }
- on @*:UNban:#: { if ($nick == $me) { .ruser nounban $banmask | return } | if ($level($banmask) == nounban) && ($nick != $me) { raw -q mode # +b-k $banmask Secured.Ban } }
- on *:EXIT: { .rlevel -r nounban }
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Just type /massinvite #target #where
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;Example: /massinvite #Chan1 #chan2 will mass invite #chan1 to #chan2.
- alias massinvite {
- var %x $nick($1,0)
- while (%x) {
- invite $nick($1,%x) $2
- dec %x
- }
- }
- #Alerts
- ON *:TEXT:*!ns*:#: { msg $chan $chan isn't a place for spamming. 0,4Stop now. }
- ON *:TEXT:*!nd*:#: { msg $chan You do not disrespect Ops, or any staff. 0,4Stop now. }
- ON *:TEXT:*!nt*:#: { msg $chan You do not Troll in here. Lol, just joking. Actually don't troll! 0,4Stop now. }
- on *:TEXT:*:#: {
- if ($1 == !usercmds) { !invte USERNAME (Invite to Channel) !txhelp (help for game taxes holden) }
- if ($1 == !invite) { invite $2 $chan }
- }
- on %Master:TEXT:*:#: {
- Tokenize 32 $Strip($1-)
- if ($1- == Who owns you $me) { timer 1 1 msg $chan You own me %Master | timer 1 2 describe $chan I LOVE YOU %Master ! | timer 1 3 describe $chan Hugz %Master }
- if ($1 == !adduser) { timer 1 1 auser User $address($2,3) | timer 1 2 notice $nick $2 3,4is now ON the USER List! | timer 1 3 notice $2 you are now a BOT USER On $me ! |
- timer 1 4 descibe $chan has a cup of coffee with $2 }
- if ($1 == !Mastercmds) { msg $nick Master Commands Are: !ban, !unban, !deMastertemp, !optemp, !deoptemp, !BotOff, !BotOn, !l, !kb, !accessa, !accessr, !invite, !restartbot, !
- Mastertemp, !hop, !info, !adduser, !deluser, !Mastercmds, !moderate, !demoderate, !devoice, !voice, !deMastertemp, !hop, !info, and !notice. }
- if ($1 == !ban) { cs ban $chan $2 3 }
- if ($1 == !unban) { cs unban $chan $2 3 }
- if ($1 == !deMastertemp $+) { mode $chan -q $2 }
- if ($1 == !optemp $+) { mode $chan +o $2 }
- if ($1 == !deoptemp $+) { mode $chan -o $2 }
- if ($1 == !BotOff $+) { amsg 1,5 The Bot as been shut off by $nick Operations on this bot will not work if it is below the #BotScript Paremeter. | timer 1 2msg /disable
- #BotScript }
- if ($1 == !BotOn $+) { amsg 1,5The Bot has been re-enabled by $nick All Operations on this bot are now working below the #BotScript Parameter | timer 1 2 msg /enable
- #BotScript }
- if ($1 == !k) { kick $chan $2 $3- }
- if ($1 == !kb) { cs ban $chan $2 3 | kick $chan $2 $3- }
- if ($1 == !accessa $+) { if ($nick isop $chan) cs access $chan add $2 $3 | notice $2 Access level for $2 changed to $3 | notice $2 You can now press /ns update to update your
- access. }
- if ($1 == !accessr $+) { if ($nick isop $chan) cs access $chan del $2 | notice $2 Access level for $2 changed to $3. You have been removed from the access list. | notice $2
- You can now press /ns update to update your access. }
- if ($1 == !devoice) { mode $chan -v $2 }
- if ($1 == !notice) { notice $2 $3 }
- if ($1- == I am sorry $me) { timer 1 1 msg $chan It's ok. | timer 1 2 describe $chan Hugs %Master }
- if ($1 == !voice) { mode $chan +v $2 }
- if ($1 == !moderate) { mode $chan +m }
- if ($1 == !demoderate) { mode $chan -m }
- if ($1 == !invite) { invite $2 $chan }
- if ($1 == !restartbot) { timer 1 1 /amsg Restarting Bot | timer 1 2 describe $chan leaves | timer -o 1 3 server %server | timer 1 4 describe $chan is fully booted up! }
- if ($1- == I hate you iAdam) { timer 1 1 msg $chan Cries and Rolls on floor. What did I ever do to you?! | timer 1 2 hop $chan | timer 1 3 msg $chan I hate you too son of a
- bitch! | timer 1 4 hop $chan | timer 1 5 describe $chan wait's for an apology. }
- if ($1 == !Mastertemp $+) { mode $chan +q $2 }
- if ($1 == !hop $+) { hop $chan }
- if ($1 == !info $+) { timer 1 1 msg $chan Information for $me : I am a BOT. I run mIRC $version. My nick is $me . I am developed by EGO and cooler than service bots. I am very
- mad that I can't continue developing myself. I am proud to have $Master as an Master! | timer 1 2 describe $chan Hugs $Master. | timer 1 3 describe $chan I LOVE YOU $Master! }
- }
- on *:TEXT:!guestbook:#: {
- .timer1 1 1 notice $nick Guestbook v1.2 by ShAmPi
- .timer2 1 2 notice $nick 12-----------------------------------------------------------
- .timer3 1 3 notice $nick 7With this you can leave a message into the guestbook
- .timer4 1 4 notice $nick 7Do NOT abuse this script!
- .timer5 1 5 notice $nick 7The triggers should be typed in the channel the bot is in.
- .timer6 1 6 notice $nick 7The triggers are shown below. Have fun
- .timer7 1 7 notice $nick 12-----------------------------------------------------------
- .timer8 1 8 notice $nick 7The commands are:
- .timer9 1 9 notice $nick 4!writegb <message> - To leave a message in the guestbook
- .timer10 1 9 notice $nick 4!viewgb - to view the guestbook messages
- .timer11 1 11 notice $nick 12-----------------------------------------------------------
- }
- on *:text:!viewgb:#:{
- set %guestbook.c 1
- /filter -c " $+ $mircdirguest.txt $+ " c:\lines.txt * $+ *
- set %guestbook.total $filtered
- while (%guestbook.c <= %guestbook.total) {
- set %guestbook.msg $read($mircdirguest.txt, %guestbook.c)
- set %gb.nick $gettok(%guestbook.msg,2,32)
- set %gb.time $gettok(%guestbook.msg,1,32)
- set %gb.hour $asctime(%gb.time , HH:nn:ss)
- set %gb.date $asctime(%gb.time , dd/mm/yyyy)
- set %gb.msg $gettok(%guestbook.msg,3-,32)
- .timermsgguestbooknick $+ %guestbook.c $+ $nick 1 $calc( %guestbook.c * 2) .msg $nick 7[ $+ %gb.nick $+ 7]-[ $+ %gb.hour %gb.date $+ ]-7[ $+ %gb.msg $+ 7]
- inc %guestbook.c
- }
- }
- on *:text:!writegb*:#:{
- if ($2- != $null) {
- /write -a " $+ $mircdirguest.txt $+ " $ctime $nick $2-
- .notice $nick Your message ( $+ $2- $+ )
- .notice $nick is succesfully submitted into the list!
- }
- else {
- .notice $nick Please Fill in Your Message!
- }
- }
- menu MenuBar {
- -
- Black Jack
- .On:set %game on
- ..Off:set %game off
- ...Set Channel: set %chan $$?="Enter #channel name where you'd like to play
- Black Jack, EG: #BlackJack"
- }
- on *:text:!start:%chan: {
- if %game == on {
- msg $nick Please type 4!bet in main to add yourself into the next round
- writeini bj.ini money $nick 100
- }
- else msg %chan 4Sorry no game in progress...
- }
- on *:text:!bet:%chan: {
- if %game == on {
- entergame $nick
- }
- else msg %chan 4Sorry no game in progress...
- }
- alias entergame {
- if $readini(bj.ini , Bj , player1) == none {
- if $readini(bj.ini,money, $nick) > 0 ) {
- writeini bj.ini bj player1 $1
- writeini bj.ini bj player1m $readini(bj.ini, money, $1 )
- msg %chan 4 $+ $1 6added to this round4 3 6more player required!
- writeini bj.ini money $nick $calc( $readini(bj.ini,money, $nick) - 1 )
- msg $nick 6You have 4R $+ $readini(bj.ini,money, $nick) 6left
- halt
- }
- else msg $nick 6Sorry but you have no more money left please type 4!start64 to reset your account!!!
- }
- elseif $readini(bj.ini , Bj , player2) == none {
- if $readini(bj.ini,money, $nick) > 0 ) {
- writeini bj.ini bj player2 $1
- writeini bj.ini bj player2m $readini(bj.ini, money, $1 )
- msg %chan 4 $+ $1 6added to this round4 2 6more player required!
- halt
- }
- else msg $nick 6Sorry but you have no more money left please type 4!start6 to reset your account!!!
- }
- elseif $readini(bj.ini , Bj , player3) == none {
- if $readini(bj.ini,money, $nick) > 0 ) {
- writeini bj.ini bj player3 $1
- writeini bj.ini bj player3m $readini(bj.ini, money, $1 )
- msg %chan 4 $+ $1 6added to this round4 1 6more player required!
- halt
- }
- else msg $nick 6Sorry but you have no more money left please type 4!start6 to reset your account!!!
- }
- elseif $readini(bj.ini , Bj , player4) == none {
- if $readini(bj.ini,money, $nick) > 0 ) {
- writeini bj.ini bj player4 $1
- writeini bj.ini bj player4m $readini(bj.ini, money, $1 )
- msg %chan 13Game full.. Game now starting.
- deal
- halt
- }
- else msg $nick 6Sorry but you have no more money left please type 4!start6 to reset your account!!!
- }
- else msg $1 4Sorry game is full!! please wait to enter the next game
- }
- alias deal {
- writeini bj.ini bj player1c1 % $+ $rand(1,13)
- writeini bj.ini bj player1c2 % $+ $rand(1,13)
- writeini bj.ini bj player2c1 % $+ $rand(1,13)
- writeini bj.ini bj player2c2 % $+ $rand(1,13)
- writeini bj.ini bj player3c1 % $+ $rand(1,13)
- writeini bj.ini bj player3c2 % $+ $rand(1,13)
- writeini bj.ini bj player4c1 % $+ $rand(1,13)
- writeini bj.ini bj player4c2 % $+ $rand(1,13)
- calc_hands
- show_hands
- }
- alias calc_hands {
- if $readini(bj.ini , bj , player1c1) == 1 {
- set %card1 1
- }
- if $readini(bj.ini, bj, player1c1) == 2 {
- set %card1 2
- }
- if $readini(bj.ini, bj, player1c1) == 3 {
- set %card1 3
- }
- if $readini(bj.ini, bj, player1c1) == 4 {
- set %card1 4
- }
- if $readini(bj.ini, bj, player1c1) == 5 {
- set %card1 5
- }
- if $readini(bj.ini, bj, player1c1) == 6 {
- set %card1 6
- }
- if $readini(bj.ini, bj, player1c1) == 7 {
- set %card1 7
- }
- if $readini(bj.ini, bj, player1c1) == 8 {
- set %card1 8
- }
- if $readini(bj.ini, bj, player1c1) == 9 {
- set %card1 9
- }
- if $readini(bj.ini, bj, player1c1) == 10 {
- set %card1 10
- }
- if $readini(bj.ini, bj, player1c1) == 11 {
- set %card1 10
- }
- if $readini(bj.ini, bj, player1c1) == 12 {
- set %card1 10
- }
- if $readini(bj.ini, bj, player1c1) == 13 {
- set %card1 10
- }
- if $readini(bj.ini, bj, player1c2) == 1 {
- set %card2 1
- }
- if $readini(bj.ini, bj, player1c2) == 2 {
- set %card2 2
- }
- if $readini(bj.ini, bj, player1c2) == 3 {
- set %card2 3
- }
- if $readini(bj.ini, bj, player1c2) == 4 {
- set %card2 4
- }
- if $readini(bj.ini, bj, player1c2) == 5 {
- set %card2 5
- }
- if $readini(bj.ini, bj, player1c2) == 6 {
- set %card2 6
- }
- if $readini(bj.ini, bj, player1c2) == 7 {
- set %card2 7
- }
- if $readini(bj.ini, bj, player1c2) == 8 {
- set %card2 8
- }
- if $readini(bj.ini, bj, player1c2) == 9 {
- set %card2 9
- }
- if $readini(bj.ini, bj, player1c2) == 10 {
- set %card2 10
- }
- if $readini(bj.ini, bj, player1c2) == 11 {
- set %card2 10
- }
- if $readini(bj.ini, bj, player1c2) == 12 {
- set %card2 10
- }
- if $readini(bj.ini, bj, player1c2) == 13 {
- set %card2 10
- }
- if $readini(bj.ini, bj, player2c1) == 1 {
- set %card3 1
- }
- if $readini(bj.ini, bj, player2c1) == 2 {
- set %card3 2
- }
- if $readini(bj.ini, bj, player2c1) == 3 {
- set %card3 3
- }
- if $readini(bj.ini, bj, player2c1) == 4 {
- set %card3 4
- }
- if $readini(bj.ini, bj, player2c1) == 5 {
- set %card3 5
- }
- if $readini(bj.ini, bj, player2c1) == 6 {
- set %card3 6
- }
- if $readini(bj.ini, bj, player2c1) == 7 {
- set %card3 7
- }
- if $readini(bj.ini, bj, player2c1) == 8 {
- set %card3 8
- }
- if $readini(bj.ini, bj, player2c1) == 9 {
- set %card3 9
- }
- if $readini(bj.ini, bj, player2c1) == 10 {
- set %card3 10
- }
- if $readini(bj.ini, bj, player2c1) == 11 {
- set %card3 10
- }
- if $readini(bj.ini, bj, player2c1) == 12 {
- set %card3 10
- }
- if $readini(bj.ini, bj, player2c1) == 13 {
- set %card3 10
- }
- if $readini(bj.ini, bj, player2c2) == 1 {
- set %card4 1
- }
- if $readini(bj.ini, bj, player2c2) == 2 {
- set %card4 2
- }
- if $readini(bj.ini, bj, player2c2) == 3 {
- set %card4 3
- }
- if $readini(bj.ini, bj, player2c2) == 4 {
- set %card4 4
- }
- if $readini(bj.ini, bj, player2c2) == 5 {
- set %card4 5
- }
- if $readini(bj.ini, bj, player2c2) == 6 {
- set %card4 6
- }
- if $readini(bj.ini, bj, player2c2) == 7 {
- set %card4 7
- }
- if $readini(bj.ini, bj, player2c2) == 8 {
- set %card4 8
- }
- if $readini(bj.ini, bj, player2c2) == 9 {
- set %card4 9
- }
- if $readini(bj.ini, bj, player2c2) == 10 {
- set %card4 10
- }
- if $readini(bj.ini, bj, player2c2) == 11 {
- set %card4 10
- }
- if $readini(bj.ini, bj, player2c2) == 12 {
- set %card4 10
- }
- if $readini(bj.ini, bj, player2c2) == 13 {
- set %card4 10
- }
- if $readini(bj.ini, bj, player3c1) == 1 {
- set %card5 1
- }
- if $readini(bj.ini, bj, player3c1) == 2 {
- set %card5 2
- }
- if $readini(bj.ini, bj, player3c1) == 3 {
- set %card5 3
- }
- if $readini(bj.ini, bj, player3c1) == 4 {
- set %card5 4
- }
- if $readini(bj.ini, bj, player3c1) == 5 {
- set %card5 5
- }
- if $readini(bj.ini, bj, player3c1) == 6 {
- set %card5 6
- }
- if $readini(bj.ini, bj, player3c1) == 7 {
- set %card5 7
- }
- if $readini(bj.ini, bj, player3c1) == 8 {
- set %card5 8
- }
- if $readini(bj.ini, bj, player3c1) == 9 {
- set %card5 9
- }
- if $readini(bj.ini, bj, player3c1) == 10 {
- set %card5 10
- }
- if $readini(bj.ini, bj, player3c1) == 11 {
- set %card5 10
- }
- if $readini(bj.ini, bj, player3c1) == 12 {
- set %card5 10
- }
- if $readini(bj.ini, bj, player3c1) == 13 {
- set %card5 10
- }
- if $readini(bj.ini, bj, player3c2) == 1 {
- set %card6 1
- }
- if $readini(bj.ini, bj, player3c2) == 2 {
- set %card6 2
- }
- if $readini(bj.ini, bj, player3c2) == 3 {
- set %card6 3
- }
- if $readini(bj.ini, bj, player3c2) == 4 {
- set %card6 4
- }
- if $readini(bj.ini, bj, player3c2) == 5 {
- set %card6 5
- }
- if $readini(bj.ini, bj, player3c2) == 6 {
- set %card6 6
- }
- if $readini(bj.ini, bj, player3c2) == 7 {
- set %card6 7
- }
- if $readini(bj.ini, bj, player3c2) == 8 {
- set %card6 8
- }
- if $readini(bj.ini, bj, player3c2) == 9 {
- set %card6 9
- }
- if $readini(bj.ini, bj, player3c2) == 10 {
- set %card6 10
- }
- if $readini(bj.ini, bj, player3c2) == 11 {
- set %card6 10
- }
- if $readini(bj.ini, bj, player3c2) == 12 {
- set %card6 10
- }
- if $readini(bj.ini, bj, player3c2) == 13 {
- set %card6 10
- }
- if $readini(bj.ini, bj, player4c1) == 1 {
- set %card7 1
- }
- if $readini(bj.ini, bj, player4c1) == 2 {
- set %card7 2
- }
- if $readini(bj.ini, bj, player4c1) == 3 {
- set %card7 3
- }
- if $readini(bj.ini, bj, player4c1) == 4 {
- set %card7 4
- }
- if $readini(bj.ini, bj, player4c1) == 5 {
- set %card7 5
- }
- if $readini(bj.ini, bj, player4c1) == 6 {
- set %card7 6
- }
- if $readini(bj.ini, bj, player4c1) == 7 {
- set %card7 7
- }
- if $readini(bj.ini, bj, player4c1) == 8 {
- set %card7 8
- }
- if $readini(bj.ini, bj, player4c1) == 9 {
- set %card7 9
- }
- if $readini(bj.ini, bj, player4c1) == 10 {
- set %card7 10
- }
- if $readini(bj.ini, bj, player4c1) == 11 {
- set %card7 10
- }
- if $readini(bj.ini, bj, player4c1) == 12 {
- set %card7 10
- }
- if $readini(bj.ini, bj, player4c1) == 13 {
- set %card7 10
- }
- if $readini(bj.ini, bj, player4c2) == 1 {
- set %card8 1
- }
- if $readini(bj.ini, bj, player4c2) == 2 {
- set %card8 2
- }
- if $readini(bj.ini, bj, player4c2) == 3 {
- set %card8 3
- }
- if $readini(bj.ini, bj, player4c2) == 4 {
- set %card8 4
- }
- if $readini(bj.ini, bj, player4c2) == 5 {
- set %card8 5
- }
- if $readini(bj.ini, bj, player4c2) == 6 {
- set %card8 6
- }
- if $readini(bj.ini, bj, player4c2) == 7 {
- set %card8 7
- }
- if $readini(bj.ini, bj, player4c2) == 8 {
- set %card8 8
- }
- if $readini(bj.ini, bj, player4c2) == 9 {
- set %card8 9
- }
- if $readini(bj.ini, bj, player4c2) == 10 {
- set %card8 10
- }
- if $readini(bj.ini, bj, player4c2) == 11 {
- set %card8 10
- }
- if $readini(bj.ini, bj, player4c2) == 12 {
- set %card8 10
- }
- if $readini(bj.ini, bj, player4c2) == 13 {
- set %card8 10
- }
- set %player1 $calc( %card1 + %card2 )
- set %player2 $calc( %card3 + %card4 )
- set %player3 $calc( %card5 + %card6 )
- set %player4 $calc( %card7 + %card8 )
- }
- alias show_hands {
- describe %chan Draws a(n)7 $readini(bj.ini,bj,player1c1) and places it infront of9 $readini(bj.ini, bj,player1)
- describe %chan Draws a(n)7 $readini(bj.ini,bj,player2c1) and places it infront of9 $readini(bj.ini, bj,player2)
- describe %chan Draws a(n)7 $readini(bj.ini,bj,player3c1) and places it infront of9 $readini(bj.ini, bj,player3)
- describe %chan Draws a(n)7 $readini(bj.ini,bj,player4c1) and places it infront of9 $readini(bj.ini, bj,player4)
- describe %chan Draws a(n)7 $readini(bj.ini,bj,player1c2) and places it infront of9 $readini(bj.ini, bj,player1)
- describe %chan Draws a(n)7 $readini(bj.ini,bj,player2c2) and places it infront of9 $readini(bj.ini, bj,player2)
- describe %chan Draws a(n)7 $readini(bj.ini,bj,player3c2) and places it infront of9 $readini(bj.ini, bj,player3)
- describe %chan Draws a(n)7 $readini(bj.ini,bj,player4c2) and places it infront of9 $readini(bj.ini, bj,player4)
- describe %chan Draws 2 cards for himself!!
- msg %chan 4 $readini(bj.ini, bj,player1) has4 %player1
- msg %chan 4 $readini(bj.ini, bj,player2) has4 %player2
- msg %chan 4 $readini(bj.ini, bj,player3) has4 %player3
- msg %chan 4 $readini(bj.ini, bj,player4) has4 %player4
- writeini bj.ini BJ player1t %player1
- writeini bj.ini BJ player2t %player2
- writeini bj.ini BJ player3t %player3
- writeini bj.ini BJ player4t %player4
- set %dealer $rand(16,26)
- set %bj 1
- play_game
- }
- alias play_game {
- msg %chan 9 $readini(bj.ini , Bj , player $+ %bj ) It's your turn! Would you like to 4hit or4 stand?
- set %player $readini(bj.ini , Bj , player $+ %bj )
- }
- on *:text:hit:%chan: {
- if $nick == %player {
- writeini bj.ini bj cardhit % $+ $rand(1,13)
- describe %chan draws a(n)4 $readini(bj.ini, bj , cardhit)
- if $readini(bj.ini , bj , cardhit) == %1 {
- writeini BJ.ini BJ player $+ %bj $+ t $calc( $readini(BJ.ini, BJ, player $+ %bj $+ t ) + 1 )
- }
- if $readini(bj.ini , bj , cardhit) == %2 {
- writeini BJ.ini BJ player $+ %bj $+ t $calc( $readini(BJ.ini , BJ, player $+ %bj $+ t ) + 2 )
- }
- if $readini(bj.ini , bj , cardhit) == %3 {
- writeini BJ.ini BJ player $+ %bj $+ t $calc( $readini(BJ.ini , BJ, player $+ %bj $+ t ) + 3 )
- }
- if $readini(bj.ini , bj , cardhit) == %4 {
- writeini BJ.ini BJ player $+ %bj $+ t $calc( $readini(BJ.ini , BJ, player $+ %bj $+ t ) + 4 )
- }
- if $readini(bj.ini , bj , cardhit) == %5 {
- writeini BJ.ini BJ player $+ %bj $+ t $calc( $readini(BJ.ini , BJ, player $+ %bj $+ t ) + 5 )
- }
- if $readini(bj.ini , bj , cardhit) == %6 {
- writeini BJ.ini BJ player $+ %bj $+ t $calc( $readini(BJ.ini , BJ, player $+ %bj $+ t ) + 6 )
- }
- if $readini(bj.ini , bj , cardhit) == %7 {
- writeini BJ.ini BJ player $+ %bj $+ t $calc( $readini(BJ.ini , BJ, player $+ %bj $+ t ) + 7 )
- }
- if $readini(bj.ini , bj , cardhit) == %8 {
- writeini BJ.ini BJ player $+ %bj $+ t $calc( $readini(BJ.ini , BJ, player $+ %bj $+ t ) + 8 )
- }
- if $readini(bj.ini , bj , cardhit) == %9 {
- writeini BJ.ini BJ player $+ %bj $+ t $calc( $readini(BJ.ini , BJ, player $+ %bj $+ t ) + 9 )
- }
- if $readini(bj.ini , bj , cardhit) == %10 {
- writeini BJ.ini BJ player $+ %bj $+ t $calc( $readini(BJ.ini , BJ, player $+ %bj $+ t ) + 10 )
- }
- if $readini(bj.ini , bj , cardhit) == %11 {
- writeini BJ.ini BJ player $+ %bj $+ t $calc( $readini(BJ.ini , BJ, player $+ %bj $+ t ) + 10 )
- }
- if $readini(bj.ini , bj , cardhit) == %12 {
- writeini BJ.ini BJ player $+ %bj $+ t $calc( $readini(BJ.ini , BJ, player $+ %bj $+ t ) + 10 )
- }
- if $readini(bj.ini , bj , cardhit) == %13 {
- writeini BJ.ini BJ player $+ %bj $+ t $calc( $readini(BJ.ini , BJ, player $+ %bj $+ t ) + 10 )
- }
- msg %chan 6You now have4 $readini(BJ.ini, BJ, player $+ %bj $+ t )
- if $readini(BJ.ini, BJ, player $+ %bj $+ t ) > 21 {
- msg %chan 4sorry you've busted!!!
- inc %bj
- set %player $readini(bj.ini , bj , player $+ %bj )
- if %player == $readini(bj.ini , bj , player1 ) {
- msg %chan 6It is now9 $readini(bj.ini , Bj , player $+ %bj ) $+ 's 6turn..
- }
- if %player == $readini(bj.ini , bj , player2 ) {
- msg %chan 6It is now9 $readini(bj.ini , Bj , player $+ %bj ) $+ 's 6turn..
- }
- if %player == $readini(bj.ini , bj , player3 ) {
- msg %chan 6It is now9 $readini(bj.ini , Bj , player $+ %bj ) $+ 's 6turn..
- }
- if %player == $readini(bj.ini , bj , player4 ) {
- msg %chan 6It is now9 $readini(bj.ini , Bj , player $+ %bj ) $+ 's 6turn..
- }
- elseif %player == $readini(bj.ini, bj, player5 ) {
- end_game
- }
- }
- }
- }
- on *:text:stand:%chan: {
- if $nick == %player {
- msg %chan 6You have chosen to stand on4 $readini(bj.ini, BJ, player $+ %bj $+ t )
- inc %bj
- set %player $readini(bj.ini , bj , player $+ %bj )
- if %player == $readini(bj.ini , bj , player1 ) {
- msg %chan 6It is now9 $readini(bj.ini , Bj , player $+ %bj ) $+ 's 6turn..
- }
- if %player == $readini(bj.ini , bj , player2 ) {
- msg %chan 6It is now9 $readini(bj.ini , Bj , player $+ %bj ) $+ 's 6turn..
- }
- if %player == $readini(bj.ini , bj , player3 ) {
- msg %chan 6It is now9 $readini(bj.ini , Bj , player $+ %bj ) $+ 's 6turn..
- }
- if %player == $readini(bj.ini , bj , player4 ) {
- msg %chan 6It is now9 $readini(bj.ini , Bj , player $+ %bj ) $+ 's 6turn..
- }
- elseif %player == $readini(bj.ini, bj, player5 ) {
- end_game
- }
- }
- }
- alias end_game {
- describe %chan 6Turns over his cards and reveals4 %dealer
- if %dealer > 21 {
- msg %chan 4BUSTED
- if ( ( $readini(bj.ini, BJ, player1t ) < 22 ) ) {
- msg %chan $readini(bj.ini, bj, player1) wins
- writeini bj.ini money $readini(bj.ini, bj, player1) $calc(
- $readini(bj.ini, money, $readini(bj.ini, bj, player1)) + 3 )
- msg $readini(bj.ini, bj, player1) 6You have now have $readini(bj.ini , money, $readini(bj.ini, bj, player1)
- }
- if ( ( $readini(bj.ini, BJ, player2t ) < 22 ) ) {
- msg %chan $readini(bj.ini, bj, player2) wins
- writeini bj.ini money $readini(bj.ini, bj, player2) $calc(
- $readini(bj.ini, money, $readini(bj.ini, bj, player2)) + 3 )
- msg $readini(bj.ini, bj, player2) 6You have now have $readini(bj.ini , money, $readini(bj.ini, bj, player2)
- }
- if ( ( $readini(bj.ini, BJ, player3t ) < 22 ) ) {
- msg %chan $readini(bj.ini, bj, player3) wins
- writeini bj.ini money $readini(bj.ini, bj, player3) $calc(
- $readini(bj.ini, money, $readini(bj.ini, bj, player3)) + 3 )
- msg $readini(bj.ini, bj, player3) 6You have now have $readini(bj.ini , money, $readini(bj.ini, bj, player3)
- }
- if ( ( $readini(bj.ini, BJ, player4t ) < 22 ) ) {
- msg %chan $readini(bj.ini, bj, player4) wins
- writeini bj.ini money $readini(bj.ini, bj, player4) $calc(
- $readini(bj.ini, money, $readini(bj.ini, bj, player4)) + 3 )
- msg $readini(bj.ini, bj, player4) 6You have now have $readini(bj.ini , money, $readini(bj.ini, bj, player4)
- }
- }
- else {
- msg %chan $readini(bj.ini, bj, player1) had $readini(bj.ini, BJ, player1t )
- msg %chan $readini(bj.ini, bj, player2) had $readini(bj.ini, BJ, player2t )
- msg %chan $readini(bj.ini, bj, player3) had $readini(bj.ini, BJ, player3t )
- msg %chan $readini(bj.ini, bj, player4) had $readini(bj.ini, BJ, player4t )
- if (( $readini(bj.ini, BJ, player1t ) > %dealer )) && (( $readini(bj.ini, BJ, player1t ) < 22 )) {
- msg %chan $readini(bj.ini, bj, player1) wins
- writeini bj.ini money $readini(bj.ini, bj, player1) $calc($readini(bj.ini, money, $readini(bj.ini, bj, player1)) + 3 )
- msg $readini(bj.ini, bj, player1) 6You have now have $readini(bj.ini , money, $readini(bj.ini, bj, player1))
- }
- if (( $readini(bj.ini, BJ, player2t ) > %dealer )) && (($readini(bj.ini, BJ, player2t ) < 22 )) {
- msg %chan $readini(bj.ini, bj, player2) wins
- writeini bj.ini money $readini(bj.ini, bj, player2) $calc($readini(bj.ini, money, $readini(bj.ini, bj, player2)) + 3 )
- msg $readini(bj.ini, bj, player2) 6You have now have $readini(bj.ini , money, $readini(bj.ini, bj, player2))
- }
- if (( $readini(bj.ini, BJ, player3t ) > %dealer )) && (($readini(bj.ini, BJ, player3t ) < 22 )) {
- msg %chan $readini(bj.ini, bj, player3) wins
- writeini bj.ini money $readini(bj.ini, bj, player3) $calc($readini(bj.ini, money, $readini(bj.ini, bj, player3)) + 3 )
- msg $readini(bj.ini, bj, player3) 6You have now have $readini(bj.ini , money, $readini(bj.ini, bj, player3))
- }
- if (( $readini(bj.ini, BJ, player4t ) > %dealer )) && (($readini(bj.ini, BJ, player4t ) < 22 )) {
- msg %chan $readini(bj.ini, bj, player4) wins
- writeini bj.ini money $readini(bj.ini, bj, player4) $calc($readini(bj.ini, money, $readini(bj.ini, bj, player4)) + 3 )
- msg $readini(bj.ini, bj, player4) 6You have now have $readini(bj.ini , money, $readini(bj.ini, bj, player4))
- }
- }
- writeini bj.ini bj player1 none
- writeini bj.ini bj player2 none
- writeini bj.ini bj player3 none
- writeini bj.ini bj player4 none
- }
- on *:text:`reset:?: {
- writeini bj.ini bj player1 none
- writeini bj.ini bj player2 none
- writeini bj.ini bj player3 none
- writeini bj.ini bj player4 none
- }
- on *:TEXT:!txhelp:#:{
- notice $nick ==============================
- notice $nick script commends are:
- notice $nick ==============================
- notice $nick nlhe start - start script
- notice $nick nlhe stop - stop script
- notice $nick beggin - start the game
- notice $nick add
- notice $nick remove
- notice $nick ===============================
- notice $nick Other commends are:
- notice $nick ===============================
- notice $nick call
- notice $nick raise
- notice $nick bet
- notice $nick fold
- notice $nick check
- notice $nick all in or allin
- notice $nick sit out
- notice $nick sit in
- }
- 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
- }
Add Comment
Please, Sign In to add comment