mIRC Homepage
Posted By: popsy Problems with a snippet - 02/01/04 12:44 AM
I got this snippet, but i can't get it to work.

It's supposed to make my bot join any channels that are advertised in my channel, and tell the abuser to stop, but nothing happens.

Can anyone please tell me what's wrong?

ON *:TEXT:#:#ffj: {
if ($wildtok($1-,*#*,1,32)) {
var %n = $remove($ifmatch,!,.,$chr(44),?)
if (%n != $chan) {
.raw join %n $cr PRIVMSG %n :Lad være med at reklamere på min kanal! / Do not advertise in my channel: < $+ $nick $+ > $1- $cr PART %n
}
}
}
Posted By: theRat Re: Problems with a snippet - 02/01/04 01:21 AM
on *:text:*#*:#ffj: { ...
Posted By: Hitchhiker Re: Problems with a snippet - 02/01/04 01:22 AM
First thing is, you have to wait until you join the channel to message it, so you will need to set a global variable then check if that var exists when you join the channel. Also you will have lost the spam message by this time, so you'll need to save that to the variable too:

Code:
ON *:TEXT:*:#ffj:{ 
  if ($wildtok($1-,#*,1,32)) { 
    var %n = $remove($ifmatch,!,.,$chr(44),?) 
    if ($me !ison %n) { 
      join -n %n
      set -u20 %antispam %n $+(&lt;,$nick,&gt;) $1-
    } 
  } 
} 
on me:*:join:#:{
  if (# == $gettok(%antispam,1,32)) {
    msg # Lad være med at reklamere på min kanal! / Do not advertise in my channel: $gettok(%antispam,2-,32) 
    part # 
    unset %antispam
  }
}

should be something like what you want.
Posted By: KingTomato Re: Problems with a snippet - 02/01/04 01:53 AM
Figued this would be a good time to test out what regex can do, but what is wrong with this?

on $*:TEXT:/^[\(\)\[\]]*(#|&)[^\s,]*[\.!\?\(\)\[\]]*$/i:#: {
/echo -a Channel Found! $regml(1)
}

That should mean:
May begin with ()[]
Channel must have prefix of # or &
May contain any characters but space, and comma (Not sure how to incorperate char 7
May end in ()[].!?
[ Is Case Insensitive ]

but it's definatly not working for me. It tests true for when a channel is found, but $regml doesn't return the channel name, only "#". It's gott o have tomsehting to do with the [^\s,], but what?
Posted By: popsy Re: Problems with a snippet - 02/01/04 07:38 AM
Thx alot guys, it works now.
Posted By: Man Re: Problems with a snippet - 03/01/04 03:09 PM
no its got to do with the (#|&), $regml will return what it found inside ( and ), so $regml is either going to be # or &
Posted By: KingTomato Re: Problems with a snippet - 03/01/04 09:16 PM
Ahh, thats why people do things like ([a-zA-Z0-9]) blah >:D Thanks.

Also, does ^ mean "exclude" in the []'s?
© mIRC Discussion Forums