This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

weird

Old posts that have not been replied to for several years.
Locked
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

weird

Post by caesar »

Code: Select all

setudef flag colour

bind ctcp * ACTION action:colour

proc action:colour {nick uhost hand dest keyword text} {
  if {$nick == $::botnick || ![channel get $dest colour] || [matchattr $hand of|fo $dest] || [isop $nick $dest]} { return }
  if {![string match "*\002*" $text] || ![string match "*\003*" $text] || ![string match "*\026*" $text] || ![string match "*\037*" $text]} { return }
  if {[string match "*#*" $text]} {
    channel:spam $nick $uhost $hand $chan $text
    return
  }
  if {[string match "*www.*" $text] || [string match "*http*" $text]} {
    web:spam $nick $uhost $hand $chan $text
    return
  }
  if {![botisop $dest]} {
    set mask "*!*@[lindex [split $uhost @] 1]"
    newchanban $dest $mask Colour "\0025\002 minutes ban for using colours within $dest" 5
    return
  }
  set mask "*!*@[lindex [split $uhost @] 1]"
  newchanban $dest $mask Colour "\0025\002 minutes ban for using colours within $dest" 5
}
I have the channel +colour and it dosen't seem to be doing nothing. He stops after the no match of bold, colours, reverse and underline, duno why. Any sugestions, tips or something to make it more easier and to be working?
Once the game is over, the king and the pawn go back in the same box.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Have your tried putting any putlog lines in.

That should allways be the first port of call.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I've added and replaced like this:

Code: Select all

 if {![string match "*\002*" $text] || ![string match "*\003*" $text] || ![string match "*\026*" $text] || ![string match "*\037*" $text]} {
putlog "return"
return 0 }
putlog "continue"
and eyther I've put return 0 or 1 I've seen only the return line not the continue one as should be, eyther I've userd *colors* or not.
Once the game is over, the king and the pawn go back in the same box.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Also, something more weird than I've ever seen. Replaced and removed like this:

Code: Select all

  if {[string match "*\002*" $text] || [string match "*\003*" $text] || [string match "*\026*" $text] || [string match "*\037*" $text]} {
putlog "return"
return 1 }
putlog "continue"
When I'm not using colors he "continues" and when I'm using them he *returns*.. Viceversa is not working, duno why.. Using colours he *returns* and when not using them he *returns* also..
Once the game is over, the king and the pawn go back in the same box.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Start using brackets then, sounds like a parsing mistake.

On top, reduce it to one string match using

Code: Select all

if {![string match {*[\002\003\026\037]*} $text]} { 
putlog "return" 
return 0
} 
putlog "continue"
The square brackets are a nice feature of string match, that allow a range of characters, and in genral mean "match any of these".
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Thanks for the tip. It still acting weird, like I've just mentioned in my previous post.
Once the game is over, the king and the pawn go back in the same box.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Try removing one character from the match at a time, and confirm it is not the character codes.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I've tested by removing one by one and finaly I've got to

Code: Select all

proc action:colour {nick uhost hand dest keyword text} {
if {![string match {*[\002]*} $text]} {
putserv "PRIVMSG $dest :return"
return } 
putserv "PRIVMSG $dest :continue"
}
When is something with bold or without it he only says "return". After I've removed the "!" he only says "continue"..
Once the game is over, the king and the pawn go back in the same box.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

Very very odd - have you tried removignt he \002 and leaving the rest in, to see what happens then?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Same thing as happend with the bold, happened to colour, underline and reverse. Same continue and same return..
Once the game is over, the king and the pawn go back in the same box.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

use regexp

Code: Select all

if {![regexp {\002|\003|\026|\037} $text]} {
putserv "PRIVMSG $dest :return" 
return } 
putserv "PRIVMSG $dest :continue" 
} 
I tested this

Code: Select all

string match {*[\002]*} $text
on a bot and it always returns "0" if the text is bold or not, same thing with \003 \026 and \037
Last edited by Papillon on Thu Apr 10, 2003 7:33 am, edited 1 time in total.
Elen sila lúmenn' omentielvo
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

There is no reason for this to happen. You may want to try the following instead of string match.

Code: Select all

proc ctrl:filter {str} {regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $str "" str ; return $str}
That should be placed outside the proc.

Then use this instead of "string match"

Code: Select all

if {[ctrl:filter $text] == $text} { return }
The above code was taken from No!Spam. It is used to filter out colour and control codes, so you can't insert it into text, to get around the spam filters.

The idea being. If the filtered text, is exactly the same to non-filtered text, it doesn't contain any characters.

If it isn't the same it does.

The filter above also removes a couple of other characters, including the anoying bell sound. They may be of use to you, but you can remove them. While it is a regexp, you can pretty much see the format it takes.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

ppslim's sugestion seems to be working fine, also the 'regexp'.. thank you.
Once the game is over, the king and the pawn go back in the same box.
Locked