Re: [CODE] Max Window Size

From: Gary Barnett (gbarnett@POLARNET.COM)
Date: 04/14/98


-----Original Message-----
From: Ben Britton <ben@SW2.K12.WY.US>
To: CIRCLE@post.queensu.ca <CIRCLE@post.queensu.ca>
Date: Monday, April 13, 1998 9:50 PM
Subject:  [CODE] Max Window Size


>Greetings, Ive looked into this project for awhile, but I guess the books I
>have don't cover this:
>
>Where does Circlemud define the writable window size?  I've looked all
>through comm.c and telnet.h just defines the max size at 31 lines.  But how
>would i define  the writable size to like 28, so i can add a bar to the
>bottom of the screen that displays your hit, mana, etc without cluttering
>the screen everytime your screen moves.
>
The quick answer is that cirlce doesn't. The only area of the mud with the
concept of a page is page_string, IIRC.

Probably be best to ask the user how many lines they have.

I wrote a little routine that will determine the number of lines by spamming
the player and asking for them to read off the top number on their monitor
.. it follows.

Once you have the height stored in a handy variable then you can update
page_string to use it and your cursor positioning code to put the prompt in
the right spot.

For developing your cursor positioning code, get your hands upon a bunch of
different mud clients so you can enjoy the fun and misery of finding a set
of options that works for everyone. I'd recommend skipping the following
functions:

1) remembering cursor position / restoring cursor position
2) clear to end of screen
3) clear to end of line
4) function key support

I've found that goto position and up/down/left/right seem to work fairly
well. Watch writing on the 80th column, especially on the last line of the
display, even if it's suppposed to be protected by the non-scrolling area.

zMUD has the peculiar problem of blanking out the entire screen and
appearing to freeze if you try to paint outside the window or do anything
else outside it's strict expectations, when using a non-scrolling area.
Turning off the non-scroll area and clearing the screen will wake it up
again.

For the windows environment, QVT Term seems to do the emulation correctly,
at least in my testing with the relevant RFC's in hand.

--Mallory

ACMD(do_screenlen) {
   /* determine users's screen length by putting them in a
      con state, clearing the screen and printing 100
   numbered lines 1-100, then asking them what number is at
   the top of their display.
  */

 int x;

 if (IS_NPC(ch) || IS_MOB(ch) ) {
  send_to_char("Mobs don't have a screen length.\r\n",ch);
  return;
 }

 strcpy(buf, "\033[2J 1\r\n");

 for (x=2;x<100;x++) {
  sprintf(buf2, " %d\r\n", x);
  strcat(buf, buf2);
 }
 strcat(buf, "Enter the number that appears on the top line of your
monitor. ->");
 send_to_char(buf, ch);
 STATE(ch->desc) = CON_SCREEN_LENGTH;
 SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
}


and in nanny:


  case CON_SCREEN_LENGTH:
   /* take input and set length if valid */
   x=0;
   if (*arg && is_number(arg)) {
         x=atoi(arg);
   if ( (x>0) && (x < 92) ) {
   (d->character)->player_specials->screen_len = 100 - x;
      sprintf(buf, "Your screen length is now: %d.\r\n"
             "\r\n"
       "Note that you will need to re-run the screenlen command if you
change\r\n"
       "the size of your mud client's window, or change the font or other
settings\r\n"
       "that affect the height of the lines your client displays.\r\n",
                      (d->character)->player_specials->screen_len);
   STATE(d) = CON_PLAYING;
    REMOVE_BIT(PLR_FLAGS(d->character), PLR_WRITING);
   SEND_TO_Q(buf, d);
         return;
   }
      }
      SEND_TO_Q("Screen length not changed.\r\n", d);
   STATE(d) = CON_PLAYING;
   REMOVE_BIT(PLR_FLAGS(d->character), PLR_WRITING);
   return;


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST