; ; ========================================Version 1.9i= ; TAUCHER'S 4-in-a-row (4-Wins) Game for mIRC ; ==========================================(c) 2000== ; Homepage - http://members.tripod.com/kqato01/ ; ; == TO INSTALL == ; To install copy this file into your mircdir and type /load -rs 4wins.txt ; to remove use the same command with /unload ... ; ; == TO UPDATE == ; First: find an update version, then ; OVERWRITE the file in your mircdir with the update version ; then type /reload -rs 4wins.txt that's it :) ; ; == TO DISTRIBUTE == ; The script answers to your ctcp version reply and has a self ; sender wich allows others to send you a ; /CTCP 4wins.txt ; then the script will initiate it's own send itself and ship via ; dcc send to the requesting person (function is flood protected) ; ; == GAME RULES == ; It's like the old game "four in a row" where your aim is to let ; stones drop into slots so you get 4 stones of your color in ; a horizontal, vertical or diagonal row before your ; opponent does so. ; for communication protocol reasons the person who ; requested the game starts with first move. ; The game is over when one of the players managed to ; create a "row" of his stones - how many needed is set ; at play-start. ; ; == TO PLAY == ; both sides need to have the script loaded ; then just click on your firend with the right mouse button ; and select a request from the 4 Wins menu there ; Note: ; as long as the unfinished play window is open, new requests ; from people >except your opponent< will be auto rejected ; in order to let you play in peace (function is flood protected). ; If you accept a new game from your opponent then the ; current board will be closed and a new one opened ; New since 1.2: ; You can use the channel-commands to find your counterpart ; There's also a command to search for script updates ; ; == MISC == ; Cheating: you cannot erase stones on the other's board ; so all that will happen is that you'll end up in a desynched ; game - this might happen due to netsplits or other loss too. ; the script has a resend-feature for this case, but it's perfect. ; ;============================================ ; THIS SCRIPT CAN BE DISTRIBUTED FREELY AS LONG ; AS NOT MODIFIED OR USED FOR COMMERCE ;============================================ ; CHANGES: 1.2 -> 1.5 ; + Recoded the complete storage mechanism to work more ; = efficiently, now it can handle vast playfield sizes without ; = running into danger of hitting a 32k mIRC limitation ; + Added a backward compatible notification to your ; = opponent when your window is ready - this way both ; = know when they can start - when playing against older ; = script versions just start - as said, it's non blocking :) ;============================================ ; CHANGES: 1.5 -> 1.6 ; + Added logging function for cometition comparison ;============================================ ; CHANGES: 1.6 -> 1.9 ; + Replaced the blocking mIRC request window with a ; = nonblocking custom one wich auto expires after 2 mins ; + added measures for better backward compatibility (untested) ; + added some options to the in game context menu ; + unified the menu request code to avoid redundant code ; + added code wich overrides checks when /set %four.debug on ; + renamed some texts and menu items - for better or worse :) ;============================================ ; CHANGES: 1.9e -> 1.9i ; added some functions for 4-o-holics :) ;============================================ ; Todo: ; - find the remaining bugs and kill them :) ; - get some feedback on the game ; - conquer the world till next monday *g* ; ; Thanks for reading this till the end - enjoy the game :) ;============================================ #fouractive off on ^1:notice:*four put *:*:{ ;echo -s COUNTERMOVE: $nick placed stone at coulm $3 four.validateclick $3 %four.beep flash 4-Wins: $nick placed a stone at coulm $3 - your turn! .disable #fouractive haltdef halt } #fouractive end #foursensitive on on ^1:notice:!fourwins*:*:{ if ($len($dialog(fouracknowledge)) >= 3) { /echo -s Autorejecting to $nick in 15s - already a game in progress .timer_ [ $+ [ $nopath($script) ] ] 1 15 /notice $nick Another Request is still pending - Request Auto-Rejected halt } elseif ((($len($window(@four)) > 2) && (%four_winner == 0)) && ($nick != %four.opponent )) { .timer_ [ $+ [ $nopath($script) ] ] 1 15 /notice $nick Game In Progress - Request Auto-Rejected /echo -s Autorejecting to $nick in 15s - already a game in progress haltdef } elseif ((($3 >= $2) || (($3 > 7 ) || ($3 < 3))) || (($2 > 23) || ($2 < 3))) { .timer_ [ $+ [ $nopath($script) ] ] 1 20 /notice $nick Invalid request - Auto-Rejected /echo -s Invalid request from $nick (over/undersized) - Auto-Rejecting: $1 : $2 : $3 : $4- } elseif (%four.sens == OFF) { echo -s $timestamp 4+++ $chan Four Wins request from $nick ignored (Script is OFF) haltdef } else { echo -a $timestamp 12+++ Four Wins request from $nick /flash $2 WINS request from $NICK .timer 1 2 /fourack [ $nick ] [ $2 ] [ $3 ] haltdef } } #foursensitive end #fourackwait off on ^1:notice:*Four Wins request accepted*:*:{ flash !! Got Game Accept - starting $6 $+ -Wins match with $nick - size $5 echo Got Accept - starting $6 $+ -Wins match with $nick - size $5 ; Der initiator fängt auch an unset %four.r.nick .disable #fourackwait /four $nick $$5 $6- haltdef } #fourackwait end alias fourack { ;echo -s $timestamp 12+++ Received $3 $+ -Wins Request from $1 - Size $2 %four.r.nick = $1 $+ @ $+ $3 $+ @ $+ $2 /dialog -m fouracknowledge fourack /dialog -t fouracknowledge Game request from $1 /did -o fouracknowledge 10 1 $1 invites you to play $crlf $3 $+ -Wins ( $+ $2 x $2 $+ ) /did -o fouracknowledge 51 1 $1 /did -o fouracknowledge 52 1 $2 /did -o fouracknowledge 53 1 $3 .timerfouracknowledge 1 60 /dialog -c fouracknowledge ; the timer auto closes the dialog if there's no reaction } on 1:dialog:fouracknowledge:sclick:*: { ;echo $dname $devent $did if ($did == 20 ) { .enable #fouractive notice $did(fouracknowledge,51,1).text Four Wins request accepted $did(fouracknowledge,52,1).text $did(fouracknowledge,53,1).text four $did(fouracknowledge,51,1).text $did(fouracknowledge,52,1).text $did(fouracknowledge,53,1).text } elseif ($did == 30 ) { ; the cancel/ignore event is triggered ALWAYS - that's why you won't find any echo in here :) } elseif ($did == 40 ) { notice $did(fouracknowledge,51,1).text Game request rejected } if ($did != 30 ) { ; Close dialog dialog -c $dname } if ($timer(fouracknowledge) != $false) { .timerfouracknowledge off } } dialog fourack { title "You received a game invitation" size -1 -1 110 40 option type dbu text "somebody wants to play four wins with you", 10, 2 5 106 15, center button "&Accept", 20, 5 25 30 12 button "&Ignore", 30, 40 25 30 12, default, cancel button "&Reject", 40, 75 25 30 12 text "nick", 51, 0 0 10 10, hide text "param2", 52, 0 0 10 10, hide text "param3", 53, 0 0 10 10, hide } alias four_rply { ; launches the dialog for the replay question if (%four.replay != OFF) { .dialog -m fourreplay fourre .timerfourreplay 1 20 .dialog -c fourreplay } } dialog fourre { title "4 Wins" size -1 -1 110 35 option type dbu text "Do you want a return match ?", 10, 2 4 105 15, center button "&Yes", 20, 5 18 50 12 button "&No", 30, 55 18 50 12, default, cancel } on 1:dialog:fourreplay:sclick:*: { ;echo $dname $devent $did if ($did == 20 ) { foursendrequest $gettok(%four.r.nick,1,64) $gettok(%four.r.nick,3,64) $gettok(%four.r.nick,2,64) unset %four.r.nick if ($timer(fourreplay) != $false) { .timerfourreplay off } .dialog -c fourreplay } elseif ($timer(fourreplay) != $false) { .timerfourreplay off } } on 1:CLOSE:@four:{ if ((%four_winner == $null) || (%four_winner == 0)) { unset %four.r.nick .notice %four.opponent Game window closed } if (%four.logging == on) { var %four.logfilename = $logdir $+ @four-wins_ $+ $asctime(yyyymm) $+ .log var %four.timestamp = $asctime(yyyy-mm-dd_HH-nn-ss) if (%four_winner == %four.mycolor) { var %winner = $me var %prefix = WON } elseif (%four_winner == %four.opponentcolor) { var %winner = %four.opponent var %prefix = LOST } elseif ((%four_winner == $null) || (%four_winner == 0)) { var %winner = %four_winner var %prefix = QUIT } unset %fourX_* echo -s Storing results in logfile %four.logfilename /write " $+ %four.logfilename $+ " %prefix $+ : %four.timestamp Me: $me Opponent: %four.opponent Winner: %winner Boardsize: %four.size Goal: %four.goal Turns: %four_total ;---------- var %replaceus2 = 1 :replaceusloop2 if (%replaceus2 <= %four.size ) { var %addus = %four.size - $numtok(%four_ [ $+ [ %replaceus2 ] ] ,44) :addusloop if (%addus > 0) { %four_ [ $+ [ %replaceus2 ] ] = $instok(%four_ [ $+ [ %replaceus2 ] ] ,$chr(0160), $calc(%four.size + 1) ,44) dec %addus goto addusloop } var %replaceus = 1 :replaceusloop if (%replaceus <= %four.size) { %four_ [ $+ [ %replaceus ] ] = $reptok( %four_ [ $+ [ %replaceus ] ] , %four.mycolor , X ,1,44) %four_ [ $+ [ %replaceus ] ] = $reptok( %four_ [ $+ [ %replaceus ] ] , %four.opponentcolor , + ,1,44) inc %replaceus goto replaceusloop } inc %replaceus2 goto replaceusloop2 } ;---------- var %count = 1 :logloop var %transpose = 1 :transposeloop %fourX_ [ $+ [ $calc(%count) ] ] = %fourX_ [ $+ [ $calc(%count) ] ] $+ $gettok( %four_ [ $+ [ $calc(%transpose) ] ] ,1,44) %four_ [ $+ [ $calc(%transpose) ] ] = $deltok( %four_ [ $+ [ $calc(%transpose) ] ] ,1,44) inc %transpose if (%transpose <= %four.size) goto transposeloop inc %count if ( %count <= %four.size ) goto logloop ;---------- echo  var %count = 1 :logloop2 var %output = $replace($replace($replace(%fourX_ [ $+ [ $calc(%four.size - %count + 1) ] ] ,X, 15|4X15),+,15|12X15), ,15| ) $+ $chr(124) /write " $+ %four.logfilename $+ " > $strip(%output) echo -s > %output inc %count if ( %count <= %four.size ) goto logloop2 echo  ; ======= END OF } unset %four_* unset %four.linewidth unset %four.size unset %four.opponent unset %four.goal unset %fourwins.ack .enable #foursensitive .disable #fourackwait .disable #fouractive .disable #fourclose if ($gettok(%four.r.nick,0,64) == 3) { four_rply } } #fourclose off on ^1:notice:*Game window closed*:*:{ if ($nick == %four.opponent) { if (%four_winner = 0 ) %four_winner = -2 titlebar @four !! Your opponent quit !! fourstatusmsg 1 1 1 Opponent closed game four.setactive 0 haltdef } } #fourclose end on ^1:notice:*four ready*:*:{ ;echo -s All right, both sides have the gameboard open now %four-init = $nick if (($window(@four) != $null) && ($nick == %four.opponent )) { fourstatusmsg 1 1 12 Opponent is ready unset %four-init } haltdef halt } alias fourstatusmsg { ; X Y COLOR TEXT var %cellsize = %four.cellsize var %linewidth = %four.linewidth /drawtext -pb @four $3 15 arial $calc(%cellsize - (%linewidth * 4)) $calc(%cellsize * $1) $calc(((%four.size + $2) * %cellsize ) + (2 * %linewidth)) $4- $+ $+ $chr(0160) $chr(0160) $chr(0160) $chr(0160) $chr(0160) $chr(0160) $chr(0160) $chr(0160) $chr(0160) $chr(0160) $chr(0160) $chr(0160) $chr(0160) $chr(0160) } on 1:NICK:{ if ((%four.opponent == $nick) && ($window(@four) != $null)) { echo -s 3 $+ $timestamp *** Renaming game opponent from $nick to $newnick %four.opponent = $newnick fourstatusmsg 2 3 %four.opponentcolor %four.opponent } if (($me == $nick) && ($window(@four) != $null)) { echo -s 3 $+ $timestamp *** Renaming from $nick to $newnick fourstatusmsg 2 2 %four.mycolor $newnick } } alias four { ; Zeichnet das Spielfenster $1 = gegner $2 = feldgröße $3 = 3,4,5,6.. ;echo -s FOUR START $1- if ($window(@four) != $null) { echo WINDOW ALREADY OPEN - AUTO CLOSING /window -c @four } ; GAME SETTINGS unset %four_* %four_winner = 0 %four.opponent = $$1 %four.size = $$2 %four.goal = $$3 if (%four.mycolor == $null) || (%four.opponentcolor == $null) { %four.mycolor = 4 %four.opponentcolor = 2 } if (((%four.cellsize == $null) || (%four.cellsize < 10)) || (%four.cellsize > 100)) { %four.cellsize = 30 } if ((bet !isin %four.settings) || (pk !isin %four.settings)) { set %four.settings -arpk +bet } %four.linewidth = $round($calc(%four.cellsize / 10),0) var %countera = %four.size var %cellsize = %four.cellsize var %linewidth = %four.linewidth var %offset = %four.cellsize if ($version < 5.7) { ; version txt line 4158 (5.81 edition) echo compatibility call for outdated mirc /window %four.settings @four 130 130 $calc(%offset + %offset + (%countera * %cellsize) + 6) $calc( %offset + %offset + ((%countera + 2) * %cellsize) + 30) } else { /window %four.settings @four -1 -1 $calc(%offset + %offset + (%countera * %cellsize) + 6) $calc( %offset + %offset + ((%countera + 2) * %cellsize) + 30) } /drawfill @four 15 15 0 0 :loopA /drawline @four 10 %linewidth %offset %cellsize %offset $calc(%offset + (%countera * %cellsize)) /drawline @four 10 %linewidth %cellsize %offset $calc(%offset + (%countera * %cellsize)) %offset /drawline @four 0 1 %offset %cellsize %offset $calc(%offset + (%countera * %cellsize)) /drawline @four 0 1 %cellsize %offset $calc(%offset + (%countera * %cellsize)) %offset dec %countera inc %offset %cellsize if %countera >= 0 goto loopA titlebar @Four Wins by Taucher (tpau@mail.ru) four.place 1 $calc(%four.size +2) %four.mycolor four.place 1 $calc(%four.size +3) %four.opponentcolor /drawtext -pb @four 10 15 arial $calc(%cellsize - (%linewidth * 4)) $calc((%four.size - 1 ) * %cellsize / 2 ) $calc(%linewidth * 2) 10 $+ %four.goal $+ -Wins %four.size x %four.size fourstatusmsg 2 2 %four.mycolor $me fourstatusmsg 2 3 %four.opponentcolor %four.opponent fourstatusmsg 1 1 1 Waiting for other side if ($me == %four.opponent) fourstatusmsg 1 1 4 No Loopback Playing if ($group(#fouractive).status == off) { four.setactive 1 } else { four.setactive 2 } .enable #fourclose if ( %four-init == %four.opponent ) { fourstatusmsg 1 1 12 Other side ready unset %four-init } .timerfourack 1 1 fourok } ;================== alias fourok { if ( $window(@four) != $null ) { /notice %four.opponent four ready } } menu @four { sclick:{ if (($group(#fouractive).status == off) || (%four.debug = on)) { var %countera = %four.size var %cellsize = %four.cellsize var %linewidth = %four.linewidth var %cx = 0 var %cy = -1 ; ON CLICK EVENT IN PLAYFIELD :loopX ;if ($inrect($mouse.x , $mouse.y , $calc(%cellsize + (%linewidth)) , $calc((%countera * %cellsize)+ (%linewidth)) , $calc((%four.size * %cellsize) - (%linewidth)) , $calc(%cellsize - (%linewidth * 2))) == $true) { %cy = %countera } if ($inrect($mouse.x , $mouse.y , $calc((%countera * %cellsize) + (%linewidth)) , $calc(%cellsize + (%linewidth )) , $calc(%cellsize - (%linewidth * 2)) , $calc((%four.size * %cellsize) - (%linewidth * 2))) == $true) { %cx = %countera } dec %countera if ((%countera >= 0) && ($calc(%cx * %cy) == 0)) goto loopX if ($calc(%cx * %cy) != 0) { four.validateclick %cx } } else { echo -s Sorry, it's not your turn! if (%four_lastmove != $null) echo -s 12You can use the right mouse button to resend the last command } } $iif(%four.debug == on, DEBUG MODE ACTIVE): { } $iif(%four_lastmove != $null , Resend last command): { echo -s 3Resending your last move: stone to column %four_lastmove .notice %four.opponent four put %four_lastmove } Take Screenshot of client area: { var %four.bmp = $getdir $+ @4Wins- $+ $asctime(yyyy-mm-dd_HH-nn-ss) $+ .bmp if ($?!="Save this as Bitmap %four.bmp $+ " == $true) { /drawsave @four " $+ %four.bmp " echo -a 4Saved file: %four.bmp - $round($calc($file( %four.bmp ).size / 1024),1) $+ kb } } - $iif(%four.logging != on,Enable logging on close): { %four.logging = on } $iif(%four.logging == on,Disable logging on close): { %four.logging = off } - $iif($window(@four).mdi == $false, Always on top) .$iif($window(@four).mdi == $false, Temp-disable): { /window -u @four } .$iif($window(@four).mdi == $false, Temp-re-enable): { /window -do @four } $iif($version < 5.7, Old mIRC troubleshooting) .remove ontop and restore window size: { /window -ur @four } } ;####################### alias four.validateclick { ; Got Valid position from click event routine - check & drop stone to correct position var %max = %four.size var %left = $calc(%max - $numtok(%four_ [ $+ [ $$1 ] ] ,44)) if ((%left > 0 ) && (%four_winner == 0)) { ; IF SLOT HAS SPACE -> ADD TOKEN inc %four_total if ($group(#fouractive).status == off) { %four_ [ $+ [ $$1 ] ] = $instok(%four_ [ $+ [ $$1 ] ] , %four.mycolor , 0 , 44) four.place $$1 %left %four.mycolor .notice %four.opponent four put $$1 %four_lastmove = $$1 .enable #fouractive four.checkwon four.setactive 2 } else { %four_ [ $+ [ $$1 ] ] = $instok(%four_ [ $+ [ $$1 ] ] , %four.opponentcolor , 0 , 44) four.place $$1 %left %four.opponentcolor four.checkwon four.setactive 1 unset %four_lastmove .disable #fouractive } } elseif ((%left == 0 ) && (%four_winner == 0)) { echo -s 4Column full at: row %left - coulumn $1 } if (%four_winner != 0) { ; Commented out because it looks "horrible" or does not fit into window if (%four_winner == %four.mycolor) fourstatusmsg 1 1 1 Game ended in %four_total moves if (%four_winner == %four.opponentcolor) fourstatusmsg 1 1 1 Game ended in %four_total moves echo -s 4Game with %four.opponent has ended four.setactive 0 } } alias four.checkwon { var %four_ycounter = %four.size :fourloopy var %four_xcounter = %four.size :fourloopx four.checkfour %four_xcounter %four_ycounter dec %four_xcounter if (%four_xcounter > 0) goto fourloopx dec %four_ycounter if (%four_ycounter > 0) goto fourloopy if ((%four_total == $calc(%four.size * %four.size)) && (%four_winner == 0)) { %four_winner = -1 fourstatusmsg 1 1 1 Draw - No Winner } } ;--- CHECKFOUR --- Syntax: %x = $four.checkfour(x,y) --- ; Coordinatensystem umgestellt auf UNTEN LINKS = 1,1 alias four.checkfour { ;==HORIZONTAL=============== Rechnet nach rechts var %goal = %four.goal var %four_ref = $gettok( %four_ [ $+ [ $calc($1 + %goal - 1) ] ] , $2 ,44) if (%four_ref != $null) { :fourlooph dec %goal if ((%goal > 0) && ($gettok( %four_ [ $+ [ $calc($1 + %goal -1) ] ] , $2 ,44) == %four_ref)) goto fourlooph if (%goal <= 0) { four.strikeout $1 $2 $calc($1 + %four.goal -1) $2 } } ;==VERTIKAL=============== Rechnet von unten nach oben var %goal = %four.goal var %four_ref = $gettok( %four_ [ $+ [ $1 ] ] , $calc($2 + %goal - 1) ,44) if (%four_ref != $null) { :fourloopv dec %goal if ((%goal > 0) && ($gettok( %four_ [ $+ [ $1 ] ] , $calc($2 + %goal - 1) ,44) == %four_ref)) goto fourloopv if (%goal <= 0) { four.strikeout $1 $2 $1 $calc($2 +%four.goal -1) } } ;==STEIGEND=============== Rechnet von unten nach oben rechts var %goal = %four.goal var %four_ref = $gettok( %four_ [ $+ [ $calc($1 + %goal - 1) ] ] , $calc($2 + %goal - 1) ,44) if (%four_ref != $null) { :fourloopr dec %goal if ((%goal > 0) && ($gettok( %four_ [ $+ [ $calc($1 + %goal - 1) ] ] , $calc($2 + %goal - 1) ,44) == %four_ref)) goto fourloopr if (%goal <= 0) { four.strikeout $1 $2 $calc($1 + %four.goal -1) $calc($2 + %four.goal - 1) } } ;==FALLEND=============== Rechnet von unten nach links var %goal = %four.goal var %four_ref = $gettok( %four_ [ $+ [ $calc($1 - %goal + 1) ] ] , $calc($2 + %goal - 1) ,44) if (%four_ref != $null) { :fourloopf dec %goal if ((%goal > 0) && ($gettok( %four_ [ $+ [ $calc($1 - %goal + 1) ] ] , $calc($2 + %goal - 1) ,44) == %four_ref)) goto fourloopf if (%goal <= 0) { four.strikeout $1 $2 $calc($1 - %four.goal +1) $calc($2 +%four.goal -1) } } ;=========================== } alias four.strikeout { ; Helfsfunktion um Zelle 1x 1y mit 2x 2y zu verbinden ; Coordinatensystem umgestellt auf UNTEN LINKS = 1,1 var %cellsize = %four.cellsize var %half = $calc(%cellsize / 2) var %max = %four.size + 1 %four_winner = $gettok( %four_ [ $+ [ $1 ] ] , $2 ,44) /drawline @four 8 $calc(%four.linewidth * 2) $calc($1 * %cellsize + %half) $calc(( %max - $2) * %cellsize + %half) $calc($3 * %cellsize + %half) $calc(( %max - $4 ) * %cellsize + %half) } alias four.setactive { ; ZEICHNET DIE => VOR DEN FARBEN DER SPIELER ; Gültige parameter: 0 = Keine pfeile, 1 = Spieler, 2 = Gegner var %cellsize = %four.cellsize var %linewidth = %four.linewidth if ($1 == 1) { /drawtext -pb @four %four.mycolor 15 arial $calc(%cellsize - (%linewidth * 4)) $calc(%cellsize / 2) $calc((2 * %linewidth) + (%cellsize * (%four.size + 2))) => /drawtext -pb @four 15 15 arial $calc(%cellsize - (%linewidth * 4)) $calc(%cellsize / 2) $calc((2 * %linewidth) + (%cellsize * (%four.size + 3))) => } elseif ($1 == 2) { /drawtext -pb @four 15 15 arial $calc(%cellsize - (%linewidth * 4)) $calc(%cellsize / 2) $calc((2 * %linewidth) + (%cellsize * (%four.size + 2))) => /drawtext -pb @four %four.opponentcolor 15 arial $calc(%cellsize - (%linewidth * 4)) $calc(%cellsize / 2) $calc((2 * %linewidth) + (%cellsize * (%four.size + 3))) => } elseif ($1 == 0) { /drawtext -pb @four 15 15 arial $calc(%cellsize - (%linewidth * 4)) $calc(%cellsize / 2) $calc((2 * %linewidth) + (%cellsize * (%four.size + 2))) => /drawtext -pb @four 15 15 arial $calc(%cellsize - (%linewidth * 4)) $calc(%cellsize / 2) $calc((2 * %linewidth) + (%cellsize * (%four.size + 3))) => } else echo -s FEHLER in four.setactive - ungültige Parameterübergabe $1- } alias four.place { ; Params: X Y COLOR ; zeichnet nur den stein! var %cellsize = %four.cellsize var %linewidth = %four.linewidth /drawrect -ef @four $3 %linewidth $calc((%cellsize * $1 )+ %linewidth) $calc((%cellsize * $2) + %linewidth) $calc(%cellsize - (2 * %linewidth)) $calc(%cellsize - (2 * %linewidth)) fourstatusmsg 1 1 $3 Last move: slot $1 ( $+ $calc(( %four.size * %four.size) - %four_total) left) } alias foursendrequest { ;echo 1: $+ $1 2: $+ $2 3: $+ $3 4: $+ $4 5: $+ $5 .disable #fouractive .enable #foursensitive .enable #fourackwait ; this stuff handles the $1 $chan trick wich works with one of the vars empty for chan or query ; the nicklist context menu has both values set so the script needs to ignore the channel ; why -> saves a duplicate menu! if ($len( $4 ) > 0) { /notice $1 !fourwins $3 $4 } else { /notice $1 !fourwins $2 $3 } } menu query,dcc,nicklist,channel { 4 WINS ( $+ %four.sens $+ ) .$iif($menu == channel,IMPORTANT NOTE) ..THOSE COMMANDS SEND: { } ..TEXT TO EVERYBODY IN $upper($chan) $+!!!: { } ..KEEP IN MIND THAT THIS CAN: { } ..CAUSE A LOT OF REJECTS: { } ..AND THAT YOU CAN ONLY PLAY: { } ..WITH THE FIRST ACCEPTING PERSON: { } ..- ..EXCESSIVE USE CAN LEAD TO GETTING SET: { } ..ON IGNORE OR EVEN BANNED FORM A CHANNEL!: { } .- .$iif($menu == channel,Find other versions of this script in channel): { echo $chan 12 === 4-WINS Reminder === Only accept files from people who you can trust. echo $chan 12 The script homepage is: http://members.tripod.com/kqato01/ /CTCP $chan FIND $nopath($script) } .- .Four Wins (5x5) Game: foursendrequest $1 $chan 5 4 .Four Wins (7x7) Game: foursendrequest $1 $chan 7 4 .Four Wins (9x9) Game: foursendrequest $1 $chan 9 4 .- .Five Wins (7x7) Game: foursendrequest $1 $chan 7 5 .Five Wins (9x9) Game: foursendrequest $1 $chan 9 5 .- .Six Wins (9x9) Game: foursendrequest $1 $chan 9 6 .- .$iif(%four.sens != OFF,Disable Game Offers) { %four.sens = OFF } .$iif(%four.sens == OFF,Enable Game Offers) { %four.sens = ON } .- .$iif($len($window(@four)) > 2,SETUP) ..Sounds ...Beep on opponent ON: %four.beep = beep 1 40 ...Beep on opponent OFF: /unset %four.beep ..Return Match Question ...$iif(%four.replay != OFF,Disable Question) { %four.replay = OFF } ...$iif(%four.replay == OFF,Enable Question) { %four.replay = ON } ..You can't change the other settings while there is a game-window open!: { } .$iif($len($window(@four)) < 2,SETUP) ..Sounds ...Beep on opponent ON: %four.beep = beep 1 40 ...Beep on opponent OFF: /unset %four.beep ..Return Match Question ...$iif(%four.replay != OFF,Disable Question) { %four.replay = OFF } ...$iif(%four.replay == OFF,Enable Question) { %four.replay = ON } ..Logging ...On Close Results Logging ON: { %four.logging = on } ...On Close Results Logging OFF:{ %four.logging = off } ..Ontop ...Window Always On Top ON: { set %four.settings -ardopk +bet } ...Window Always On Top OFF:{ set %four.settings -arpk +bet } ..Cellsize ( $+ %four.cellsize $+ ) ...20: %four.cellsize = 20 ...30(default): %four.cellsize = 30 ...40: %four.cellsize = 40 ...50: %four.cellsize = 50 ...60: %four.cellsize = 60 ...70: %four.cellsize = 70 ...custom: %four.cellsize = $?="Enter a valid size in pixels" ..Colors ...Red-Blue: %four.mycolor = 4 | %four.opponentcolor = 2 ...Black-Orange: %four.mycolor = 1 | %four.opponentcolor = 7 ...Custom: %four.mycolor = $?="Enter a valid color without strg-k" | %four.opponentcolor = $?="Enter a valid color without strg-k" $iif(%four.debug == on,4 WINS DEBUG): { echo -a DEBUG menu: $+ $menu $+ ; nicklist: $+ $1 $+ ; chan: $+ $chan $+ ;12>> foursendrequest $1 $chan 5 4 ; If you're reading this and having a problem with the request then type "/set %four.debug on" and use the debug menu ; the request takes only 3 parameters - if you see 4 then some genius changed the menu behavioural } } #varbypass off alias var { ; if just for security reasons, don't expect it to work anyway ... if ($version < 5.6) { set $1 $3 $4 $5- } else [ var $1- ] } #varbypass end on 1:Start:{ if ($length(%four.sens) <= 1) { %four.sens = ON } echo -s 124WINS loaded - Homepage - http://members.tripod.com/kqato01/ ; Nothing essential in here! if ($version < 5.7) { echo -s 4ATTENTION - YOUR MIRC $version IS OUTDATED (see http://www.mirc.co.uk/versions.txt ) } if ($version < 5.6) { echo -a 4see version 5.6 in version.txt at numbers 62 68 74 924 99 } if ($version < 5.51) { echo -a 4see version 5.51 in version.txt at numbers at numbers 19 24 64 } if ($version < 5.5) { echo -a 4Sorry, your mIRC is too outdated and lacking a long list of more or less important functions! echo -a 4see versions.txt for version 5.5 - numbers 1 31 46 52 53 62 65 80 91 93 99 111 123 126 134 144 echo -a 4... not to mention all the other changes - the listed are just the most lethal ones! timer 1 1 /unload -rs $script halt haltdef } .disable #varbypass if ($version < 5.6) { echo -a 4your mIRC does not support the /var local variables allocation command so it will need to be bypassed echo -a 4i could not test if this works, but don't expect wonders... enable #varbypass } if ($version < 5.7) { echo -s 4If anything freezes then press ctrl/strg + pause and unload this script or upgrade your mIRC } } ;-----------SELF-REPLICATION-MECHANISM-------------- ctcp *:*:*:{ ;echo > $1 > $2 > $3- if (% [ $+ [ $nopath($script) ] $+ ] -nosend != on) { if ($nopath($script) isin $1) { echo -s 12Sending $script in 15s to $nick - you can disable this self-replication-mechanism with /set % $+ [ $nopath($script) ] $+ -nosend on .timer [ $+ [ $nopath($script) ] ] 1 15 if (% [ $+ [ $nopath($script) ] $+ ] -nosend != on) /dcc send $nick " [ $+ [ $script ] $+ ] " } elseif (($1 == VERSION) || ((FIND == $1) && ($2 == $nopath($script)))) { .timer [ $+ [ $nopath($script) ] ] 1 2 /ctcpreply $nick $1 Game: 4-Wins!! (Ver 1.9i - $round($calc($file($script).size / 1024),1) kb) - /ctcp $me $nopath($script) } } } ; THIS SCRIPT CAN BE DISTRIBUTED FREELY AS LONG ; AS NOT MODIFIED OR USED FOR COMMERCE ; Taucher < tpau@mail.ru >