mIRC Home    About    Download    Register    News    Help

Print Thread
#242401 10/07/13 07:09 PM
Joined: Jun 2013
Posts: 43
G
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Jun 2013
Posts: 43
Hi, I have quite a few scripts in my mIRC for my bot but some people want some of the features enabled, whereas others don't. I'm wondering if there is a way to only enable the scripts in some channels.

Code:
ON @*:TEXT:*:#: {
  IF (($len($1-) < 9) || ($nick isop #)) { RETURN }
  var %a = $regex($1-,/[A-Z]/Sg) / $regex($1-,/[^ ]/Sg)
  if (%a >= 0.8) {
    inc -e $+(%,caps,$cid,#,.,$site)
    if ($($+(%,caps,$cid,#,.,$site),2) > 3) { 
      msg $chan .timeout $nick 600
      msg $chan $nick has been timed out for 10 minutes for using excessive ammounts of caps.  
    unset $+(%,caps,$cid,#,.,$site) } 
    else msg $chan $nick $+ : Please use less caps, $ord($v1) warning.
  }
}


For instance, that is one of the scripts that I would like disabled in only some channels. I would like it so when someone types '!capsban on' into a specific channel, it enables it and '!capsban off' disables it. I can't think of a way to do this so any help would be greatly appreciated, if this makes no sense, please say and I will try and make it more clear.
Many thanks, Tom.

Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
You put the literal chans you want enabled in the first line: ON @*:TEXT:*:#chan1,#chan2: {

Conversely you can also provide the channels you want it disabled for inside of the functioin:

Code:
ON @*:TEXT:*:#: {
  if ($istok(#chan1 #chan2,$chan,32)) return

Joined: Jun 2013
Posts: 43
G
Ameglian cow
OP Offline
Ameglian cow
G
Joined: Jun 2013
Posts: 43
Thanks, this seems to work. However, is there a way to disable and enable the script for different channels using an On Text command? So if '!capsban on' is entered in that channel, it turns it on, and '!capsban off' turns it off?
Anyway, thanks for the help.

Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You can enter the channels allowed into a variable and use that in your $istok() instead of hard coding the channels. Just keep in mind that there is a limit to a variable's length, so if you're expecting many channels, that won't work. Other options include saving the channels to a file or putting them into a hash table. You could do other things as well, but those would do the trick.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard