I saw in the chat room where someone asked a simple way to enable a certain protection per room. In this example I will be using channel menu and gettok to set a variable containing rooms you want to enable the protection for.
First let's configure the popup window for the channel. For this example we will make a very simple on text protection.
This will add/remove the channel from the list of channels where the text prot will be active. A checkmark will mark if the protection is enabled for that particular channel
the variable will look like this
%textkick %#err0rtest,%#IRCommunity,%#_SoulFly_
Using $istok we can check if the room is already in variable. If it is it will remove it and if it isn't it will add it
menu channel {
.$iif($istok(%textkick,$active,44),$style(1)) TextKick: $iif($istok(%textkick,$active,44),set %textkick $remtok(%textkick,$active,1,44),set %textkick $addtok(%textkick,$active,44))
}
now on to a sample command to use the variable. In this very simple example it is set to trigger on the use of the word testing in their text. If the $chan istok ( sorta like isin ) the variable it will trigger. If not it won't.
on *:TEXT:*testing*:#: {
if ($istok(%textkick,$chan,44)) { echo -a the prot is on }
}
For those unfamiliar with *toks here is a brief explanation of what i've done above
istok ( is token )
if ($istok(%textkick,$chan,44)
Here i am checking to see if the chan is in the variable. The 44 is simple the $chr num for a ,
In my example of the variable you see that each channel is separated by a comma
if my variable was %test one,two,three
$istok(%test,one,44) would be $true
$istok(%test,four,44) would be $false
Now we move on to the $addtok ( add token )
We have already checked to see if the channel istok .
Now in our menu snippet if $active is not in the variable we want to add it
set %textkick $addtok(%textkick,$active,44)
$addtok will only add it if it does not already exist.
So if you tried to addtok something that is already in there it will not add it twice. You will not have to worry about adding multiple instances of the same thing.
On the other end we have remtok ( remove token )
set %textkick $remtok(%textkick,$active,1,44)
Here we are removing the channel if it's in the variable.
the 1 represents the first instance. Since we used addtok there will always be just one instance so no need to change the 1.
You can leave the 1 out and it would remove any instance. Either way will work. Again the 44 is simply the character number for the , which I used to separate the channel names. You can use whatever character you want.. example space is 32, - is 45, etc
This is a very simple but effective way to do per channel events. As always there are lots of other ways to do it. If anyone sees any errors with this tutorial feel free to refine it. It's just a basic guide.