On Join Actions Controller. (Couldn't think of name)
.welcome (Toggles Welcome user on join)
.joins (Toggles display join number on join)
.stats (tells if they are on or off)
Please give any advice in the comment box. No hate comments please!
on *:JOIN:#: {
inc %join [ $+ [ $chan ] ]
if ( %welcome [ $+ [ $chan ] ] == yes ) && ( %joinss [ $+ [ $chan ] ] == yes ) { msg $chan 8,1Welcome $nick $+ ! You are viewer 0,1# $+ %join [ $+ [ $chan ] ] }
if ( %joinss [ $+ [ $chan ] ] != yes ) && ( %welcome [ $+ [ $chan ] ] == yes ) { msg $chan 8,1Welcome $nick $+ ! }
if ( %welcome [ $+ [ $chan ] ] != yes ) && ( %joinss [ $+ [ $chan ] ] == yes ) { msg $chan 8,1Welcome $nick $+ ! You are viewer 0,1# $+ %join [ $+ [ $chan ] ] }
}
on *:TEXT:*:#: {
if ($1 == .welcome) && ( %welcome [ $+ [ $chan ] ] != yes ) { msg $chan Welcoming users on join is now 9 ENABLED | set %welcome [ $+ [ $chan ] ] yes }
if ($1 == .welcome) && ( %welcome [ $+ [ $chan ] ] == yes ) { msg $chan Welcoming users on join is now 4 DISABLED | set %welcome [ $+ [ $chan ] ] no }
if ($1 == .joins) && ( %joinss [ $+ [ $chan ] ] != yes ) { msg $chan Displaying join number on join is now 9 ENABLED | set %joinss [ $+ [ $chan ] ] yes }
if ($1 == .joins) && ( %joinss [ $+ [ $chan ] ] == yes ) { msg $chan Displaying join number on join is now 4 DISABLED | set %joinss [ $+ [ $chan ] ] no }
if ($1 == .stats) msg $chan 4,1Joins:0,1 %joinss [ $+ [ $chan ] ] 4,1Welcome:0,1 %welcome [ $+ [ $chan ] ]
}
Well, to me, having a string within the match section of a regex and then using the $regml(1) to reference it is no different than using a regular on text event with the $1:> on $*:TEXT:/^.(welcome)$/iS:#: {
if ($regml(1) == welcome) {
Versus:
on *:TEXT:*:#: {
if ($strip($1) == .welcome) {
are the exact same things.
And both can also be combined to do the same task:
on $*:TEXT:/^[.]\w+$/iS:#: {
if ($1 == .welcome) {
}
But it sort of defeats the purpose of regex.
I guess we're each our own when it comes to MSL.
slacker, I know it's force of habit, but you don't really need to reiterate the regex match section with welcome, joins and stats. The $regeml(1) already does the job for you. So just
on $*:TEXT:/^.(\w+)$/iS:#: {
will suffice.
Also, the prefix @ should have been ! (there's no mode settings involved, just msg command)
Or else the join event won't work if the client is not opped.
P.S. the dot used in the trigger doesn't have to be escaped.
there are many ways to make something like this. here is just one more way..
on @*:JOIN:#: {
inc $+(%,join,#)
if ($($+(%,welcome,#),2) && $($+(%,joinss,#),2)) { msg # 8,1Welcome $nick $+ ! You are viewer 0,1# $+ $($+(%,join,#),2) }
elseif (!$($+(%,joinss,#),2) && $($+(%,welcome,#),2)) { msg # 8,1Welcome $nick $+ ! }
elseif (!$($+(%,welcome,#),2) && $($+(%,joinss,#),2)) { msg # 8,1Welcome $nick $+ ! You are viewer 0,1# $+ $($+(%,join,#),2) }
}
on $*:TEXT:/^\.(welcome|joins|stats)$/iS:#: {
if ($regml(1) = welcome) { msg # Welcoming users on join is now 04 $+($iif($($+(%,welcome,#),2),DIS,EN),ABLED) | $iif($($+(%,welcome,#),2),unset,set) $+(%,welcome,#) on }
elseif ($regml(1) = joins) { msg # Displaying join number on join is now 04 $+($iif($($+(%,joinss,#),2),DIS,EN),ABLED) | $iif($($+(%,joinss,#),2),unset,set) $+(%,joinss,#) on }
elseif ($regml(1) = stats) { msg # 4,1Joins:0,1 $iif($($+(%,joinss,#),2),on,off) 04,1Welcome:0,1 $iif($($+(%,welcome,#),2),on,off) }
}
Instead of using two repeated commands and messages under your text event, you could do this:
on *:text:*:#: {
if ($1 == .welcome) {
$iif(%welcome [ $+ [ # ] ] != yes,set %welcome [ $+ [ # ] ] yes,$iif(%welcome [ $+ [ # ] ] == yes,set %welcome [ $+ [ # ] ] no))
msg # Welcoming users on join is now $iif(%welcome [ $+ [ # ] ] == yes,9 ENABLED,4 DISABLED)
}
if ($1 == .joins) {
$iif(%joinss [ $+ [ # ] ] != yes,set %joinss [ $+ [ # ] ] yes,$iif(%joinss [ $+ [ # ] ] == yes,set %joinss [ $+ [ # ] ] no))
msg # Displaying join number on join is now $iif(%joinss [ $+ [ # ] ] == yes,9 ENABLED,4 DISABLED)
}
if ($1 == .stats) { msg # 4,1Joins:0,1 %joinss [ $+ [ # ] ] 4,1Welcome:0,1 %welcome [ $+ [ # ] ] }
}
And no /halt is necessary.