Can t execute more than 1 macro

Need help running MacroQuest 1? Too bad! Use MQ2.

Moderator: MacroQuest Developers

Rand
a lesser mummy
a lesser mummy
Posts: 44
Joined: Sun Jun 08, 2003 8:37 am

Can t execute more than 1 macro

Post by Rand » Fri Sep 05, 2003 8:01 pm

I can t execute more than 1 macro in a play session.
When I launch my first macro it works fine, but when I stop it and try to launch an other macro nothing works.

Here is what I get in my log :

Macro - Loading macro: C:\Dev\macroquest\Macros\twist.mac
Include - Including: C:\Dev\macroquest\Macros\exp.mac
Macro - Starting macro with '/call Main 3 4 5 6'
Call - Calling subroutine Main with params 3 4 5 6
Call Main - 0 = 3
Call Main - 1 = 4
Call Main - 2 = 5
Call Main - 3 = 6
EndMacro - Ended
CChatHook::Detour(The current macro has ended.)

It seems that the 2nd time my macro stops before I even move into pusle.

I ll try to find where the error is but if any of you know where it may fail it would help.

Rand
a lesser mummy
a lesser mummy
Posts: 44
Joined: Sun Jun 08, 2003 8:37 am

Post by Rand » Sat Sep 06, 2003 9:54 am

OK, I found where was the error

In the DInput detour there is a check on the number of returned elements ( *pdwInOut == 32 ). On my machine *pdwInOut is always equals to 128.
So when a macro did a keypress It wasn t processed and since gKeyStack was never empty pulse wasn't runned.

I removed the check on pdwInOut, it works fine now. Anyone know why this check was here ?

Old code :

Code: Select all

if (!gbUnload) {
		DebugSpew("pdwInOut = %ld", *pdwInOut);
		if (*pdwInOut == 32) {
			if (gKeyStack) {
				....
			}
		} else {
				****
			}
			bRunNextCommand = TRUE;
			DWORD CurTurbo=0;
			while ((!gKeyStack) && (bRunNextCommand)) {
				DebugSpew("DInputDataDetour::Pulse");
				bRunNextCommand = FALSE;
				Pulse();
				...
			}
		}
	}
new Code :

Code: Select all

if (!gbUnload) {
		DebugSpew("pdwInOut = %ld", *pdwInOut);
		if (gKeyStack) {
				....
		} else {
				****
			}
			bRunNextCommand = TRUE;
			DWORD CurTurbo=0;
			while ((!gKeyStack) && (bRunNextCommand)) {
				DebugSpew("DInputDataDetour::Pulse");
				bRunNextCommand = FALSE;
				Pulse();
				...
			}
		}
	}

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Sat Sep 06, 2003 10:07 am

erm... not sure why it's there... I know it doesn't bother me, but I'm not sure it's safe to remove from the general release because I'm not sure what it's actually checking.