Editor indentation problem

Posted by Karianna on Wed 16 Apr 2003 06:59 PM — 5 posts, 18,445 views.

#0
I notice that the online editor has an indentation problem with the first line.


I typed redit desc
I then typed three spaces to indent, so it would look like this:
   The room blah blah blah blah blah blah blah
blah blah blah blah blah blah.

I then typed /s.
I then typed savearea.


When I typed look, the formatting was there, but after reboot the three spaces are taken out of the first line, so it starts flush left.

Does anyone know how to fix this problem so I can format more freely on the first line?

Thanks,
Kari
Amended on Wed 16 Apr 2003 10:38 PM by Nick Gammon
#1
Well my example was supposed to show the indents, heh. Anyway you all get the point. Help would be appreciated, thanks.
USA #2
The reason that happens is due to the way that SMAUG reads strings from a file. It allows for a variable amount of 'space' at the begining of a string. So, when a string is read from a file..

DESCR      Blah Blah Blah~

is the same as

DESCR              Blah Blah Blah~

The only real 'fix' for this, is to have your coder add a check for a . (or other non-alphanumeric char) at the begining of your room descriptions and parse them out on display. Then add a . to the begining of any description you want to start with spaces. So now we get..

DESCR      .           Blah Blah Blah~

The mud will read from the period on. Then, when the text is displayed the period is dropped (or hidden if you prefer to look at it that way).
Amended on Wed 16 Apr 2003 09:39 PM by Boborak
Australia Forum Administrator #3
Quote:

Well my example was supposed to show the indents, heh.


You need to use the [code] blah blah [/code] "forum codes" in your post, and check "forum codes" check box. I have edited your post to do that.
USA #4
I'll make it easy for you ;-)

Replace (located in do_look() in act_info.c):

if ( arg1[0] == '\0'  || ( !IS_NPC(ch) && !IS_SET(ch->act, PLR_BRIEF)) )
            send_to_char( ch->in_room->description, ch );

With:

if ( arg1[0] == '\0'  || ( !IS_NPC(ch) && !IS_SET(ch->act, PLR_BRIEF)) )
{            
    if ( ch->in_room->description[0] == '.' )
                send_to_char( ch->in_room->description+1, ch );
        else
                send_to_char( ch->in_room->description, ch );
}


Of course.. this is considering you A) have the source and B) know how to recompile ;-)

Disclaimer: I never actually tested that.. I just kinda figure it'll work ;-P