[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  ansi colors
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

ansi colors

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


Posted by Tsunami   USA  (204 posts)  [Biography] bio
Date Fri 18 Feb 2005 02:59 PM (UTC)

Amended on Fri 18 Feb 2005 04:33 PM (UTC) by Tsunami

Message
I realize that this isn't exactly MC related, but I thought I'd draw on the talent here. Two things I'm confused over w/ANSI.

1. How long do codes take effect? Do they apply only to the packet/line, or to any following text as well?

2. Is it likely to find any codes with more than two numbers, ie \e[#;#;#;#m ? Also, what exactly is the definition of 0, 1, and 2 here? I've many different answers by googling this, but I'm still confused. The standards apparently aren't very standard.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 20 Feb 2005 12:09 AM (UTC)
Message
They certainly apply to more than the packet, I would say they apply until cancelled or changed.

You might have more than 2, eg. bold, underline, foreground colour, background colour.


0 is supposed to be "reset", which I think means "go back to standard colours, cancel bold etc." although I'm not sure of the exact definition. There is an RFC on it I think.

1 is bold although I think it really means use the bold (highlight) colour set rather than a bold font.

2 - I don't have a definition for here.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #2 on Sun 20 Feb 2005 05:20 PM (UTC)
Message
Yes. Bold in the case of Ansi is more accurately 'bright'. There was no such thing is a 'bold' font back when they came up with it, which makes the behaviour of using a bold font when a bold ansi command arrives incorrect. Some like underline and italic where I think added later for some special applications, but usually required a custom display, since there was no single device at the time that supported all of them. Even when PCs came along with graphics cards, they didn't support some of the codes, though they could have if the developers had bothered to add such support directly into the hardware. But bold and italics would have both required changing the number of pixels used to show the characters, which would not have worked in any but a pure graphical context, which text modes didn't use.
[Go to top] top

Posted by Tsunami   USA  (204 posts)  [Biography] bio
Date Reply #3 on Mon 21 Feb 2005 09:37 PM (UTC)
Message
Hmm ok, thanks. So you have to roll through all remembered codes to get the current color eh? Another question if you dont mind :)

Suppose you didn't want a client to display ansi. Is it more traditional to evaluate the colors and remember them but simply not display the text in the appropriate color, or simply forget evaluating while ansi is off, so that if ansi is put back on, text that was received while ansi was off, appears colorless?

Another question, when is it appropriate to use normal connection sockets, and when is it appropriate to use UDP connectionless sockets? Does this depend on the server at all?

Thanks for all the help guys!
[Go to top] top

Posted by Shadowfyr   USA  (1,783 posts)  [Biography] bio
Date Reply #4 on Tue 22 Feb 2005 05:24 PM (UTC)
Message
Yes, text recieved when ansi is not being processed is in the default [0;37m color, which is the normal grey color, like you see in a DOS window, unless someone changes the clients color settings that is.
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #5 on Tue 22 Feb 2005 09:06 PM (UTC)
Message
Quote:
Another question, when is it appropriate to use normal connection sockets, and when is it appropriate to use UDP connectionless sockets? Does this depend on the server at all?
I assume that by 'normal' you mean TCP/IP.

TCP/IP sockets are guaranteed lossless, so everything you send *will* be received and in order of sending unless the connection goes wrong. This is guaranteed by a constant ping-pong between the server and the client; if the server does not receive confirmation then it resends until it's happy. TCP/IP will stop sending packets if it stops getting confirmation.

UDP is more like "just send the darn thing" and hope that it gets there. UDP guarantees nothing except that it throws a packet onto the network with an address tag.

Most 3d or otherwise network-intensive games use UDP because you can't afford to stop sending packets. They come up with clever embedded repair systems to compensate for potential packet loss and custom acknowledgment systems. In general, UDP packet loss isn't that bad, so this tends to work.

On a MUD, the number of packets sent is so small, and you absolutely need to get the packets in order (imagine getting your room description split up almost randomly!), so unless you reimplement TCP/IP in UDP (a somewhat foolish thing to do), you might as well use TCP/IP.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Sat 26 Feb 2005 09:23 PM (UTC)
Message
I agree with Ksilyan on this. You would use UDP for situations where you can afford the odd loss or out-of-sequence situation.

One that springs to mind would be a thermometer connected to an internal network that monitors the temperature (or rainfall etc.). The occasional loss of a reading would not be a big problem.

Also, with UDP you can "broadcast" packets onto the subnet, so in the example of the temperature-measuring, it could broadcast the temperature, and every PC on the subnet could read it, without having a packet per PC.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #7 on Sat 26 Feb 2005 10:05 PM (UTC)
Message
Oh yes, I'd forgotten about broadcasting, which is indeed one of the very important features about UDP.

BTW Nick will be replying to your 'city builders' message ASAP. :)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] 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.


5,741 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]