Ansi color
Moderator: CS Admin
Ansi color
Do you guys know how to make color in lambda moo.
- Anguissette
- Corpie
- Posts: 1149
- Joined: Thu Jul 06, 2006 5:55 pm
- Captain_AHaB
- Street Samurai
- Posts: 149
- Joined: Fri Nov 11, 1994 6:29 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!
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.
- AgentOrrange
- Shadowrunner
- Posts: 380
- Joined: Sat Nov 06, 1999 6:01 pm
- Location: Buffalo, NY
- Captain_AHaB
- Street Samurai
- Posts: 149
- Joined: Fri Nov 11, 1994 6:29 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
then register the function similar to bf_length.
Then you can print any character you want. Including ASCII control character.
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 you can print any character you want. Including ASCII control character.