Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ General ➜ IRC colors

IRC colors

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  

Posted by Vercalos   (23 posts)  Bio
Date Fri 11 Mar 2005 12:44 AM (UTC)
Message
I'm currently using MUSCHclient to connect to an IRC channel, and now I'm trying to get color to work. Any suggestions on how to get the client to recognize the colors, or convert IRC to ANSI?
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #1 on Fri 11 Mar 2005 04:11 AM (UTC)
Message
Well, I'd say (as I often do lately): filter packets in OnPluginPacketReceive, replacing IRC codes with their ANSI equivalents. I don't know anything about the specifics of IRC though, do you have any links to the specification or something of that kind?
Top

Posted by Vercalos   (23 posts)  Bio
Date Reply #2 on Fri 11 Mar 2005 05:13 AM (UTC)
Message
Not that I can think of.
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #3 on Fri 11 Mar 2005 05:21 AM (UTC)
Message
How about taking a look at packet-debug. It'll let you know what you need to match on.

However, the second google link comes up with this:
http://www.visualirc.net/tech-attrs.php

Which seems like what you're looking for.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Vercalos   (23 posts)  Bio
Date Reply #4 on Fri 11 Mar 2005 05:46 AM (UTC)

Amended on Fri 11 Mar 2005 05:48 AM (UTC) by Vercalos

Message
Yeah, but I honestly don't know how to script it.
The most advanced stuff I've ever worked on are triggers, and the most advanced script I've ever done I can't even remember how I did, and it was just a counter.
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #5 on Fri 11 Mar 2005 06:50 AM (UTC)
Message
Scripting it isn't much of a problem, but I am too lazy to go find an IRC server, connect to it and log some output. So turn on Packet Debug (under File menu, I think) and log for awhile, then post it back here. That way we can see what the codes look like and compare them with the specs (which don't make much sense without concrete examples).
Top

Posted by Vercalos   (23 posts)  Bio
Date Reply #6 on Fri 11 Mar 2005 06:57 AM (UTC)
Message
Umm.. Where do you get the logs?
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #7 on Fri 11 Mar 2005 07:15 AM (UTC)
Message
Edit > Debug Packets (Ctrl-Alt-F11)

Then you have to un-maximize your main world (since it doesn't come to front) and you'll see it. Just copy/paste (or save to a file, or whatnot).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Vercalos   (23 posts)  Bio
Date Reply #8 on Fri 11 Mar 2005 07:21 AM (UTC)
Message
Here are a few packets.

Incoming packet: 361 (72 bytes)

:Jen!dowie@p1647 3a 4a 65 6e 21 64 6f 77 69 65 40 70 31 36 34 37
-apx1.akl.ihug.c 2d 61 70 78 31 2e 61 6b 6c 2e 69 68 75 67 2e 63
o.nz PRIVMSG #Cl 6f 2e 6e 7a 20 50 52 49 56 4d 53 47 20 23 43 6c
anBOB :.13why co 61 6e 42 4f 42 20 3a 03 31 33 77 68 79 20 63 6f
lours?.. 6c 6f 75 72 73 3f 0d 0a

Incoming packet: 362 (81 bytes)

:ComradeZoo!hotm 3a 43 6f 6d 72 61 64 65 5a 6f 6f 21 68 6f 74 6d
ail@S01060004e23 61 69 6c 40 53 30 31 30 36 30 30 30 34 65 32 33
4dbbe.cg.shawcab 34 64 62 62 65 2e 63 67 2e 73 68 61 77 63 61 62
le.net PRIVMSG # 6c 65 2e 6e 65 74 20 50 52 49 56 4d 53 47 20 23
ClanBOB :or fly. 43 6c 61 6e 42 4f 42 20 3a 6f 72 20 66 6c 79 0d
. 0a

Sent packet: 67 (113 bytes)

privmsg #clanbob 70 72 69 76 6d 73 67 20 23 63 6c 61 6e 62 6f 62
:I'm trying to 20 3a 49 27 6d 20 74 72 79 69 6e 67 20 74 6f 20
get an output lo 67 65 74 20 61 6e 20 6f 75 74 70 75 74 20 6c 6f
g so that I can 67 20 73 6f 20 74 68 61 74 20 49 20 63 61 6e 20
write up a scrip 77 72 69 74 65 20 75 70 20 61 20 73 63 72 69 70
t so I can actua 74 20 73 6f 20 49 20 63 61 6e 20 61 63 74 75 61
lly see colors.. 6c 6c 79 20 73 65 65 20 63 6f 6c 6f 72 73 2e 0d
. 0a

Incoming packet: 363 (76 bytes)

:Jen!dowie@p1647 3a 4a 65 6e 21 64 6f 77 69 65 40 70 31 36 34 37
-apx1.akl.ihug.c 2d 61 70 78 31 2e 61 6b 6c 2e 69 68 75 67 2e 63
o.nz PRIVMSG #Cl 6f 2e 6e 7a 20 50 52 49 56 4d 53 47 20 23 43 6c
anBOB :.11having 61 6e 42 4f 42 20 3a 03 31 31 68 61 76 69 6e 67
problems?.. 20 70 72 6f 62 6c 65 6d 73 3f 0d 0a
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #9 on Fri 11 Mar 2005 09:31 AM (UTC)
Message
IRC is RFC 1459 by the way, if you need it.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #10 on Fri 11 Mar 2005 10:20 PM (UTC)
Message
Check if this works. It's supposed to go into a text file named "IRC2ANSI.xml" saved in your default Plugins folder, and then needs to be installed through File->Plugins


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, March 05, 2005, 6:39 AM -->
<!-- MuClient version 3.65 -->

<!-- Plugin "ANSI_Escape" generated by Plugin Wizard -->

<muclient>
<plugin
   name="IRC2ANSI"
   author="Keldar"
   id="7eabd2446981b4760d0db8f4"
   language="VBscript"
   purpose="Converting IRC colour codes to ANSI ones"
   save_state="y"
   date_written="2005-03-12"
   requires="3.65"
   version="1.0"
   >

</plugin>


<!--  Script  -->

<script>
<![CDATA[
dim reg, codes
Set reg = New RegExp
reg.Pattern = "\x03(\,([0-9][0-5]?|)|([0-9][0-5]?)(\,([0-9][0-5]?|)|)|\,|)"
reg.Global = True

set code = CreateObject("Scripting.Dictionary")
code.Add "0", chr(&H1b) & "[1m" & chr(&H1b) & "[37m"
code.Add "1", chr(&H1b) & "[30m"
code.Add "2", chr(&H1b) & "[34m"
code.Add "3", chr(&H1b) & "[32m"
code.Add "4", chr(&H1b) & "[1m" & chr(&H1b) & "[31m"
code.Add "5", chr(&H1b) & "[31m"
code.Add "6", chr(&H1b) & "[35m"
code.Add "7", chr(&H1b) & "[33m"
code.Add "8", chr(&H1b) & "[1m" & chr(&H1b) & "[33m"
code.Add "9", chr(&H1b) & "[1m" & chr(&H1b) & "[32m"
code.Add "10", chr(&H1b) & "[36m"
code.Add "11", chr(&H1b) & "[1m" & chr(&H1b) & "[36m"
code.Add "12", chr(&H1b) & "[1m" & chr(&H1b) & "[34m"
code.Add "13", chr(&H1b) & "[1m" & chr(&H1b) & "[35m"
code.Add "14", chr(&H1b) & "[1m" & chr(&H1b) & "[30m"
code.Add "15", chr(&H1b) & "[37m"

set bcode = CreateObject("Scripting.Dictionary")
bcode.Add "0", chr(&H1b) & "[1m" & chr(&H1b) & "[46m"
bcode.Add "1", chr(&H1b) & "[39m"
bcode.Add "2", chr(&H1b) & "[43m"
bcode.Add "3", chr(&H1b) & "[41m"
bcode.Add "4", chr(&H1b) & "[1m" & chr(&H1b) & "[40m"
bcode.Add "5", chr(&H1b) & "[40m"
bcode.Add "6", chr(&H1b) & "[44m"
bcode.Add "7", chr(&H1b) & "[42m"
bcode.Add "8", chr(&H1b) & "[1m" & chr(&H1b) & "[42m"
bcode.Add "9", chr(&H1b) & "[1m" & chr(&H1b) & "[41m"
bcode.Add "10", chr(&H1b) & "[45m"
bcode.Add "11", chr(&H1b) & "[1m" & chr(&H1b) & "[45m"
bcode.Add "12", chr(&H1b) & "[1m" & chr(&H1b) & "[43m"
bcode.Add "13", chr(&H1b) & "[1m" & chr(&H1b) & "[44m"
bcode.Add "14", chr(&H1b) & "[1m" & chr(&H1b) & "[39m"
bcode.Add "15", chr(&H1b) & "[46m"

function OnPluginPacketReceived(packet)
	dim matches, match, subst
	set matches = reg.Execute(packet)
	for each match in matches
		if (match.SubMatches(0) = "") or (match.SubMatches(0) = ",") and ( len(match.SubMatches(0)) < 2 ) then
			subst = chr(&H1b) & "[0m"
		elseif ( Left(match.SubMatches(0),1) = "," ) and (match.SubMatches(1) <> "") then
			subst = chr(&H1b) & "[47m" & bcode.Item(match.SubMatches(1))
		elseif match.SubMatches(3) = "," then
			subst = code.Item(match.SubMatches(2)) & chr(&H1b) & "[49m"
		elseif match.SubMatches(3) = "" then
			subst = code.Item(match.SubMatches(2))
		else
			subst = code.Item(match.SubMatches(2)) & bcode.Item(match.SubMatches(4))
		end if
		OnPluginPacketReceived = Replace(packet, match, subst )
	next
end function

]]>
</script>


</muclient>
Top

Posted by Vercalos   (23 posts)  Bio
Date Reply #11 on Sat 12 Mar 2005 09:33 AM (UTC)

Amended on Sat 12 Mar 2005 09:41 AM (UTC) by Vercalos

Message
Sorry to ask for more, but would it be possible to make a script out of this?
<triggers>
<trigger
match=":*!*@* PRIVMSG #ClanBOB :*"
omit_from_log="y"
send_to="2"
sequence="100"
other_text_colour="whitesmoke"
>
<send>&lt;%1&gt; %4</send>
</trigger>
</triggers>



Oh and the script didn't work. It turned all the text black and bled. I'm not sure if it's even possible to convert them efficiently, if at all, considering the variations. I think you'd have to know IRC and Mushclient scripting inside and out to actually be able to do it.
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #12 on Sat 12 Mar 2005 02:10 PM (UTC)
Message
What's the address and port of the server you are using? And the whole procedure of connecting to it? I'll check what the problem is with it.
Top

Posted by Ked   Russia  (524 posts)  Bio
Date Reply #13 on Sat 12 Mar 2005 07:59 PM (UTC)
Message
This version works, although not perfectly. The main problem is that IRC defines 16 default colours, while ANSI only has 8, so it looks awkward sometimes. Originally I tried making up for the missing 8 colours using bold, but that looks even uglier. I'll try to do it with MXP if I have time later.


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, March 05, 2005, 6:39 AM -->
<!-- MuClient version 3.65 -->

<!-- Plugin "ANSI_Escape" generated by Plugin Wizard -->

<muclient>
<plugin
   name="IRC2ANSI"
   author="Keldar"
   id="7eabd2446981b4760d0db8f4"
   language="VBscript"
   purpose="Converting IRC colour codes to ANSI ones"
   save_state="y"
   date_written="2005-03-12"
   requires="3.65"
   version="1.1"
   >

</plugin>


<!--  Script  -->

<script>
<![CDATA[
dim reg, codes
Set reg = New RegExp
reg.Pattern = "(?:\x02|\x15|\x18|\x29|\x31|\x03(\,([0-9][0-5]?|)|([0-9][0-5]?)(\,([0-9][0-5]?|)|)|\,|))+?"
reg.Global = True

set code = CreateObject("Scripting.Dictionary")
'code.Add "0", chr(&H1b) & "[1m" & chr(&H1b) & "[37m"
code.Add "0", chr(&H1b) & "[37m"

code.Add "1", chr(&H1b) & "[30m"
code.Add "2", chr(&H1b) & "[34m"
code.Add "3", chr(&H1b) & "[32m"
'code.Add "4", chr(&H1b) & "[1m" & chr(&H1b) & "[31m"
code.Add "4", chr(&H1b) & "[31m"

code.Add "5", chr(&H1b) & "[31m"
code.Add "6", chr(&H1b) & "[35m"
code.Add "7", chr(&H1b) & "[33m"

'code.Add "8", chr(&H1b) & "[1m" & chr(&H1b) & "[33m"
code.Add "8", chr(&H1b) & "[33m"

'code.Add "9", chr(&H1b) & "[1m" & chr(&H1b) & "[32m"
code.Add "9", chr(&H1b) & "[32m"

code.Add "10", chr(&H1b) & "[36m"
'code.Add "11", chr(&H1b) & "[1m" & chr(&H1b) & "[36m"
code.Add "11", chr(&H1b) & "[36m"

'code.Add "12", chr(&H1b) & "[1m" & chr(&H1b) & "[34m"
code.Add "12", chr(&H1b) & "[34m"

'code.Add "13", chr(&H1b) & "[1m" & chr(&H1b) & "[35m"
code.Add "13", chr(&H1b) & "[35m"

'code.Add "14", chr(&H1b) & "[1m" & chr(&H1b) & "[30m"
code.Add "14", chr(&H1b) & "[30m"

code.Add "15", chr(&H1b) & "[37m"

dim bcode
set bcode = CreateObject("Scripting.Dictionary")
'bcode.Add "0", chr(&H1b) & "[1m" & chr(&H1b) & "[47m"
bcode.Add "0", chr(&H1b) & "[47m"
bcode.Add "1", chr(&H1b) & "[40m"
bcode.Add "2", chr(&H1b) & "[44m"
bcode.Add "3", chr(&H1b) & "[42m"
'bcode.Add "4", chr(&H1b) & "[1m" & chr(&H1b) & "[41m"
bcode.Add "4", chr(&H1b) & "[41m"

bcode.Add "5", chr(&H1b) & "[41m"
bcode.Add "6", chr(&H1b) & "[45m"
bcode.Add "7", chr(&H1b) & "[43m"
'bcode.Add "8", chr(&H1b) & "[1m" & chr(&H1b) & "[43m"
bcode.Add "8", chr(&H1b) & "[43m"

'bcode.Add "9", chr(&H1b) & "[1m" & chr(&H1b) & "[42m"
bcode.Add "9", chr(&H1b) & "[42m"

bcode.Add "10", chr(&H1b) & "[46m"
'bcode.Add "11", chr(&H1b) & "[1m" & chr(&H1b) & "[46m"
bcode.Add "11", chr(&H1b) & "[46m"

'bcode.Add "12", chr(&H1b) & "[1m" & chr(&H1b) & "[44m"
bcode.Add "12", chr(&H1b) & "[44m"

'bcode.Add "13", chr(&H1b) & "[1m" & chr(&H1b) & "[45m"
bcode.Add "13", chr(&H1b) & "[45m"
'bcode.Add "14", chr(&H1b) & "[1m" & chr(&H1b) & "[40m"
bcode.Add "14", chr(&H1b) & "[40m"
bcode.Add "15", chr(&H1b) & "[47m"

dim inverse, italic, bold, underline
inverse = vbFalse
italic = vbFalse
bold = vbFalse
underline = vbFalse

function OnPluginPacketReceived(packet)
	dim matches, match, subst
	set matches = reg.Execute(packet)
	for each match in matches
		if match = chr(&H03) then
			subst = chr(&H1b) & "[0m"
		elseif match = chr(&H02) then
			if bold then
				bold = vbFalse
				subst = chr(&H1b) & "[22m"
			else
				bold = vbTrue
				subst = chr(&H1b) & "[1m"
			end if
		elseif match = chr(&H15) then
			subst = chr(&H1b) & "[1m"
		elseif match = chr(&H18) then
			if inverse then
				inverse = vbFalse
				subst = chr(&H1b) & "[7m"
			else
				inverse = vbTrue
				subst = chr(&H1b) & "[27m"
			end if
		elseif match = chr(&H29) then
			if italic then
				italic = vbFalse
				subst = chr(&H1b) & "[5m"
			else
				italic = vbTrue
				subst = chr(&H1b) & "[25m"
			end if
		elseif match = chr(&H31) then
			if underline then
				underline = vbFalse
				subst = chr(&H1b) & "[4m"
			else
				underline = vbTrue
				subst = chr(&H1b) & "[24m"
			end if
		elseif ( Left(match.SubMatches(0),1) = "," ) and (match.SubMatches(1) <> "") then
			subst = chr(&H1b) & "[39m" & bcode.Item(match.SubMatches(1))
		elseif match.SubMatches(3) = "," then
			subst = code.Item(match.SubMatches(2)) & chr(&H1b) & "[49m"
		elseif match.SubMatches(3) = "" then
			subst = code.Item(match.SubMatches(2))
		else
			subst = code.Item(match.SubMatches(2)) & bcode.Item(match.SubMatches(4))
		end if
		packet = Replace(packet, match, subst,1, 1)
	next
	OnPluginPacketReceived = packet
end function

]]>
</script>


Top

Posted by Shadowfyr   USA  (1,788 posts)  Bio
Date Reply #14 on Sun 13 Mar 2005 04:06 PM (UTC)
Message
Why uglier? Because Nick incorrectly set it to use 'bold' as both a color and font attribute? If so, just turn off the setting for that. Imho, its not the behaviour it should be producing anyway and it *is* ugly.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


60,313 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.