Mudlib: DeadSouls 2.1 on Windows XP
Driver: MudOS v22.2b14
Filename: /ds/lib/verbs/items/look.c
Hi guys, nothing too exciting. Just adding a line to /verbs/items/look.c to automatically display corresponding ascii art if file present. For example "look at jennybot" (/domains/campus/npc/jennybot.c) will automatically search for /domains/campus/npc/jennybot.asc which is basically a text file containing ascii representation of what this bot looks like. If .asc is present, look.c will longcat (
http://lpmuds.net/forum/index.php?topic=210.0) it and then carry on with the rest of usual look output.
Added this line to do_look_at_obj() in /ds/lib/verbs/items/look.c immediately before "return ob->eventShow(this_player());"
if(file_exists(base_name(ob)+".asc")) load_object("/secure/cmds/creators/longcat")->cmd(base_name(ob)+".asc");
So here is what the function looks like afterwards
varargs mixed do_look_at_obj(object ob, mixed arg) {
if(ob->GetInvis() && !archp(this_player()) &&
base_name(ob) != LIB_DUMMY && !inherits(LIB_DUMMY,ob) ){
write("There is no "+arg+" here.");
return 1;
}
if(file_exists(base_name(ob)+".asc")) load_object("/secure/cmds/creators/longcat")->cmd(base_name(ob)+".asc");
return ob->eventShow(this_player());
}
Thanks again to Cratylus for explaining correct syntax for load object and cmd, and coming up with longcat in a few seconds.
Now I wasn't too big a fan of ascii stuff until I stumbled across this impressive gif/jpg/bmp2txt convertor. It actually does a very good job turning pictures into text (
http://ascgendotnet.jmsoftware.co.uk/) plus various smart features such as adjusting contrast and brightness of text output. Color mode available. As it's open source, source code can also be downloaded from its website.

