Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
parse description bug
Dec 15, 2017, 10:08 pm
By Remcon
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!

Members: 0
Guests: 20
Stats
Files
Topics
Posts
Members
Newest Member
477
3,706
19,240
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » [Enh] Mwhere doesn't accept a...
Forum Rules | Mark all | Recent Posts

[Enh] Mwhere doesn't accept a vnum as an argument
< Newer Topic :: Older Topic > But it can!

Pages:<< prev 1 next >>
Post is unread #1 Dec 31, 2006, 6:17 pm
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

To allow mwhere to accept a vnum as an argument in addition to being able to accept a partial mob name, just do the following:

In act_wiz.c, do_mwhere, find:
   char arg[MAX_INPUT_LENGTH];
   CHAR_DATA *victim;
   bool found;
and immediately below that add
   int vnum = 0;
then find
   found = FALSE;
and immediately above that add
   if( is_number( arg ) )
      vnum = atoi( arg );

then replce the for loop with
   for( victim = first_char; victim; victim = victim->next )
   {
      if( vnum )
      {
         if( IS_NPC( victim ) && vnum != victim->pIndexData->vnum )
            continue;
      }
      else if( !nifty_is_name( arg, victim->name ) )
         continue;
         
      if( IS_NPC( victim ) && victim->in_room && ( nifty_is_name( arg, victim->name ) || vnum == victim->pIndexData->vnum ) )
      {
         found = TRUE;
         pager_printf( ch, "[%5d] %-28s [%5d] %s\r\n",
                       victim->pIndexData->vnum, victim->short_descr, victim->in_room->vnum, victim->in_room->name );
      }
   }
and you're all set.

Oh, I'll make this easy, since it's a pretty small function anyway, when you're done it should look like:
void do_mwhere( CHAR_DATA * ch, char *argument )
{
   char arg[MAX_INPUT_LENGTH];
   CHAR_DATA *victim;
   bool found;
   int vnum = 0;

   set_pager_color( AT_PLAIN, ch );

   one_argument( argument, arg );
   if( arg[0] == '\0' )
   {
      send_to_char( "Mwhere whom?\r\n", ch );
      return;
   }

   if( is_number( arg ) )
      vnum = atoi( arg );

   found = FALSE;
   for( victim = first_char; victim; victim = victim->next )
   {
      if( vnum )
      {
         if( IS_NPC( victim ) && vnum != victim->pIndexData->vnum )
            continue;
      }
      else if( !nifty_is_name( arg, victim->name ) )
         continue;
         
      if( IS_NPC( victim ) && victim->in_room && ( nifty_is_name( arg, victim->name ) || vnum == victim->pIndexData->vnum ) )
      {
         found = TRUE;
         pager_printf( ch, "[%5d] %-28s [%5d] %s\r\n",
                       victim->pIndexData->vnum, victim->short_descr, victim->in_room->vnum, victim->in_room->name );
      }
   }

   if( !found )
      act( AT_PLAIN, "You didn't find any $T.", ch, NULL, arg, TO_CHAR );
   return;
}
       
Pages:<< prev 1 next >>