//put this wherever you want /** * return -1 or the command number if the player has it */ short int is_command(const CHAR_DATA *ch, const char* command) { if (!ch || !command || command[0] == '\0') return -1; short int cmd = -1; for (cmd = 0;cmd_table[cmd].name[0] != '\0';cmd ++) if (command[0] == cmd_table[cmd].name[0] && !str_prefix(command, cmd_table[cmd].name) && cmd_table[cmd].level <= ch->level) return cmd; return -1; } void save_queue(CHAR_DATA *ch, bool_t isLast) { if (!ch || !ch->desc) return; if (isLast) sprintf(ch->desc->resume, "%s\n\r%s", ch->desc->inlast, ch->desc->inbuf); else sprintf(ch->desc->resume, "%s", ch->desc->inbuf); ch->desc->inbuf[0] = '\0'; } bool_t do_resume(CHAR_DATA *ch, char *argument) { if ( !ch || !ch->desc) return FALSE; if (argument[0] != '\0') { if ( !str_cmp(argument, "list")) { if (ch->desc->resume[0] == '\0') send_to_char("Your todo list is empty.\n\r", ch); else chprintf(ch, "Your todo list:\n\r%s", ch->desc->resume); return TRUE; } if ( !str_cmp(argument, "clear")) { if (ch->position != POS_DEAD) send_to_char(ch->desc->resume[0] == '\0' ? "Your todo list was already empty.\n\r" : "Ok, todo list cleared.\n\r", ch); ch->desc->resume[0] = '\0'; return TRUE; } send_to_char("Valid arguments: \n\r", ch); return FALSE; } if (ch->desc->resume[0] == '\0') { send_to_char("Your todo list is empty.\n\r", ch); return FALSE; } strcpy(ch->desc->inbuf, ch->desc->resume); ch->desc->resume[0] = '\0'; return TRUE; } /* * Pick off one line from a string and return the rest. */ char *one_line(char *argument, char *arg_first) { if (!argument) return &str_empty[0]; int i, k; /* * Look for at least one new line. */ for (i = 0;argument[i] != '\n' && argument[i] != '\r';i ++) { if (argument[i] == '\0') { for (k = 0; k <= i; k++) arg_first[k] = argument[k]; argument[0] = '\0'; return argument; } } /* * Canonical input processing. */ for (i = 0, k = 0;argument[i] != '\n' && argument[i] != '\r';i ++) { if (k >= MAX_STRING_LENGTH - 3) { /* skip the rest of the line */ for (;argument[i] != '\0';i ++) { if (argument[i] == '\n' || argument[i] == '\r') break; } argument[i] = '\n'; argument[i + 1] = '\r'; argument[i + 2] = '\0'; break; } if (argument[i] == '\b' && k > 0) --k; else if ((xisascii(argument[i])&& xisprint(argument[i])) || argument[i] == '\t') arg_first[k ++] = argument[i]; } // Finish off the line. arg_first[k] = '\0'; // Shift the input buffer. short int offset = argument[i+1] != '\n' && argument[i+1] != '\r' ? 1 : 2; for (k = 0;(argument[k] = argument[i + k + offset]) != '\0';k ++) ; return argument; } in nanny look for this line: (descIt is the d variable) if (descIt && descIt->character && descIt->character->wait > 0) { --descIt->character->wait; if ( !descIt->inbuf || descIt->inbuf[0] == '\0') continue; //check if we find a command we can execute right away even lagged char* commandList = str_dup(descIt->inbuf); descIt->inbuf[0] = '\0'; char commandLine[MAX_INPUT_LENGTH]; commandLine[0] = '\0'; char command[MAX_INPUT_LENGTH]; while (commandLine[0] == '\0' && commandList[0] != '\0') commandList = one_line(commandList, commandLine); short int cmd; while (commandLine[0] != '\0') { one_argument(commandLine, command); if ( !str_cmp(command, "!!")) { save_queue(descIt->character, FALSE); break; } cmd = is_command(descIt->character, command); if (cmd != -1 && cmd_table[cmd].wait == 0) interpret(descIt->character, commandLine, FALSE); else sprintf(descIt->inbuf, "%s%s\n\r", descIt->inbuf[0] != '\0' ? descIt->inbuf : "", commandLine); do { commandList = one_line(commandList, commandLine); } while (commandLine[0] == '\0' && commandList[0] != '\0'); } free_string( &commandList); continue; }