Coder Social home page Coder Social logo

Comments (3)

ZeroKnight avatar ZeroKnight commented on August 23, 2024

I could be unclear on exactly what the request is, but IRC->Cube color codes already work, albeit not entirely as they should. This line shows that all it does is find any EOT escapes (\x03 / ^C) that IRC clients use as the start of a "color code" and converts it to a FF (\f), which is the Cube Engine equivalent.

However, the colors that each number in the color escape sequence represents may not match the ones that Cube uses depending on the IRC client. This is because the IRC protocol does not in itself support color codes and is a feature implemented by the IRC client, thus the color mappings may vary, or not exist at all. Most clients that I know of conform to mIRC color codes.

There are two problems with the current implementation:

  • Cube color codes will not match up with most (if not all) IRC clients
  • 2-digit IRC color codes will not work

Regarding the first point, examine the table below. What appears as say, Green in a message sent in IRC would appear as Red in-game, because the color code 3 is Green in IRC, but Red in Cube.

Code mIRC Cube
0 White Green
1 Black Blue
2 Blue Yellow
3 Green Red
4 Red Grey
5 Brown Magenta
6 Purple Orange
7 Orange White
8 Yellow Black
9 Light Green Cyan

Regarding the second problem, Cube only uses a single character to determine the color in the color escape sequence (not counting the use of brackets), where IRC color codes can use 2 digits. Consider the following message, sent by a user in IRC:

^C13this message is in pink!

In IRC, it would display: this message is in pink!, in pink/magenta as intended. However, in game chat you would see: 3this message is in pink! in Blue. Notice the 3 at the beginning?

irc-color-demo1

This is because only the 1 in 13 is a part of the Cube color escape sequence; the 3 is left as a part of the regular text and it is rendered Blue.

This could be fixed by applying the reverse of what converttext() does to deal with color escapes to ircrecv(). I can work out a patch to do just this. 😃

from base.

ZeroKnight avatar ZeroKnight commented on August 23, 2024

Well, I've got working code at the moment, just need to make sure it melds well with the rest of the code and I'm not missing any bugs

from base.

qreeves avatar qreeves commented on August 23, 2024

Fixed by #47

from base.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.