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 ➜ Prompt display

Prompt display

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


Posted by Kilos   (9 posts)  Bio
Date Sat 20 May 2006 04:31 PM (UTC)
Message
How would one go about getting the prompt to not display so often where it isn't needed? I'm refering to places like getting sent tells and actions taking place in a room. Let's say I'm in the room with Player A and B. Right now, I would see this:

Player A says 'Yo'

<Hp Mp Mv>

Player A says 'Hello???'

<Hp Mp Mv>

Player B leaves east.

<Hp Mp Mv>
You say 'he'll be right back'

<Hp Mp Mv>



What I'd like to do for ease of reading for my the players is:

Player A says 'What?'
Player A says 'Hello???'
Player B leaves east.
You say 'he'll be right back'

<Hp Mp Mv>

Any ideas how I can make it do that? Thanks for any help.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #1 on Sat 20 May 2006 05:56 PM (UTC)
Message
Do you want to limit it to certain actions? If so, that might be hard (or at least harder).

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Kilos   (9 posts)  Bio
Date Reply #2 on Sat 20 May 2006 06:48 PM (UTC)
Message
Hmm, whichever would be easiest I suppose.
Top

Posted by Zeno   USA  (2,871 posts)  Bio
Date Reply #3 on Sat 20 May 2006 07:15 PM (UTC)
Message
Well to display the prompt only when nothing is being displayed to the user, it shouldn't be too hard. You'd just have to check the descriptor's buffer (outbuf?) to make sure it's blank and nothing is being printed to the desc. So probably where it calls the function to print the prompt, you'd put an ifcheck there. You may have to code in a new variable for a desc though, I'm not sure. This is just theory though.

I think the DBSaga codebase has something like this. Maybe you could look at that.

Zeno McDohl,
Owner of Bleached InuYasha Galaxy
http://www.biyg.org
Top

Posted by Kilos   (9 posts)  Bio
Date Reply #4 on Tue 23 May 2006 04:58 PM (UTC)
Message
Thanks for the suggestion. I went ahead and got a copy and tested it out. Unfortunately, they seem to have the same problem with the prompt being overly displayed. Any other ideas, and has anyone else tried this before with smaug? Thanks for your help.
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #5 on Tue 23 May 2006 08:15 PM (UTC)
Message
well it really depends on what you want to do and how often you want to display it. for instance lets say you only want it displayed when they input something, you would remove the display_prompt(d) from the flush_buffer() function in which it currently resides. and would modify the game_loop() function like so:


game_loop() .....
                if ( d->incomm[0] != '\0' )
                {
                        d->fcommand     = TRUE;
                        stop_idling( d->character );

                        strcpy( cmdline, d->incomm );
                        d->incomm[0] = '\0';

                        if ( d->character )
                          set_cur_char( d->character );

                        if ( d->pagepoint )
                          set_pager_input(d, cmdline);
                        else
                          switch( d->connected )
                          {
                           default:
                                nanny( d, cmdline );
                                break;
                           case CON_PLAYING:
                                // move your prompt stuff here, mine might be different than yours
                                interpret( d->character, cmdline );
                                break;
                           case CON_EDITING:
                                edit_buffer( d->character, cmdline );
                                break;
                           case CON_BLACKJACK:
                                do_blackjack( d->character, cmdline );
                                break;
                          }
                }


but then you would also change the original flush_buffer() function so instead of showing a prompt you show a '>' or whatever you want:


flush_buffer() .....
    /*
     * Bust a prompt.
     */
    if ( fPrompt && !mud_down && d->connected == CON_PLAYING )
    {
        CHAR_DATA *ch;

        ch = d->original ? d->original : d->character;
        if ( xIS_SET(ch->act, PLR_BLANK) )
            write_to_buffer( d, "\n\r", 2 );


        if ( xIS_SET(ch->act, PLR_PROMPT) )
            write_to_buffer( d, "> ", 2 );
        if ( xIS_SET(ch->act, PLR_TELNET_GA) )
            write_to_buffer( d, go_ahead_str, 0 );
    }


not exactly sure if this would get the same result that you are looking for, or if it would even look good, but thats your call.
Top

Posted by Kilos   (9 posts)  Bio
Date Reply #6 on Wed 24 May 2006 07:43 PM (UTC)
Message
I gave that a try and here's the result I got. I'll give an example:

Some Room
You are somewhere with lamps lighting the place with a warm pleasant glow of ambience.
Exits: east west.

>

Player arrives from the west

>

You say 'hi'

>

Player says 'sup'

>


So basically it would show > for a prompt. Sending input would show the >, and then when someone in the same room acted or spoke it would also send >.

Although it didn't quite work out I feel you are on to something.
Top

Posted by Gohan_TheDragonball   USA  (183 posts)  Bio
Date Reply #7 on Thu 25 May 2006 06:02 AM (UTC)
Message
ok so heres what i got, forget messing with the game loop and flush buffer, i changed the modification to be soley in the prompt code:

void display_prompt(), near the end of the function find:

  *pbuf = '\0';
  stc( buf, ch );
  return;
}


change to:


  *pbuf = '\0';
  if ( d->fcommand )
      stc( buf, ch );
  return;
}


only problem i can see is for some reason you get a trailing line, i guess the prompt doesn't have a \n\r at the end, so it always remains at the bottom, however if you don't fill that portion of the screen up it looks like it becomes a blank line when the next portion is sent. any ideas people?
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.


24,950 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.