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 ➜ Editor indentation problem

Editor indentation problem

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


Posted by Karianna   (7 posts)  Bio
Date Wed 16 Apr 2003 06:59 PM (UTC)

Amended on Wed 16 Apr 2003 10:38 PM (UTC) by Nick Gammon

Message
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
Top

Posted by Karianna   (7 posts)  Bio
Date Reply #1 on Wed 16 Apr 2003 07:02 PM (UTC)
Message
Well my example was supposed to show the indents, heh. Anyway you all get the point. Help would be appreciated, thanks.
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #2 on Wed 16 Apr 2003 09:38 PM (UTC)

Amended on Wed 16 Apr 2003 09:39 PM (UTC) by Boborak

Message
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).
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #3 on Wed 16 Apr 2003 10:39 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Boborak   USA  (228 posts)  Bio
Date Reply #4 on Wed 16 Apr 2003 11:29 PM (UTC)
Message
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
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.


13,975 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.