Re: [Circle] Revised Player listing command

ruin@wired.uvm.edu
Date: 08/09/96


> > (The following code is a modified version of the PLAYER listing
> > command that I posted earlier.  This version is corrected, and will
> > now prompt for hitting ENTER every pageful of info)
> >   *buf = 0;
> >   for (i = 0; i <= top_of_p_table; i++) {
> >     sprintf(buf, "%s  %-20.20s", buf, (player_table + i)->name);
> >     count++;
> >     if (count == 3) {
> >       count = 0;
> >       sprintf(buf, "\r\n");
> >     }
> >   }
> >   page_string(ch->desc, buf, 1);
> > }

> if (strlen(buf) + 25 > sizeof(buf))
>   abort abort abort...

better yet...change that "abort abort abort..." to:

  page_string(ch->desc , buf, 1);
  *buf = 0;

That way your mud won't crash AND you still get your player listing.
Thanks for the idea Rasmus!

Justin Robinson
jmrobins@vermontel.com
VTel --- http://www.vermontel.com/
------
Primacy
ruin@wired.uvm.edu
Ruin! Mud --- wired.uvm.edu:4000
http://wired.uvm.edu/~jmrobins/

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


From goamkows@kirk.geog.sc.edu Fri, 9 Aug 96 9:06:53 EDT
X-SystemInfo: MyE-Mail: EMail
X-Message-No: 3617 (database)
From: goamkows <goamkows@kirk.geog.sc.edu>
To: circle <circle@cspo.queensu.ca>
Subject: [Circle] [newbie] case problem
Date: Fri, 9 Aug 96 14:06:01
Message-ID: <CMM.0.90.0.839596013.goamkows@janeway.geog.sc.edu>
Reply-To: goamkows@kirk.geog.sc.edu (goamkows)
X-POP3-Rcpt: lk4150@per
Return-Path: <@QUCDN.QueensU.CA:owner-circle@cspo.queensu.ca>
Received: from QUCDN.QueensU.CA (QUCDN.QueensU.CA [130.15.126.2]) by per.cybercity.dk (8.6.12/8.6.12) with SMTP id PAA23878 for <lk4150@krull.dk>; Fri, 9 Aug 1996 15:08:09 +0200
Received: from cspo.queensu.ca by QUCDN.QueensU.CA (IBM VM SMTP V2R2) with TCP;Fri, 09 Aug 96 09:15:20 EDT
Received: by cspo.queensu.ca (SMI-8.6/SMI-SVR4)id JAA00385; Fri, 9 Aug 1996 09:01:56 -0500
Received: from otis.cla.sc.edu by cspo.queensu.ca (SMI-8.6/SMI-SVR4)
Received: from kirk.geog.sc.edu by otis.cla.sc.edu (4.1/SMI-4.1)
Received: from janeway.geog.sc.edu by kirk.geog.sc.edu (4.1/SMI-4.1)
Sender: owner-circle@cspo.queensu.ca
Precedence: bulk

ok, i've got a problem with my do_breath skill.  the desired usage
would be 'breath fire'.
basically, it never gets to the case it is supposed to (see below),
and goes to the default (which i do not include here, but is the last
case in my cast structure)   basically, i just copied the wiz command
do_set :) 


    int l, dam = 0;
    char field[MAX_INPUT_LENGTH];
    
    struct breath_type {
	char *breathtype;
	int parsed_type;
    } fields[] = {
	{ "undefined",   0 }, /* 0 */
	{ "fire",        1 }, /* 1 */
	{ "flame",       1 }, 
	{ "cold",        2 },
	{ "frost" ,      2 },
	{ "\n", 0 }	
    };    

    for (l = 0; *(fields[l].breathtype) != '\n'; l++)
      if (!strncmp(field, fields[l].breathtype, strlen(field)))
	break;

    switch (l) {
    case 1:  /* fire */
    case 2:
	if ((GET_RACE(ch) == RACE_HALF_DRAGON_GOLD) ||
	    (GET_RACE(ch) == RACE_DRAGON_RED) || 
	    (GET_RACE(ch) == RACE_DRAGON_GOLD)) {
	    send_to_char("You unleash a cone of flame!\r\n, ch);
	} else {
	    send_to_char("You can't breath that!\r\n", ch);
	    return;
	}
	if (GET_RACE(ch) == RACE_HALF_DRAGON_GOLD)
	  dam = dice(3, 6);
	if (GET_RACE(ch) == RACE_DRAGON_GOLD)
	  dam = ((dice((GET_LEVEL(ch)), 12)) + GET_LEVEL(ch));
	if (GET_RACE(ch) == RACE_DRAGON_RED)
	  dam = ((dice((GET_LEVEL(ch)), 10)) + GET_LEVEL(ch));
	break;
    case 3: /* frost */
    case 4:
	etc.	

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



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