Prompt display

Posted by Kilos on Sat 20 May 2006 04:31 PM — 8 posts, 26,461 views.

#0
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.
USA #1
Do you want to limit it to certain actions? If so, that might be hard (or at least harder).
#2
Hmm, whichever would be easiest I suppose.
USA #3
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.
#4
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.
USA #5
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.
#6
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.
USA #7
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?