On usermode
From Scriptwiki
The on USERMODE event triggers triggers when you change your usermode.
on <level>:USERMODE:<commands>
Read access levels to get more info about the <level> field.
Note that $1- refers to the changed usermode.
Example
on *:USERMODE: { echo -a Changed usermode: $1- }
This event would trigger when you get the confirmation of a usermode changing and echo's it to the active window.
To check if you e.g. have set +x is more complicated as $1- could e.g. be "-w+x", so you have to loop through $1-.
on *:USERMODE: { ; set looping variable and %m as variable holding whether the current mode we are looking at ; was set or unset var %i = 1, %m ; begin to loop through $1- while (%i <= $len($1-)) { ; check if the current char is "-" and set %m to it (all modes will be unset after "-") if ($mid($1-,%i,1) == -) { %m = - } ; check if the current char is "+" and set %m to it (all modes will be set after "+") if ($mid($1-,%i,1) == +) { %m = + } ; if the char we are looking at is "x" if ($mid($1-,%i,1) == x) { ; we need to check whether %m is "+" (so x is set, not unset) and echo it if (%m == +) { echo -a Mode +x was just set. } } inc %i }
See Also
- On Mode event to react on channelmode changes.