void do_rseek( CHAR_DATA *ch, char *argument)
{
RESET_DATA *pReset;
AREA_DATA *pArea;
int x, counter=1;
if (!is_number(argument))
{
ch_printf( ch, "%s is not a number, and only vnums can be searched for in resets.\n\r", argument );
return;
}
x = atoi (argument);
for ( pArea = first_area; pArea; pArea = pArea->next )
{
for ( pReset = pArea->first_reset; pReset; pReset = pReset->next )
{
if (pReset->arg1 == x || pReset->arg2 == x || pReset->arg3 == x)
{
pager_printf( ch, "[%-6d] %-20s Reset Number: %d\n\r", x, pArea->filename, counter);
list_resets(ch, pArea, NULL, counter, counter);
}
counter++;
}
counter = 1;
}
return;
}
If you want a much more complex version of rseek, with more features and control and detail, here is an
advanced version:
void do_rseek( CHAR_DATA *ch, char *argument)
{
RESET_DATA *pReset;
AREA_DATA *pArea;
int x, counter=1;
char arg[MSL];
bool Room=FALSE, Obj=FALSE, Mob = FALSE;
argument = one_argument(argument, arg);
if (!is_number(arg))
{
ch_printf( ch, "%s is not a number, and only vnums can be searched for in resets.\n\r", arg );
return;
}
x = atoi (arg);
if (!str_cmp( argument, "all") || argument[0] == '\0')
{
Room = TRUE;
Obj = TRUE;
Mob = TRUE;
}
if (is_name( "room", argument))
Room = TRUE;
if (is_name( "obj", argument))
Obj = TRUE;
if (is_name( "mob", argument))
Mob = TRUE;
for ( pArea = first_area; pArea; pArea = pArea->next )
{
for ( pReset = pArea->first_reset; pReset; pReset = pReset->next )
{
switch (toupper(pReset->command) )
{
default:
counter++;
break;
case 'M':
if (Mob && x == pReset->arg1)
{
pager_printf( ch, "&W[&C%-6d&W] %-20s Reset Number: %10d [&CMob&W]\n\r", x, pArea->filename, counter );
list_resets(ch, pArea, NULL, counter, counter);
}
if (Room && x == pReset->arg3)
{
pager_printf( ch, "&W[&C%-6d&W] %-20s Reset Number: %10d [&CRoom&W]\n\r", x, pArea->filename, counter );
list_resets(ch, pArea, NULL, counter, counter);
}
counter++;
break;
case 'G':
if (Obj && x == pReset->arg1)
{
pager_printf( ch, "&W[&C%-6d&W] %-20s Reset Number: %10d [&CObj&W]\n\r", x, pArea->filename, counter );
list_resets(ch, pArea, NULL, counter, counter);
}
counter++;
break;
case 'E':
if (Obj && x == pReset->arg1)
{
pager_printf( ch, "&W[&C%-6d&W] %-20s Reset Number: %10d [&CObj&W]\n\r", x, pArea->filename, counter );
list_resets(ch, pArea, NULL, counter, counter);
}
counter++;
break;
case 'O':
if (Obj && x == pReset->arg1)
{
pager_printf( ch, "&W[&C%-6d&W] %-20s Reset Number: %10d [&CObj&W]\n\r", x, pArea->filename, counter );
list_resets(ch, pArea, NULL, counter, counter);
}
if (Room && x == pReset->arg3)
{
pager_printf( ch, "&W[&C%-6d&W] %-20s Reset Number: %10d [&CRoom&W]\n\r", x, pArea->filename, counter );
list_resets(ch, pArea, NULL, counter, counter);
}
counter++;
break;
case 'P':
if (Obj && x == pReset->arg1)
{
pager_printf( ch, "&W[&C%-6d&W] %-20s Reset Number: %10d [&CObj&W]\n\r", x, pArea->filename, counter );
list_resets(ch, pArea, NULL, counter, counter);
}
if (Obj && x == pReset->arg3)
{
pager_printf( ch, "&W[&C%-6d&W] %-20s Reset Number: %10d [&CContainer&W]\n\r", x, pArea->filename, counter );
list_resets(ch, pArea, NULL, counter, counter);
}
counter++;
break;
case 'H': // Hides an item.
if (Obj && x == pReset->arg1)
{
pager_printf( ch, "&W[&C%-6d&W] %-20s Reset Number: %10d [&CHide Obj&W]\n\r", x, pArea->filename, counter );
list_resets(ch, pArea, NULL, counter, counter);
}
counter++;
break;
case 'D': // For doors
if (Room && x == pReset->arg1)
{
pager_printf( ch, "&W[&C%-6d&W] %-20s Reset Number: %10d [&CRoom&W]\n\r", x, pArea->filename, counter );
list_resets(ch, pArea, NULL, counter, counter);
}
counter++;
break;
case 'R':
if (Room && x == pReset->arg1)
{
pager_printf( ch, "&W[&C%-6d&W] %-20s Reset Number: %10d [&CRoom&W]\n\r", x, pArea->filename, counter );
list_resets(ch, pArea, NULL, counter, counter);
}
counter++;
break;
}
/*
if (pReset->arg1 == x || pReset->arg2 == x || (pReset->arg3 == x && Rooms))
{
pager_printf( ch, "&W[&C%-6d&W] %-20s Reset Number: %10d [&C%s&W]\n\r", x, pArea->filename, counter, pReset->command == 'M' ? "Mobile" : pReset->command == 'O' ? "Object" : "Special");
list_resets(ch, pArea, NULL, counter, counter);
}
counter++;
*/
}
counter = 1;
}
return;
}