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.

$strip

Old posts that have not been replied to for several years.
b
bozo

$strip

Post by bozo »

i was trying to use the var $strip in my tcl , but the eggdrop returns that this variable doesn't is avaiable not configured yet or something like that
:)

how i set this variable in the tcl to my eggdrop reads the lines in the chanel without any codes , color codes , bold , underline etc .....
i want that works like scripting language $strip($i)
$i is already the full line (and already configured) in the channel that my eggdrop reads , i want it striped


thanks
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

use something like:

Code: Select all

set text [ctrl:filter $text]
and this:

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
}
Thanks to ppslim for the strip code.
Once the game is over, the king and the pawn go back in the same box.
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

do a forum search, you will find a procedure provided by Ppslim that strips all control characters from the text.
b
bozo

Post by bozo »

just added what you said to my tcl , and the eggdrop returned this

Code: Select all

[15:26] Tcl error in file 'eggdrop.conf':
[15:26] can't read "text": no such variable
    while executing
"ctrl:filter $text"
    invoked from within
"set text [ctrl:filter $text] "
    (file "scripts/aprender.tcl" line 130)
    invoked from within
"source scripts/aprender.tcl
"
    (file "eggdrop.conf" line 1363)
[15:26] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
[/code]
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

caesar wrote:use something like: ...
Filtering "a\003,\0030,\0030,0b" should result in "a,,b", not "ab" (like the proc you pasted)

Try

Code: Select all

proc ctrlfilter {str} {
	regsub -all {\002|\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\026|\037} $str "" str
	return $str
}
and btw: \006 & \007 ain't mirc control codes
Have you ever read "The Manual"?
b
bozo

Post by bozo »

the problem is here

Code: Select all

set text [ctrl:filter $text] 
the eggdrop says that can't find "text" variable ...
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

bozo wrote:the eggdrop says that can't find "text" variable ...
if your text is in "i", why are you trying to filter "text"?
Have you ever read "The Manual"?
b
bozo

Post by bozo »

thanks everybody
i tryed put the code you guys send to me every place in the tcl
and finally it worked
the bot doesnt acept color codes , bold etc , but , i have problems with case sensitive .....
how i resolve this?
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

bozo wrote:i have problems with case sensitive .....
how i resolve this?
Some commands have a -nocase option. (check the manual) If the command you're using doesn't have this, convert the strings to lowercase using 'string tolower'
Have you ever read "The Manual"?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Bugg ppslim with the ctrl:filter proc :) I'm using it and is working fine at me.. also, doh! I've gave you an example with the set text [ctrl:filter $text] .. don't take it *ad literam* :P

PS: Here is a lil test to proove that ppslim control filter thing is working fine:

Code: Select all

bind pub - !bla pub:bla

proc pub:bla {nick uhost hand chan text} {
putserv "PRIVMSG $chan :result: [ctrl:filter $text]"
}

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 
}
Just do a !bla something with bold or whatever you want and then see by yourself what is the result..
Once the game is over, the king and the pawn go back in the same box.
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

caesar wrote:I'm using it and is working fine at me.
Sure..if you don't care about losing stuff that is not part of the color code :P Try my example and you'll see what I mean.
Have you ever read "The Manual"?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

What you mean by "losing stuff that is not part of the color code" ? I'll have a look on yours tomorow, not I'm off to bed. :P
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 »

I havn't got chance to check, however, is the bugger version actualy included in no!spam, or have you altered yours on accident?

The loss of such things is trivial, though it is still incorrect.

As for the non-mirc codes. Correct, however, both are two well used codes.

007 is BEL.

006 is used by other client, which I can't remember.

I should also have 011 in as mIRC will render it as a tab with certain fonts.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

I'ts the same code as you've *sugested* to me in a post long time ago.. Thanks for pointing that out.
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 »

Funny.. I do see that the same proc as I've posted above is still used in the no!spam 1.7.2.. so, wich is wich? I'm a bit confused..
Once the game is over, the king and the pawn go back in the same box.
Locked