Tutorial *80*
To Add Tab Completion of Alias Commands to NQ (By Shelob)

This was copied with a slight alteration from the QW code. I've no idea why iD never put it into quake because it rocks. Great for people with funky cfg's and for adding and removing frogbots etc.

Open CMD.C and find the Cmd_CompleteCommand function. Change it to look like this.



/*

============

Cmd_CompleteCommand

============

*/

char *Cmd_CompleteCommand (char *partial)

{

	cmd_function_t	*cmd;

	int				len;

	cmdalias_t		*a; // Added for alias cmd completion



	len = Q_strlen(partial);



	if (!len)

		return NULL;



// check functions

	for (cmd=cmd_functions ; cmd ; cmd=cmd->next)

		if (!Q_strncmp (partial,cmd->name, len))

			return cmd->name;



//The next For loop adds alias cmd completion

	for (a=cmd_alias ; a ; a=a->next)

		if (!Q_strncmp (partial, a->name, len))

			return a->name;





	return NULL;

}



 
Sign up
Login:
Passwd:
[Remember Me]