This section lists the full script (aliases, popups, remotes and variables) talked through in the tutorial. For detailed explanations of each section refer to the table of contents.
chk {
set %spellphrase $1-
%spellphrase = $replace($replace(%spellphrase,didnt,didn't),wasnt,wasn't)
%spellphrase = $replace($replace(%spellphrase,didn;t,didn't),wasn;t,wasn't)
%spellphrase = $replace(%spellphrase,havent,haven't)
%spellphrase = $replace(%spellphrase,haven;t,haven't)
%spellphrase = $replace($replace(%spellphrase,isn;t,isn't),taht,that)
%spellphrase = $replace($replace($replace(%spellphrase,isnt,isn't),hte,the),htis,this)
%spellphrase = $replace($replace($replace(%spellphrase,waht,what),whrer,where),hwo,who)
return %spellphrase
unset %spellphrase
}
colwords {
%newstring = ""
%entered = $1-
%numtoks = $gettok(%entered,0,32)
%counter = 1
:start
%word = $gettok(%entered,%counter,32)
if %word == $null goto end
%coltext = $rand(1,15)
%newstring = %newstring $+ $chr(3) $+ %coltext $+ %word $+ $chr(1)
inc %counter 1
goto start
:end
%newstring = $replace(%newstring,$chr(1),$chr(32))
unset %entered
unset %numtoks
unset %counter
return %newstring
}
colnames {
; find out how many channels we're on
%channo = $chan(0)
:top
; if we've finished all the channels, stop processing
if (%channo < 1) { halt }
; find out how many nicknames are on the current channel
%i = $nick($chan(%channo),0)
:top1
; if we've finished all the nicknames, go to the next channel
if (%i < 1) { goto nextchan }
; if the current nickname on the current channel is an op, colour it red
if ($nick($chan(%channo),%i) isop $chan(%channo)) { cline 4 $chan(%channo) %i }
; if the current nickname on the current channel is voiced, colour it green
elseif ($nick($chan(%channo),%i) isvo $chan(%channo)) { cline 3 $chan(%channo) %i }
; otherwise colour it grey
else { cline 14 $chan(%channo) %i }
; next nickname
dec %i
goto top1
:nextchan
; next channel
dec %channo
goto top
}
blacknames {
%channo = $chan(0)
:top
if (%channo < 1) { halt }
%i = $nick($chan(%channo),0)
:top1
if (%i < 1) { goto nextchan }
cline 1 $chan(%channo) %i
dec %i
goto top1
:nextchan
dec %channo
goto top
}
makestatwindow {
window +tbs @switches /font courier new
if ( $group(#autowhois) == on ) { aline @switches on : whois on join }
else { aline @switches off: whois on join }
if ( $group(#autogreet) == on ) { aline @switches on : autogreet }
else { aline @switches off: autogreet }
if ( $group(#autospell) == on ) { aline @switches on : autospell }
else { aline @switches off: autospell }
if ( $group(#colournicks) == on ) { aline @switches on : nickname colouring }
else { aline @switches off: nickname colouring }
echo @switches Current IP Address is $ip
}
Copy and paste this into the menubar section of popups. In my copy, this is the entire custom menu, i.e. I've deleted all the options that were there before. You may not want to do this, in which case just paste it to the end of the current menu definition and leave out the first line. If this is to be the entire menu definition then the first line says what the menu will be called (i.e. the mIRC menu will read File Tools DCC Switches Window Help
Switches Show Switch window: if ($window(@switches).state == $null) { makestatwindow } - ; the dot before the disable and enable stops mIRC echoing the results of the command %whoismenu: { if ($group(#autowhois) == on) { .disable #autowhois | %whoismenu = Turn on autowhois ; check that switches window exists, if not recreate it. if ($window(@switches).state == $null) { makestatwindow } ; if it already existed change the message for the whois event else { rline @switches 1 off: whois on join } } else { .enable #autowhois | %whoismenu = Turn off autowhois if ($window(@switches).state == $null) { makestatwindow } else { rline @switches 1 on : whois on join } } } %greetmenu: { if ($group(#autogreet) == on) { .disable #autogreet | %greetmenu = Turn on autogreet if ($window(@switches).state == $null) { makestatwindow } else { rline @switches 2 off: autogreet } } else { .enable #autogreet | %greetmenu = Turn off autogreet if ($window(@switches).state == $null) { makestatwindow } else { rline @switches 2 on : autogreet } } } %spellmenu: { if ($group(#autospell) == on) { .disable #autospell | %spellmenu = Turn on autospell if ($window(@switches).state == $null) { makestatwindow } else { rline @switches 3 off: autospell } } else { .enable #autospell | %spellmenu = Turn off autospell if ($window(@switches).state == $null) { makestatwindow } else { rline @switches 3 on : autospell } } } %cnmenu: { if ($group(#colournicks) == on) { .disable #colournicks | %cnmenu = Turn on nick colouring if ($window(@switches).state == $null) { makestatwindow } else { rline @switches 4 off: nickname colouring } blacknames } else { .enable #colournicks | %cnmenu = Turn off nick colouring if ($window(@switches).state == $null) { makestatwindow } else { rline @switches 4 on : nickname colouring } colnames } }
; groups used to indicate which switches are on and which are off #autowhois on #autowhois end #autogreet on #autogreet end #colournicks on #colournicks end #autospell on #autospell end ; triggered when we start mIRC on 1:START:{ makestatwindow } ; whenever I input something... on 1:INPUT:*: { if ( $group(#autospell) == on ) { ; if we've got this far we have autospell switched on if ($left($1,1) != /) { ; and we didn't type a command msg $active $chk($1-) ; stop mIRC sending the original text to the channel halt } } } on 1:JOIN:#: { ; check status of various switches and if they're on, process them if ( $group(#autowhois) == on ) { whois $nick } if ( $group(#autogreet) == on ) { msg $chan Welcome $nick } ; note: this one has to go last because it contains a halt; if it went first the others would not be processed if ( $group(#colournicks) == on ) { colnames } } ; when each of these events are triggered check status of colour nicknames script. Process if necessary on 1:PART:#:if ( $group(#colournicks) == on ) { colnames } on 1:QUIT:if ( $group(#colournicks) == on ) { colnames } on 1:OP:#:if ( $group(#colournicks) == on ) { colnames } on 1:DEOP:#:if ( $group(#colournicks) == on ) { colnames } on 1:VOICE:#:if ( $group(#colournicks) == on ) { colnames } on 1:DEVOICE:#:if ( $group(#colournicks) == on ) { colnames } on 1:BAN:#:if ( $group(#colournicks) == on ) { colnames } on 1:KICK:#:if ( $group(#colournicks) == on ) { colnames } on 1:SERVEROP:#:if ( $group(#colournicks) == on ) { colnames } raw 366:*: { colnames }
%greetmenu Turn off autogreet %whoismenu Turn off autowhois %spellmenu Turn off autospell %cnmenu Turn off nick colouring
This version of the script uses script features introduced in mIRC 5.7, and as such will not work with any previous version of mIRC.
spellchk { var %spellfile = $mircdir\spells.txt if $exists(%spellfile) { var %spellphrase = $1- %spellphrase = $replace(%spellphrase,$chr(32),$chr(1)) var %ct 1 var %nlns $lines(%spellfile) while (%ct <= %nlns) { var %wrd1 = $read -l $+ %ct %spellfile inc %ct var %wrd2 = $read -l $+ %ct %spellfile %spellphrase = $replace(%spellphrase,%wrd1,%wrd2) inc %ct } %spellphrase = $replace(%spellphrase,$chr(1),$chr(32)) return %spellphrase } else return $1- } /cw /say $colwords($1-) colwords { var %newstring = "" var %entered = $1- var %counter = 1 var %word " " while (%word != $null) { %word = $gettok(%entered,%counter,32) %coltext = $rand(1,15) %newstring = %newstring $+ $chr(3) $+ %coltext $+ %word $+ $chr(1) inc %counter 1 } %newstring = $replace(%newstring,$chr(1),$chr(32)) return %newstring } colnames { var %channo = $chan(0) var %oc = %opcol - 1 var %vc = %voicecol - 1 var %otc = %othercol - 1 while (%channo >= 1) { var %ch = $chan(%channo) var %i = $nick(%ch,0) while (%i > 0) { if ($nick(%ch,%i) isop %ch) { cline %oc %ch %i } elseif ($nick(%ch,%i) isvo %ch) { cline %vc %ch %i } else { cline %otc %ch %i } dec %i } dec %channo } } blacknames { var %channo = $chan(0) while (%channo >= 1) { var %ch = $chan(%channo) var %i = $nick(%ch,0) while (%i >= 1) { cline 1 %ch %i dec %i } dec %channo } }
- Settings:dialog -m test Settings
; groups used to indicate which switches are on and which are off #autowhois off #autowhois end #autogreet off #autogreet end #cnicks on #cnicks end #autospell off #autospell end ; whenever I input something... on 1:INPUT:*: { if ( $group(#autospell) == on ) { ; if we've got this far we have autospell switched on if ($left($1,1) != /) { ; and we didn't type a command msg $active $spellchk($1-) ; stop mIRC sending the original text to the channel halt } } } on 1:JOIN:#: { ; check status of various switches and if they're on, process them if ( $group(#autowhois) == on ) { whois $nick } if ( $group(#autogreet) == on ) { msg $chan Welcome to $chan , $nick ! } ; note: this one has to go last because it contains a halt; if it went first the others would not be processed if ( $group(#cnicks) == on ) { colnames } } ; when each of these events are triggered check status of colour nicknames script. Process if necessary on 1:PART:#:if ( $group(#cnicks) == on ) { colnames } on 1:QUIT:if ( $group(#cnicks) == on ) { colnames } on 1:OP:#:if ( $group(#cnicks) == on ) { colnames } on 1:DEOP:#:if ( $group(#cnicks) == on ) { colnames } on 1:VOICE:#:if ( $group(#cnicks) == on ) { colnames } on 1:DEVOICE:#:if ( $group(#cnicks) == on ) { colnames } on 1:BAN:#:if ( $group(#cnicks) == on ) { colnames } on 1:KICK:#:if ( $group(#cnicks) == on ) { colnames } on 1:SERVEROP:#:if ( $group(#cnicks) == on ) { colnames } on 1:DIALOG:test:init:0: { if ( $group(#autowhois) == on ) { did -c test 1 } else { did -u test 1 } if ( $group(#autogreet) == on ) { did -c test 2 } else { did -u test 2 } if ( $group(#autospell) == on ) { did -c test 3 } else { did -u test 3 } if ( $group(#cnicks) == on ) { did -c test 4 | did -e test 5,6,7,8,9,10,11,12 } else { did -u test 4 | did -b test 5,6,7,8,9,10,11,12 } didtok test 7,9,11 46 white.black.blue.green.light red.brown.purple.orange.yellow.light green.$& cyan.light cyan.light blue.pink.grey.light grey did -c test 7 %opcol did -c test 9 %voicecol did -c test 11 %othercol } on 1:DIALOG:test:sclick:1:{ if ($group(#autowhois) == on) { .disable #autowhois } else { .enable #autowhois } } on 1:DIALOG:test:sclick:2:{ if ($group(#autogreet) == on) { .disable #autogreet } else { .enable #autogreet } } on 1:DIALOG:test:sclick:3:{ if ($group(#autospell) == on) { .disable #autospell } else { .enable #autospell } } on 1:DIALOG:test:sclick:4:{ if ($group(#cnicks) == on) { .disable #cnicks | blacknames | did -b test 5,6,7,8,9,10,11,12 } else { .enable #cnicks | colnames | did -e test 5,6,7,8,9,10,11,12 } } on 1:DIALOG:test:sclick:7: %opcol = $didwm(test,7,$did(test,7)) on 1:DIALOG:test:sclick:9: %voicecol = $didwm(test,9,$did(test,9)) on 1:DIALOG:test:sclick:11: %othercol = $didwm(test,11,$did(test,11)) on 1:DIALOG:test:sclick:12: colnames raw 366:*: { colnames } dialog Settings { title "Script Control Panel" size -1 -1 200 205 check "Auto-whois", 1, 10 10 75 30 check "Auto-greet", 2, 10 30 75 30 check "Auto-spell", 3, 90 10 75 30 check "Colour Nicknames", 4, 90 30 120 30 box "Nickname Colours",5, 5 60 130 120 text "Ops", 6, 10 75 35 30, right combo 7, 50 75 70 100, drop text "Voiced", 8, 10 100 35 30, right combo 9, 50 100 70 100, drop text "Others", 10, 10 125 35 30, right combo 11, 50 125 70 100, drop button "Apply", 12, 45 155 60 20 button "Ok",13, 80 185 30 20,(default,ok) }
%opcol 2 %voicecol 2 %othercol 2