Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Object Display

Object Display

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Jach   USA  (25 posts)  Bio
Date Fri 29 Aug 2003 08:59 AM (UTC)
Message
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.

"Adults are obsolete children."

Dr. Seuss
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #1 on Fri 29 Aug 2003 03:16 PM (UTC)
Message
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.
Top

Posted by Jach   USA  (25 posts)  Bio
Date Reply #2 on Fri 29 Aug 2003 09:01 PM (UTC)
Message
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?

"Adults are obsolete children."

Dr. Seuss
Top

Posted by Jach   USA  (25 posts)  Bio
Date Reply #3 on Mon 01 Sep 2003 04:08 AM (UTC)
Message
Bumping this up. I still can't get it to display the way I want it.

"Adults are obsolete children."

Dr. Seuss
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #4 on Mon 01 Sep 2003 09:33 AM (UTC)
Message
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.
Top

Posted by Greven   Canada  (835 posts)  Bio
Date Reply #5 on Mon 01 Sep 2003 04:42 PM (UTC)
Message
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.

Nobody ever expects the spanish inquisition!

darkwarriors.net:4848
http://darkwarriors.net
Top

Posted by Jach   USA  (25 posts)  Bio
Date Reply #6 on Tue 02 Sep 2003 05:47 AM (UTC)
Message
Thank you...works like a charm!

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

"Adults are obsolete children."

Dr. Seuss
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


19,180 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.