Object Display

Posted by Jach on Fri 29 Aug 2003 08:59 AM — 7 posts, 25,322 views.

USA #0
Perhaps I should stop trying to do this when I'm tired.

I want to indent the display of objects in a room. I assume this would be under do_look but have yet to be able to figure out what to change/add. To further clarify I want the room descrip to be left justified, the objects in the room to be indented(should there be any), and the characters/mobs sent back to left justified.

I have this deep down gut feeling I've been looking over the line I need to edit. As always, any help will be greatly appreciated.
USA #1
Look for this section of code in the function show_list_to_char() in act_info.c:


    /*
     * Output the formatted list.               -Color support by Thoric
     */


Below that comment is the section of code that controls displaying objects. Be warned though, this code controls the displaying of objects when on the ground and when in a players inventory.

As for the 'left justified' stuff, there's no easy way to ensure that everything is left justified. It ultimately on how the area is made and how the builder wrote the descriptions. Hope this helps.
USA #2
I looked over that section of code and don't seem to be able to find what to change to get the results I want.

Items in Inventory are already indented, that isn't a problem. What I want is for objects placed in a room, such as a fountain, and objects dropped by players, to be indented.

Am I just missing something there?
USA #3
Bumping this up. I still can't get it to display the way I want it.
USA #4
The code you are looking for IS in that function. But that particular function isn't the easiest thing to edit I admit. We may be able to help you out with what you need to modify exactly if you could post an example of how your mud looks now and what you want it to look like.
Canada #5
Well, one option is to find format_obj_to_char, where it actually attaches the prefixes and and then the objects descriptions, and change it like this:


    buf[0] = '\0';
    if ( IS_OBJ_STAT(obj, ITEM_INVIS)     )   strcat( buf, "(Invis) "     );


to this:


    buf[0] = '\0';
    strcat( buf, "\t"     );
    if ( IS_OBJ_STAT(obj, ITEM_INVIS)     )   strcat( buf, "(Invis) "     );
    


This will indent all objects by 8 spaces. Of course, if you wanted it to only affect it when you were looking into a room, and not inventory or in a bag, you could add a bool into the function to check whether it is meant to indent or not, something like, :

char *format_obj_to_char( OBJ_DATA *obj, CHAR_DATA *ch, bool fShort, bool indent )
{
    static char buf[MAX_STRING_LENGTH];

    buf[0] = '\0';
    if ( indent )
	strcat( buf, "\t"     );
    if ( IS_OBJ_STAT(obj, ITEM_INVIS)     )   strcat( buf, "(Invis) "     );


This wouldn't be too hard since its only called from act_info.c and player.c, and only 4 times total. Hope that helps.
USA #6
Thank you...works like a charm!

I knew it was something "simple," I was just in the wrong place.