;ALCAR'S GM SCRIPT V. 2.0 ;This command sets a GM to a channel as well as allows them to run a game ;in it. To use it, you must create a gmlog.txt file in your MIRC folder ;that this script is running from, as well as place the script in that ;folder. Games are logged at gmnick.txt on the logs folder. It can ;also recall the last 10 lines of a game logged and tells people who is ;running the game. Contact Alcar on dal.net in #Game1 with problems. ;Lastly, this script works in mirc 5.8. I don't know about other versions. ;This sets the GM using set gm/dm/st #Channel nick, such as set dm #game1 ;Jeramias. on *:LOAD:{ /run notepad.exe gmlog.txt } on *:text:set *:*:{ if (($2 == gm) || ($2 == dm) || ($2 == st) && ($chr(35) isin $3) && ($me ison $3) && ($4 ison $3)) { set %gm.1 $4 | goto next } elseif ($chr(35) !isin $3) || ($me !ison $3) || ($4 !ison $3) { /msg $nick Sorry, you have to type set dm/gm/st #channel nick for the dm script to work. Both $me and the nick have to be on the channel | halt } :next ;This prevents the bot running the script (assuming it is a bot) from being made the GM. if ($me == $4) { msg $3 Hello, I'm the dice bot! I kill players, not run games. Sheesh! | halt } ;This logs everything, getting rid of problems in the GM's nick for .txt files as well. set %gm.c1 $3 | set %gametype.1 $2 | set %gm.log %gm.1 | set %gm.log1 $mknickfn(%gm.log) | set %gm.log1 $remove(%gm.log1,$chr(95)) | set %gm.log1 %gm.log1 $+ .txt ;This ops the GM, if the bot is an op and the GM isn't already one. if (($me isop %gm.c1) && (%gm.1 !isop %gm.c1)) { /mode %gm.c1 +o %gm.1 | goto msg } if (($me !isop %gm.c1) && (%gm.1 !isop %gm.c1)) { /msg $chan *** $me sets mode +o %gm.1 (Hey, I'm trying!) | goto msg } if (%gm.1 isop %gm.c1) { goto msg } :msg ;A quick msg telling people the game has begun. msg $3 %gm.1 is running the game in %gm.c1 Shush! msg %gm.1 This game is now being logged as %gm.log1 /log on %gm.c1 -f %gm.log1 :writelog ;This writes the game log to the log file. var %gm.write $read -w* $+ %gm.log1 $+ * gmlog.txt if (%gm.write != $null) { halt } else { var %gm.add : | var %gm.add1 %gm.add %gm.log1 | write -al1 gmlog.txt %gm.add1 } } ;This alerts a GM who changes their nick that they are still running the game. Useful when people forget to remove ;the GM. on *:NICK:{ if ($nick == %gm.1) { set %gm.1 $newnick | msg %gm.1 You are still %gametype.1 $+ ing in %gm.c1 If you wish to stop, type remove dm %gm.1 Thank you. } } ;This tells people a game is running and if the GM is missing from the game. on *:Join:%gm.c1:{ if ($nick != $me) { msg $nick %gm.1 is %gametype.1 $+ ing a game right now. Please be quiet. } elseif (($nick == $me) && (%gm.1 !ison %gm.c1)) { msg %gm.c1 We seem to be missing %gm.1 .... if the game is over, please type remove %gametype.1 %gm.1 Thanks. } else { halt } } ;Removes the rom using remove gm/dmst nick format. on *:text:remove *:#:{ if (($2 == %gametype.1) && ($3 == %gm.1)) { log off %gm.c1 -f %gm.log1 | msg $chan $3 is no longer %gametype.1 $+ ing in this channel | unset %gametype.1 %gm.* } | else { msg $chan you have to type remove gm/dm/st nick, sorry. The %gametype.1 is currently %gm.1 } } on *:part:#:{ if (($nick == %gm.c1) && ($chan == %gmc.1)) { log off %gm.c1 -f %gm.log1 | msg %gm.c1 %gm.1 is no longer %gametype.1 $+ ing in this channel | unset %gametype.1 %gm.* } } on *:quit:{ if $nick == %gm.1 { log off %gm.c1 -f %gm.log1 | msg %gm.c1 %gm.1 is no longer %gametype.1 $+ ing in this channel | unset %gametype.1 %gm.* } } ;This tells people what games exist to have the last 10 lines recapped. on *:text:!recap:*:{ var %buf.recap $read -l1 gmlog.txt var %buf.replace $remove(%buf.recap,:) msg $nick The games that can be recapped are: msg $nick %buf.replace } ;This recaps the last 10 lines of a file in the Gm.log list. on *:text:!recap *:*:{ if (.txt !isin $2) { set %buf.game $2 $+ .txt } | else { set %buf.game $2 } set %buf.exist logs/ $+ %buf.game set %buf.exists $exists(%buf.exist) if (%buf.exists == $true) { goto send } | else { msg $nick Sorry, $2 isnt a game file. Type !recap by itself to see them | unset %buf.* | halt } :send set %buf.end $lines(%buf.exist) set %buf.start $calc(%buf.end - 10) set %buf.begin %buf.start :loop if (%buf.begin < %buf.end) { msg $nick $read -l $+ %buf.begin %buf.exist | inc %buf.begin | goto loop } | else { unset %buf.* | halt } } ;This tells people who the GM, DM or ST (as the case might be) currently is. on *:text:!gm:#:{ if (%gm.1 != $null) { msg $chan The %gametype.1 is currently %gm.1 in %gm.c1 } | else { msg $chan There is no gm now. } } on *:text:!gm:?:{ if (%gm.1 != $null) { msg $nick The %gametype.1 is currently %gm.1 in %gm.c1 } | else { msg $nick There is no gm now. } } on *:text:!dm:#:{ if (%gm.1 != $null) { msg $chan The %gametype.1 is currently %gm.1 in %gm.c1 } | else { msg $chan There is no dm now. } } on *:text:!dm:?:{ if (%gm.1 != $null) { msg $nick The %gametype.1 is currently %gm.1 in %gm.c1 } | else { msg $nick There is no dm now. } } on *:text:!st:#:{ if (%gm.1 != $null) { msg $chan The %gametype.1 is currently %gm.1 in %gm.c1 } | else { msg $chan There is no st now. } } on *:text:!st:?:{ if (%gm.1 != $null) { msg $nick The %gametype.1 is currently %gm.1 in %gm.c1 } | else { msg $nick There is no st now. } } ;This tells people what logs the bot has on *:text:!log:*:{ var %buf.recap $read -l1 gmlog.txt var %buf.replace $remove(%buf.recap,:) msg $nick The games that are currently logged are: msg $nick %buf.replace } ;This sends a log of a game to someone, if it exists. on *:text:!log *:*:{ if (.txt !isin $2) { set %buf.game $2 $+ .txt } | else { set %buf.game $2 } set %buf.exist logs/ $+ %buf.game set %buf.exists $exists(%buf.exist) if (%buf.exists == $true) { goto send } | else { msg $nick Sorry, $2 isnt a game file. Type !log by itself to see them | unset %buf.* | halt } :send dcc send $nick %buf.exist unset %buf.* }