Ansi color

Questions about programming that don't necessarily relate to cybersphere can go here. We don't guarantee that anyone will respond or if they do that they will know what they're talking about.

Moderator: CS Admin

Post Reply
User avatar
Vitaly
Corpie
Posts: 985
Joined: Thu Nov 02, 2006 10:03 am

Ansi color

Post by Vitaly » Mon Jul 30, 2007 12:54 pm

Do you guys know how to make color in lambda moo.

User avatar
dicanomi
Corpie
Posts: 1156
Joined: Tue Nov 28, 2006 2:52 am

Post by dicanomi » Mon Jul 30, 2007 1:53 pm

@ansi on maybe?
I dont know lambda moo and it could also be your client not the moo...
Scarling wrote:I want new stuff but not your new stuff and no I won't give any ideas for new stuff.

Jesper

Post by Jesper » Mon Jul 30, 2007 2:17 pm

Cybersphere can and will output in ansi if you type @ansi on. After that it's a matter of your client.

zMUD and Mushclient are two popular clients that will output in ansi.

User avatar
Vitaly
Corpie
Posts: 985
Joined: Thu Nov 02, 2006 10:03 am

Post by Vitaly » Mon Jul 30, 2007 2:37 pm

I was thinking more along the lines of experimenting with MinimalDB core and adding color to it.

Clockwork
Street Samurai
Posts: 116
Joined: Sun Jun 04, 2006 4:27 pm

Post by Clockwork » Sun Aug 12, 2007 7:02 am

You can install ansi utils on your MOO.

Once you dot hat you'll have to edit the DB and insert an escape char.
Alternatively, you can edit your db, insert the escape char and code your own ansi tools.

User avatar
Vitaly
Corpie
Posts: 985
Joined: Thu Nov 02, 2006 10:03 am

Post by Vitaly » Mon Aug 13, 2007 9:36 am

Thanks Clockwork, I will give it a shot.

User avatar
rage
Shadowrunner
Posts: 492
Joined: Sat Jul 08, 2006 6:20 pm

Post by rage » Mon Dec 03, 2007 4:31 pm

the minimal.db core is hardcore! also, adding ANSI color sucks, i haven't done it in about 10 years but i remember it sucking. if anyone can point out the specifics of how to add ANSI, that'd be swell, since i need to do it again at some point.

User avatar
Anguissette
Corpie
Posts: 1149
Joined: Thu Jul 06, 2006 5:55 pm

Post by Anguissette » Mon Dec 03, 2007 6:50 pm

LambdaMOO doesn't have any color by default so he isn't necessarily talking about a minimal DB.

User avatar
Captain_AHaB
Street Samurai
Posts: 149
Joined: Fri Nov 11, 1994 6:29 pm

Post by Captain_AHaB » Sat Dec 15, 2007 1:09 pm

As Clockwork mentioned, it's fairly simple. The hardest part, which isn't hard, is adding the escape character. This can be done by making a prop on some object and make it's value something that you won't find on the core, like "monkeyturds", then simply write a quick perl script to search and replace "monkeyturds" with the escape character.

After that, you can either copy an ansi_utils or write your own. Writing your own will allow you to implement any sort of escape character option you want. I'm a fan of the background colors and BEEP myself!
Last edited by Captain_AHaB on Sat Dec 15, 2007 7:02 pm, edited 1 time in total.

User avatar
AgentOrrange
Shadowrunner
Posts: 380
Joined: Sat Nov 06, 1999 6:01 pm
Location: Buffalo, NY

Post by AgentOrrange » Sat Dec 15, 2007 6:11 pm

Who wants to play on a game where you won't find monkeyturds anywhere.

User avatar
Captain_AHaB
Street Samurai
Posts: 149
Joined: Fri Nov 11, 1994 6:29 pm

Post by Captain_AHaB » Sat Dec 15, 2007 7:00 pm

AgentOrrange wrote:Who wants to play on a game where you won't find monkeyturds anywhere.
A very valid point, sir.

User avatar
Vitaly
Corpie
Posts: 985
Joined: Thu Nov 02, 2006 10:03 am

Post by Vitaly » Thu Jun 05, 2008 2:07 pm

There is another alternative to making ascii color, is by modifying and compiling lambdamoo kernel itself.

You can add another internal function to return an a character based on ascii code.

i.e. in list.c you can add the following

Code: Select all

static package
bf_char(Var arglist, Byte next, void *vdata, Objid progr)
{
    static char ascii_char[] = "?";
    Var r;
    if(arglist.v.list[1].type != TYPE_INT) return make_error_pack(E_TYPE);
    ascii_char[0] = (char)arglist.v.list[1].v.num;

    r.type  = TYPE_STR;
    r.v.str = ascii_char;

    free_var(arglist);
    return make_var_pack(r);
}
then register the function similar to bf_length.

Then you can print any character you want. Including ASCII control character.

Post Reply