issues with pager

Posted by Tzaro on Wed 12 Jul 2006 10:32 AM — 7 posts, 22,265 views.

USA #0
Has anyone ever run across something like this:

if PCFLAG_PAGERON returns true, anything that uses "send_to_pager()" is displayed first, followed by everything that uses "send_to_char()".

if PCFLAG_PAGERON returns false, anything that uses "send_to_char()" is displayed first, followed by everything that uses "send_to_pager()".

I'm baffled. The only thing 'unique' about my version of color.c is that I condensed send_to_pager_color and colorize together. below is a copy of what the code looks like in send_to_pager_color()... least the part of interest (I think).

      if( IS_NPC( ch ) || !IS_SET( ch->pcdata->flags, PCFLAG_PAGERON ) )
      {
         send_to_char_color( txt, d->character );
         return;
      }

      while( ( colstr = strpbrk( prevstr, "&{}" ) ) != NULL )
      {
         if( colstr > prevstr )
            write_to_pager( ch->desc, prevstr, ( colstr - prevstr ) );

         ln = colorcode( colstr, colbuf, ch, FALSE );
         if( ln < 0 )
         {
            prevstr = colstr + 1;
            break;
         }
         else if( ln > 0 )
            write_to_pager( ch->desc, colbuf, ln );
         prevstr = colstr + 2;
      }

      if( *prevstr )
         write_to_pager( ch->desc, prevstr, 0 );
   }
   return;
}

Any clues?

-Tz
USA #1
Incase it brings up question... my colorcode function reads:

int colorcode( const char *col, char *code, CHAR_DATA * ch, bool override )

-Tz
USA #2
Just to make sure I understand the problem: are you saying that the text is arriving out of order, of sorts, with each chunk (sent to pager or directly to char) arriving separately?
USA #3
This is what's displayed when I exam a guard with pager "on".

<used as light>     a torch
<worn on finger>    (Magical) (Glowing) a ring of the city guard
<worn on body>      a crested breastplate
<worn on head>      an iron helm
<worn on legs>      mail leggings
<worn on feet>      black boots
<worn on hands>     iron gauntlets
<worn on arms>      chain sleeves
<wielded>           a longsword
You see nothing special about him.
The guard is in perfect health.
the guard is using:

Mobile #21037 'guard man' is a level 16 human warrior.

You peek at his inventory:
     Nothing.

-----------------------------------------------------------

This is pager "off":

You see nothing special about him.
The guard is in perfect health.

the guard is using:
<used as light>     a torch
<worn on finger>    (Magical) (Glowing) a ring of the city guard
<worn on body>      a crested breastplate
<worn on head>      an iron helm
<worn on legs>      mail leggings
<worn on feet>      black boots
<worn on hands>     iron gauntlets
<worn on arms>      chain sleeves
<wielded>           a longsword

Mobile #21037 'guard man' is a level 16 human warrior.

You peek at his inventory:
     Nothing.

Sorry I didn't explain this better the first time though :X

Tz
Amended on Thu 13 Jul 2006 01:52 PM by Tzaro
USA #4
Hmm... I can't see offhand why that would be happening from the code you're showing. Can you maybe show what you changed, like a before/after of the comm functions?

What seems to be happening is that the MUD outputs the pager's contents before the other buffer (the normal, main one). Normally, when the pager is on, everything sent to the normal buffer (using send_to_char) is supposed to be redirected to the pager's buffer. You could check your send_to_char_color function and make sure that's what's happening.
USA #5
yep, I found the problem. The issue wasn't with anything changed in color.c at all. The issue was someone had changed nearly all of our calls from send_to_char to send_to_pager. Apparently, there had been an issue with send_to_char that was causing jarbled data to be returned to the character when mass-amounts of data would be sent.

The problem with send_to_char was with flush_buffer. It was putting a 'pause' in the data sent to the char for every 512 bytes of data sent.... but the player could choose to have more than that sent to them. I changed it to reflect how much data the player wanted to have sent and changed all the send_to_pager calls back to send_to_char and everything was resolved.

Ksilyan, if you ever happen to see me strolling by, feel free to thwap me for wasting your time. I'll be sure to check the function calls first instead of just assuming they are how they're supposed to be from now on.
USA #6
Hey, no problem. :) This is the kind of annoyance you see in SMAUG a lot. Things, that really shouldn't, can have far-reaching consequences and seriously muck things up in ways that are hard to foresee. When I replaced the SMAUG network code with my own I had a fair number of headaches, a lot relating to the pager. But, it's good that you fixed it!