void do_loop( CHAR_DATA *ch, char *argument)
{
char arg[MAX_INPUT_LENGTH];
int times, x;
argument = one_argument( argument, arg );
if ( arg[0] == '\0' || argument[0] == '\0' )
{
send_to_char( "Syntax: loop \n\r", ch );
return;
}
if ((times = atoi(arg)) < 2)
{
send_to_char( "You must loop the command at least twice otherwise you're just doing it normally.\n\r", ch );
return;
}
for ( x = 1; x <= times; x++ )
interpret( ch, number_sign(argument, x) );
}
char *number_sign( char *txt, int num )
{
static char newstring[MAX_INPUT_LENGTH];
int i;
if ( !txt)
return "";
newstring[0] = '\0';
for ( i = 0; txt[i] != '\0'; i++ )
{
if (txt[i] == '#')
strcat(newstring, itoa(num));
else
add_letter(newstring, txt[i]);
}
return newstring;
}