Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yandex, Bing

Members: 0
Guests: 2
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » xterm color
Forum Rules | Mark all | Recent Posts

xterm color
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 May 29, 2012, 12:00 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

I was wondering if anyone has been able to put this system into a smaug codebase. and how to go about it I was looking at Kavirs protocol snippet, but its not what I want. I want to be able allow players/builders to use the colors and for clients who don't support the system to automatically switch to the best ansci color. Any push in the right direction would be extremely helpful. I know Gatz of narutomud has done it so its not impossible.
       
Post is unread #2 May 30, 2012, 8:47 am
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

I started adding this, but got distracted and would have to start again. :)

If you want a place to start, this is a perl script I wrote to generate the fast lookup tables for several terminal type options. It was mostly written to generate LPC code, but it also emits a C section which would be suitable for use in a Dikurivative.

SmaugFUSS uses some old color code of mine that has the concept of symbolic colors like &[blah], and it would be fairly easy to map pinkfish names into that space, which is what I was doing when I got distracted. I rather dislike C/C++ these days though, so it may take a while for me to get back to looking at it.
       
Post is unread #3 May 30, 2012, 2:47 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

yeah that confused me.
       
Post is unread #4 May 31, 2012, 8:33 am
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

Which?

The perl script? The C code the perl script produces? The Smaug symbolic color code? My post? Or all of the above? :)
       
Post is unread #5 May 31, 2012, 2:46 pm
Go to the top of the page
Go to the bottom of the page

dbna2
Sorcerer
GroupMembers
Posts600
JoinedDec 2, 2008

all the above lol.
       
Post is unread #6 Jun 7, 2012, 7:35 pm
Go to the top of the page
Go to the bottom of the page

Quixadhal
Conjurer
GroupMembers
Posts398
JoinedMar 8, 2005

Well, I probably can't help much with the first two. If you don't know perl, you'll likely not enjoy trying to read the script. If you try to really read the C code it spits out, you'll find it mostly large chunks of data since the point was to generate something that worked FAST, knowing that RAM is cheap these days.

As for the symbolic color code... that really is pretty simple.

If you look in the SmaugFUSS distro, you'll see my name in some comments down somewhere in color.c, and somewhere in the code that parses the color tokens, you'll see that it treats codes like ^[ or &[ as special things. Namely, it reads whatever comes after the [ up until it sees a matching ], and looks THAT up in a table to see what actual color you wanted.

So, while &r might be red, you can also get the same ANSI sequence output with &[red], and if you define your lookup table right, you could do &[damage] and have that also end up as red.

Why? Because it lets you avoid hard-coding stuff in the rest of your code. If you use &[damage] for things that cause the player damage, the player themselves can have the option to specify what color those messages actually show up as... perhaps they're color-blind, or perhaps they simply don't like red, or maybe they play on a white background and want it to be bold+red or something.

So, using that same system, you could implement a bit more hackery and allow xterm256 color names to emit xterm256 specific sequences (or downcode to ANSI if not supported).
       
Pages:<< prev 1 next >>