egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Sun Mar 27, 2016 7:27 pm    Post subject: [SOLVED] Strip control codes italic font (slanted letter) Reply with quote

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:
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:
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.
_________________
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 Smile


Last edited by juanamores on Fri Apr 15, 2016 10:52 am; edited 2 times in total
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Mon Mar 28, 2016 6:50 am    Post subject: Reply with quote

Try with:
Code:

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.
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Mon Mar 28, 2016 2:18 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Tue Mar 29, 2016 12:48 am    Post subject: Reply with quote

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. Embarassed

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

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.
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Tue Mar 29, 2016 1:35 pm    Post subject: Reply with quote

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. Smile
_________________
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 Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sun Apr 03, 2016 2:46 pm    Post subject: Reply with quote

Try this:
Code:

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.
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Tue Apr 05, 2016 6:02 pm    Post subject: Reply with quote

caesar wrote:
Try this:
Code:

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 . Very Happy
_________________
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 Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed Apr 06, 2016 3:21 am    Post subject: Reply with quote

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. Rolling Eyes

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.
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Wed Apr 06, 2016 8:46 am    Post subject: Reply with quote

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 !
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Wed Apr 06, 2016 6:59 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
juanamores
Master


Joined: 15 Mar 2015
Posts: 317

PostPosted: Fri Apr 15, 2016 8:43 am    Post subject: Strip control codes italic font [Solved] Reply with quote

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

Code:
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 Smile
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Mon May 02, 2016 5:48 pm    Post subject: Reply with quote

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
.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber