NEW FEATURE: /keepkeys

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

NEW FEATURE: /keepkeys

Post by MacroFiend » Wed Oct 08, 2003 7:18 pm

I've finished coding a /keepkeys command that will let us set a default for /endmacro to keepkeys or not. I don't think I missed anything required to get it up and running. Compiled fine in VS.NET. Starting to test now.

MQ.h

Code: Select all

[color=red]extern "C" EQLIB_API VOID  Look			(PSPAWNINFO, PCHAR);[/color]
extern "C" EQLIB_API VOID  KeepKeys		(PSPAWNINFO, PCHAR);
EQLib.h

Code: Select all

[color=red]extern BOOL gMQPauseOnChat;[/color]
extern BOOL gKeepKeys;
[color=red]extern DWORD gMapFilters[];[/color]

EQLib_Interp.cpp

Code: Select all

[color=red]		{"/memspell",   "MemSpell"},[/color]
		{"/keepkeys",	"KeepKeys"},

[color=red]		{NULL,			NULL}[/color]

EQLib_Main.cpp

Code: Select all

[color=red]BOOL gMQPauseOnChat = FALSE;[/color]
BOOL gKeepKeys = FALSE;

[color=red]DWORD gMapFilters[MAPFILTER_NUMBER] = {0};[/color]
a ways down .. still in EQLib_Main.cpp

Code: Select all

[color=red]	gMQPauseOnChat= 1==GetPrivateProfileInt("MacroQuest","MQPauseOnChat",0,Filename);[/color]
	gKeepKeys	  = 1==GetPrivateProfileInt("MacroQuest","KeepKeys",0,Filename);

[color=red]	for (DWORD i=0;gMapFilterOptions[i].szName;i++) {[/color]
EQLib_MacroCommands.cpp

Code: Select all

[color=red]	PEVENTLIST pEventL;[/color]
	BOOL bKeepKeys = gKeepKeys;
[color=red]	BOOL bKeepVars = FALSE;[/color]
EQLib_Commands.cpp

Code: Select all

// ***************************************************************************
// Function:		KeepKeys
// Description:		Our /keepkeys command. Toggles if /endmacro will keep keys
//					by default.
// 2003-10-08		MacroFiend
// ***************************************************************************
VOID KeepKeys(PSPAWNINFO pChar, PCHAR szLine)
{
	bRunNextCommand = TRUE;
	DWORD Command;
	CHAR szArg[MAX_STRING] = {0};
	GetArg(szArg,szLine,1);
	CHAR szCmd[MAX_STRING] = {0};

	PCHAR szKeepKeys[] = {
		"off",
		"on",
		NULL
	};

	if (szArg[0]==0) {
		sprintf(szCmd,"Auto-Keep Keys: %s",szKeepKeys[gKeepKeys]);
		WriteChatBuffer(szCmd,USERCOLOR_DEFAULT);
		return;
	}
	for (Command=0;szKeepKeys[Command];Command++) {
		if (!stricmp(szArg,szKeepKeys[Command])) {
			gKeepKeys = Command;
			sprintf(szCmd,"Auto-Keep Keys changed to: %s",szKeepKeys[gKeepKeys]);
			WriteChatBuffer(szCmd,USERCOLOR_DEFAULT);
			itoa(gKeepKeys,szCmd,10); WritePrivateProfileString("MacroQuest","KeepKeys",szCmd,gszINIFilename);
			return;
		}
	}
	WriteChatBuffer("Usage: /keepkeys [on|off]",USERCOLOR_DEFAULT);
}
Last edited by MacroFiend on Wed Oct 08, 2003 8:38 pm, edited 1 time in total.

Jaerin
Developer
Developer
Posts: 133
Joined: Mon Mar 10, 2003 7:37 pm
Contact:

Post by Jaerin » Wed Oct 08, 2003 8:31 pm

Why wouldn't you want to keep keys?

Jaerin

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Wed Oct 08, 2003 8:36 pm

Don't know :) I didn't write the /endmacro, so I'm not sure why it is set to flush keys (ignorance on my part). Just adding the option to have it default to keep keys

LordGiddion
a snow griffon
a snow griffon
Posts: 352
Joined: Sat Sep 13, 2003 6:12 pm
Contact:

Post by LordGiddion » Wed Oct 08, 2003 9:26 pm

if you end a macro without keep keys the macro takes a bit longer to end then if you do, this is because code does a sendkey up for every key.
The effect this if your script was running you and the last command was sendkeys down up, if you end without keep keys the macro will stop the run when the macro end, if you end without you exit the macro and still be running. Using keep keys might end the macro faster but could end up killing you off.

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Wed Oct 08, 2003 9:31 pm

Makes sense to me ... the problem is that with the extra delay that not keeping keys has been adding for people, they have been getting killed because they couldn't move/attack/whatever they needed to do for several seconds.

So, letting there be a default to enable keep keys is probably a good thing for those who have issues with the extra delay.

fryfrog
a hill giant
a hill giant
Posts: 271
Joined: Fri Jun 20, 2003 5:37 am

Post by fryfrog » Wed Oct 08, 2003 10:47 pm

If MQ is sending the key up/down events, why not just have it track the keys it has set down and up them only? Also having a "minimal" up send for ctrl, alt and shift may be a good idea since those are the ones that can really annoy people when they are down and it takes a sec to realize it.

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Wed Oct 08, 2003 11:08 pm

So have a feature like "keep most keys"? Where it keeps all but the special control keys like movement and stack/individual pickup?

fryfrog
a hill giant
a hill giant
Posts: 271
Joined: Fri Jun 20, 2003 5:37 am

Post by fryfrog » Thu Oct 09, 2003 7:46 am

That sounds like the best keys to hit. Movement (up, down, left, right) and the keys which are held down during other keypresses for various reasons (strafe left/right, pick up stack, pick up one, etc). It should be quite a bit quicker to run through those 7 or so keys than the approx 101 keys on a normal keyboard. Perhaps it could be an option in the macroquest.ini file like comma seperated list? "UnPressKeys=ctrl,alt,shift,up,down,left,right"? :)

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Thu Oct 09, 2003 9:53 am

In the CVS... and eliminated a second instance of

{"/memspell", "MemSpell"},

which showed up twice in the same section for some reason.
MQ2: Think of it as Evolution in action.

azwildfire
Contributing Member
Contributing Member
Posts: 72
Joined: Fri Jul 05, 2002 5:12 am
Location: Phoenix arizona
Contact:

Post by azwildfire » Thu Oct 09, 2003 9:27 pm

I have a question

THere is a post that says this was CVS but the CVS are all dated 4 days ago... how do i get the same CVSyou are all using???


i typically use the web based browser Source forge uses

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Thu Oct 09, 2003 9:35 pm

It has been posted to the dev CVS. You have to wait for SourceForge to run the update process for it to migrate. Or for DKAA to release a new zip archive.

I want access to the dev CVS ... I feel naked without the ability to contribute ... and I can't really help on patch days because of the anon-cvs delays.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Fri Oct 10, 2003 8:14 am

Any time you see an "in the CVS" message from a dev it means we've updated the dev CVS. There is a lag between that repository and the anonymous one, usually around 24 hours, sometimes more.

Sourceforge has been working to correct this and cut down on the delay, or at least make the 24 hours standard, something like that.

For the latest source for non-devs, if you don't want to wait for the CVS to catch up, get the zip file. DKAA is very good at keeping it current with the dev CVS.
MQ2: Think of it as Evolution in action.

insanitywiz
a hill giant
a hill giant
Posts: 250
Joined: Mon Jul 08, 2002 7:50 am

Post by insanitywiz » Fri Oct 10, 2003 3:42 pm

Yeah, DKAA's pretty nuts about that. He kinda scares me.

But then, I scare easy.