Page 1 of 1

NEW FEATURE: /keepkeys

Posted: Wed Oct 08, 2003 7:18 pm
by MacroFiend
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);
}

Posted: Wed Oct 08, 2003 8:31 pm
by Jaerin
Why wouldn't you want to keep keys?

Jaerin

Posted: Wed Oct 08, 2003 8:36 pm
by MacroFiend
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

Posted: Wed Oct 08, 2003 9:26 pm
by LordGiddion
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.

Posted: Wed Oct 08, 2003 9:31 pm
by MacroFiend
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.

Posted: Wed Oct 08, 2003 10:47 pm
by fryfrog
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.

Posted: Wed Oct 08, 2003 11:08 pm
by MacroFiend
So have a feature like "keep most keys"? Where it keeps all but the special control keys like movement and stack/individual pickup?

Posted: Thu Oct 09, 2003 7:46 am
by fryfrog
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"? :)

Posted: Thu Oct 09, 2003 9:53 am
by Mckorr
In the CVS... and eliminated a second instance of

{"/memspell", "MemSpell"},

which showed up twice in the same section for some reason.

Posted: Thu Oct 09, 2003 9:27 pm
by azwildfire
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

Posted: Thu Oct 09, 2003 9:35 pm
by MacroFiend
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.

Posted: Fri Oct 10, 2003 8:14 am
by Mckorr
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.

Posted: Fri Oct 10, 2003 3:42 pm
by insanitywiz
Yeah, DKAA's pretty nuts about that. He kinda scares me.

But then, I scare easy.