Modified show cmd (get back on track)

From: d. hall (dhall@sunspot.tiac.net)
Date: 12/13/95


i figure it's time to get off the compiler discussion, and pop out some
random snippets.

been doing some cosmetics with the base code, trying to solidify and
simplify immortal commands to a degree, or else work with the base line
parser.

i'm working on modifying isname() function in hander.c to do what i call
"dot notation".  you can reference items by multiple keywords using dots as
field separators.

instead of doing a vnum sword, you can do vnum black.sword.  this can apply
to players who find themselves with two shields, one blue and one green.
give person {blue|green}.shield.

and speaking of vnum, i got a little tired of it =).  tonight i hashed up a
hack to attach vnum functionality to show, mostly to consolidate the
functions.  i'll be working a little bit more on show, to add even more
functionality.  the following is a context diff...  i think i'm going to
add in zone referencing to show.  I.E. show object <zone number>, listing
all object in that zone.

d.

--
	this message has been made from 100% recycled electrons.
	not a single byte has been harmed creating this message.
	go electronique!  hug a computer today...

*** act.wizard.c	Thu Dec 14 00:18:29 1995
--- act.wizard.c.~1~	Tue May 23 18:20:46 1995
***************
*** 312,317 ****
--- 312,337 ----
  }
  
  
+ 
+ ACMD(do_vnum)
+ {
+   two_arguments(argument, buf, buf2);
+ 
+   if (!*buf || !*buf2 || (!is_abbrev(buf, "mob") && !is_abbrev(buf, "obj"))) {
+     send_to_char("Usage: vnum { obj | mob } <name>\r\n", ch);
+     return;
+   }
+   if (is_abbrev(buf, "mob"))
+     if (!vnum_mobile(buf2, ch))
+       send_to_char("No mobiles by that name.\r\n", ch);
+ 
+   if (is_abbrev(buf, "obj"))
+     if (!vnum_object(buf2, ch))
+       send_to_char("No objects by that name.\r\n", ch);
+ }
+ 
+ 
+ 
  void do_stat_room(struct char_data * ch)
  {
    struct extra_descr_data *desc;
***************
*** 1820,1837 ****
      char *cmd;
      char level;
    } fields[] = {
!     { "nothing"	, 0  },				/* 0 */
!     { "mobile"	, LVL_GOD },
!     { "object"	, LVL_GOD },
!     { "zones"	, LVL_IMMORT },			/* 1 */
!     { "player"	, LVL_GOD },
!     { "rent"	, LVL_GOD },
!     { "stats"	, LVL_IMMORT },
!     { "errors"	, LVL_IMPL },			/* 5 */
!     { "death"	, LVL_GOD },
!     { "godrooms", LVL_GOD },
!     { "shops"	, LVL_IMMORT },
!     { "\n"	, 0 }
    };
  
    skip_spaces(&argument);
--- 1840,1855 ----
      char *cmd;
      char level;
    } fields[] = {
!     { "nothing",	0  },				/* 0 */
!     { "zones",		LVL_IMMORT },			/* 1 */
!     { "player",		LVL_GOD },
!     { "rent",		LVL_GOD },
!     { "stats",		LVL_IMMORT },
!     { "errors",		LVL_IMPL },			/* 5 */
!     { "death",		LVL_GOD },
!     { "godrooms",	LVL_GOD },
!     { "shops",		LVL_IMMORT },
!     { "\n", 0 }
    };
  
    skip_spaces(&argument);
***************
*** 1845,1857 ****
      send_to_char(buf, ch);
      return;
    }
!   
    strcpy(arg, two_arguments(argument, field, value));
  
    for (l = 0; *(fields[l].cmd) != '\n'; l++)
!     if (is_abbrev (field, fields[l].cmd))
        break;
!   
    if (GET_LEVEL(ch) < fields[l].level) {
      send_to_char("You are not godly enough for that!\r\n", ch);
      return;
--- 1863,1875 ----
      send_to_char(buf, ch);
      return;
    }
! 
    strcpy(arg, two_arguments(argument, field, value));
  
    for (l = 0; *(fields[l].cmd) != '\n'; l++)
!     if (!strncmp(field, fields[l].cmd, strlen(field)))
        break;
! 
    if (GET_LEVEL(ch) < fields[l].level) {
      send_to_char("You are not godly enough for that!\r\n", ch);
      return;
***************
*** 1860,1875 ****
      self = 1;
    buf[0] = '\0';
    switch (l) {
!     
!   case 1:			/* mobile */
!     if (!vnum_mobile(value, ch))
!       send_to_char("No mobiles by that name.\r\n", ch);
!     break;
!   case 2:			/* object */
!     if (!vnum_object(value, ch))
!       send_to_char("No objects by that name.\r\n", ch);
!     break;
!   case 3:			/* zone */
      /* tightened up by JE 4/6/93 */
      if (self)
        print_zone_to_buf(buf, world[ch->in_room].zone);
--- 1878,1884 ----
      self = 1;
    buf[0] = '\0';
    switch (l) {
!   case 1:			/* zone */
      /* tightened up by JE 4/6/93 */
      if (self)
        print_zone_to_buf(buf, world[ch->in_room].zone);
***************
*** 1886,1892 ****
  	print_zone_to_buf(buf, i);
      send_to_char(buf, ch);
      break;
!   case 4:			/* player */
      if (!*value) {
        send_to_char("A name would help.\r\n", ch);
        return;
--- 1895,1901 ----
  	print_zone_to_buf(buf, i);
      send_to_char(buf, ch);
      break;
!   case 2:			/* player */
      if (!*value) {
        send_to_char("A name would help.\r\n", ch);
        return;
***************
*** 1910,1919 ****
  	    (int) (vbuf.played / 60 % 60));
      send_to_char(buf, ch);
      break;
!   case 5:			/* rent */
      Crash_listrent(ch, value);
      break;
!   case 6:			/* stats */
      i = 0;
      j = 0;
      k = 0;
--- 1919,1928 ----
  	    (int) (vbuf.played / 60 % 60));
      send_to_char(buf, ch);
      break;
!   case 3:
      Crash_listrent(ch, value);
      break;
!   case 4:
      i = 0;
      j = 0;
      k = 0;
***************
*** 1943,1949 ****
  	    buf_switches, buf_overflows);
      send_to_char(buf, ch);
      break;
!   case 7:			/* error */
      strcpy(buf, "Errant Rooms\r\n------------\r\n");
      for (i = 0, k = 0; i <= top_of_world; i++)
        for (j = 0; j < NUM_OF_DIRS; j++)
--- 1952,1958 ----
  	    buf_switches, buf_overflows);
      send_to_char(buf, ch);
      break;
!   case 5:
      strcpy(buf, "Errant Rooms\r\n------------\r\n");
      for (i = 0, k = 0; i <= top_of_world; i++)
        for (j = 0; j < NUM_OF_DIRS; j++)
***************
*** 1952,1958 ****
  		  world[i].name);
      send_to_char(buf, ch);
      break;
!   case 8:			/* death */
      strcpy(buf, "Death Traps\r\n-----------\r\n");
      for (i = 0, j = 0; i <= top_of_world; i++)
        if (IS_SET(ROOM_FLAGS(i), ROOM_DEATH))
--- 1961,1967 ----
  		  world[i].name);
      send_to_char(buf, ch);
      break;
!   case 6:
      strcpy(buf, "Death Traps\r\n-----------\r\n");
      for (i = 0, j = 0; i <= top_of_world; i++)
        if (IS_SET(ROOM_FLAGS(i), ROOM_DEATH))
***************
*** 1960,1966 ****
  		world[i].number, world[i].name);
      send_to_char(buf, ch);
      break;
!   case 9:			/* godrooms */
  #define GOD_ROOMS_ZONE 2
      strcpy(buf, "Godrooms\r\n--------------------------\r\n");
      for (i = 0, j = 0; i < top_of_world; i++)
--- 1969,1975 ----
  		world[i].number, world[i].name);
      send_to_char(buf, ch);
      break;
!   case 7:
  #define GOD_ROOMS_ZONE 2
      strcpy(buf, "Godrooms\r\n--------------------------\r\n");
      for (i = 0, j = 0; i < top_of_world; i++)
***************
*** 1969,1975 ****
  		world[i].name);
      send_to_char(buf, ch);
      break;
!   case 10:			/* shops */
      show_shops(ch, value);
      break;
    default:
--- 1978,1984 ----
  		world[i].name);
      send_to_char(buf, ch);
      break;
!   case 8:
      show_shops(ch, value);
      break;
    default:
*** interpreter.c	Thu Dec 14 00:00:19 1995
--- interpreter.c.~1~	Tue May 23 04:40:43 1995
***************
*** 164,169 ****
--- 164,170 ----
  ACMD(do_use);
  ACMD(do_users);
  ACMD(do_visible);
+ ACMD(do_vnum);
  ACMD(do_vstat);
  ACMD(do_wake);
  ACMD(do_wear);
***************
*** 500,505 ****
--- 501,507 ----
    { "value"    , POS_STANDING, do_not_here , 0, 0 },
    { "version"  , POS_DEAD    , do_gen_ps   , 0, SCMD_VERSION },
    { "visible"  , POS_RESTING , do_visible  , 1, 0 },
+   { "vnum"     , POS_DEAD    , do_vnum     , LVL_IMMORT, 0 },
    { "vstat"    , POS_DEAD    , do_vstat    , LVL_IMMORT, 0 },
  
    { "wake"     , POS_SLEEPING, do_wake     , 0, 0 },



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