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.

[SOLVED] Strip control codes italic font (slanted letter)

Help for those learning Tcl or writing their own scripts.
Post Reply
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

[SOLVED] Strip control codes italic font (slanted letter)

Post by juanamores »

Is there any way to perform strip the italic font (slanted letter) ?

So far I am using this code which I use for colors, bold , underlined, but it does not work for italic font (slanted letter)

Code: Select all

catch {unbind raw - PRIVMSG *raw:irc:msg}
catch {unbind raw - PRIVMSG *raw:PRIVMSG}
bind raw - PRIVMSG striprivmsg
proc striprivmsg {f k a} {
   regsub -all {\002|\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\026|\037} $a {} a 
   *raw:irc:msg $f $k $a
   *raw:PRIVMSG $f $k $a
}
I also tried this code, but it did not work:

Code: Select all

catch {unbind raw - PRIVMSG *raw:irc:msg}
catch {unbind raw - PRIVMSG *raw:PRIVMSG}
bind raw - PRIVMSG striprivmsg
proc striprivmsg {f k a} {
  set a [stripcodes abcgru $a] 
   *raw:irc:msg $f $k $a
   *raw:PRIVMSG $f $k $a
}
I never cared the italics, but a person tried to play BogusTrivia wrote in italics and the bot not obeyed.
Last edited by juanamores on Fri Apr 15, 2016 10:52 am, edited 2 times in total.
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Try with:

Code: Select all

unbind raw - PRIVMSG *raw:irc:msg
unbind raw - PRIVMSG *raw:PRIVMSG
bind raw - PRIVMSG striprivmsg
proc striprivmsg {f k a} {
	regsub -all {[^\u0020-\u007e]+} $a {} $a
	*raw:irc:msg $f $k $a
	*raw:PRIVMSG $f $k $a
}
Once the game is over, the king and the pawn go back in the same box.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

Dear caesar , I've tried your code, but it does not work neither with the italics nor with bold nor underlined nor colors ...
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Oh crap. Haven't tested the code, found it over the Internet and thought might help. You are right, ran a test right now and doesn't seem to be working. Sorry. :oops:

I see you tried two methods that should do what you asked for, and I fail to understand why they don't work. :roll:

Will open up a test bot to see what's up.
Once the game is over, the king and the pawn go back in the same box.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

The two anterior methods I mentioned works very well, except for italic font.
Very grateful for your help and if you have any other way to fix it would thank it a lot. :)
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Try this:

Code: Select all

regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $a {} $a
Haven't tested it so let me know if works.
Once the game is over, the king and the pawn go back in the same box.
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

caesar wrote:Try this:

Code: Select all

regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026|\006|\007} $a {} $a
Haven't tested it so let me know if works.
It did not work , but do not worry, I suggested to the user who does not use such font more if you plan to play BogusTrivia.
Very friendly and thanks for the help . :D
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Just downloaded latest mIRC client to test things out and nothing that I used to know doesn't seem to be working any more.

I have no idea what's the current code for italics.. Only Ctrl + I seems to making text in italics. :roll:

Sadly the only option would be to drop the control codes when playing trivia.
Once the game is over, the king and the pawn go back in the same box.
w
willyw
Revered One
Posts: 1196
Joined: Thu Jan 15, 2009 12:55 am

Post by willyw »

So I had the idea to see what it looked like, raw.

Tried .console +r in a bot. Can't see it.

Even tried /debug -n newwindow
in mIRC - and can't see it.

Where _IS_ the control code? I've never really thought about this before...
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Post by juanamores »

I'm asking in the mIRC official forum where is the control code.
When responding me I share here....
Edit:
Someone answered mIRC forum that the character is: $chr(29)

I tried and character work , creating the italic font.
Do not know if this can help ...
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
j
juanamores
Master
Posts: 317
Joined: Sun Mar 15, 2015 9:59 am

Strip control codes italic font [Solved]

Post by juanamores »

I already solved and it works for all (italics, bold, underline, colors...)

Code: Select all

regsub -all {[\001-\010]|[\013-\037]|[\177]|\003([0-9]{1,2}(,[0-9]{1,2})?)?} $a {} a
Thanks to caesar and willyw for their help and concern to fix it .

IMPORTANT EDIT:
Use this workaround at your own risk, it can cause problems with CTCP .
Please DO NOT use it!

I Do not remove the solution so that it can investigate the reasons that can cause damage to the CTCP .
If a moderator deems it necessary, edit or delete this post.
If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks :)
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

Please see this related forum post for a possible fix.

http://forum.egghelp.org/viewtopic.php?t=20133
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Post Reply