Did you know? [random xchat facts]
If you want to auto-remove files from the DCC windows when they are finished or aborted, you can /set dcc_remove 1. Great for file servers.
xchat.org
XChat IRC Client
 
 FAQFAQ   SearchSearch   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Text formatting doesn't work through scripts?

 
Post new topic   Reply to topic    xchat.org Forum Index -> Scripts and Plugins
View previous topic :: View next topic  
Author Message
ShadowMetis



Joined: 05 Feb 2005
Posts: 2

PostPosted: Sat Feb 12, 2005 10:45 pm    Post subject: Text formatting doesn't work through scripts? Reply with quote

Whenever I use %B or any of the other things to format messages in such from inside one of my perl scripts, it shows up as %B in the message instead of just making it bold.
Back to top
View user's profile Send private message
Khisanth



Joined: 10 Jun 2004
Posts: 1557

PostPosted: Sun Feb 13, 2005 8:54 am    Post subject: Reply with quote

that is correct, in place of %B you can use \cB.

%B => \cB
%C => \cC
%U => \c_
%O => \cO
%R => \cV

These need to be in double quoted strings to work as expected.
Back to top
View user's profile Send private message
ShadowMetis



Joined: 05 Feb 2005
Posts: 2

PostPosted: Mon Feb 14, 2005 3:23 pm    Post subject: Reply with quote

Ahhhhh
Thanks, I was wondering about that for a while.
Back to top
View user's profile Send private message
ninjamalte



Joined: 22 Mar 2005
Posts: 1

PostPosted: Tue Mar 22, 2005 6:36 pm    Post subject: Reply with quote

Khisanth wrote:
that is correct, in place of %B you can use \cB.

%B => \cB
%C => \cC
%U => \c_
%O => \cO
%R => \cV

These need to be in double quoted strings to work as expected.

The following python-code doesn't seem to work. Am I missing something?
Code:
xchat.prnt("\cBfoo")
Back to top
View user's profile Send private message
Khisanth



Joined: 10 Jun 2004
Posts: 1557

PostPosted: Tue Mar 22, 2005 11:22 pm    Post subject: Reply with quote

this is just for Perl, no idea about Python
Back to top
View user's profile Send private message
EXtes



Joined: 15 Jul 2004
Posts: 160
Location: Germany

PostPosted: Wed Mar 23, 2005 8:38 am    Post subject: Reply with quote

In perl \003 or chr(03) will work like %C. Perhaps you find similar in python.
Back to top
View user's profile Send private message
boing



Joined: 22 Mar 2005
Posts: 19
Location: France

PostPosted: Wed Mar 23, 2005 9:05 am    Post subject: IRC codes Reply with quote

formatting codes are defined as:
(type : hexa = octal = xchat char)

Bold : 0x02 = 002 = %B
Color : 0x03 = 003 = %C (with 2 digits after, f.e. \00304 = color 4)
Underlined : 0x1F = 037 = %U
Reverse/Italic : 0x16 = 026 = %R
Out/Escape = 0x0F = 017 = %O

Note:
use octal with \ & code
ex: "\002text\002" will give text
"\026\037o\037ne \037t\037wo \037t\037hree" will give one two three (italic or reversed, I think it depends on the client... AFAIL it is most oftenly reversed)
Back to top
View user's profile Send private message
nexu



Joined: 15 Apr 2006
Posts: 13

PostPosted: Mon Jun 05, 2006 8:58 pm    Post subject: Reply with quote

EXtes wrote:
In perl \003 or chr(03) will work like %C. Perhaps you find similar in python.


I have a function which does that for me:
Code:

def colordecode(word):
   _B = re.compile('%B', re.IGNORECASE)
   _C = re.compile('%C', re.IGNORECASE)
   _R = re.compile('%R', re.IGNORECASE)
   _T = re.compile('%T', re.IGNORECASE)
   _U = re.compile('%U', re.IGNORECASE)
   return _B.sub('\002', _C.sub('\003', _R.sub('\026', _T.sub('\017', _U.sub('\037', word)))))

print colordecode("%Bhello%B world")
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    xchat.org Forum Index -> Scripts and Plugins All times are GMT
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


Powered by phpBB © 2001, 2005 phpBB Group