EQ crashing, would appreciate some help

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

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

Post by MacroFiend » Tue Oct 28, 2003 12:08 pm

Aww ... but McKorr, with Lax's new tools, we should be able to find all those offsets in a matter of seconds *g*

Love the idea of making /click right|left target always be a direct function call. One minor addition I would suggest (for patch days) would be to run a check to see if the function offset is defined. If it isn't, run the detoured mouse version of the click.

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Tue Oct 28, 2003 12:23 pm

well maybe I complicated the issue by putting the word "click" in the function at all... it really has nothing much to do with the mouse or its clicks...

if I rename it /rclicktarget to /openorinspect
and /lclicktarget to /giveortrade

and then spit out an error if they dont have someone targeted... Im still thinking about this...

or maybe I just shouldnt giva damn if ppl refuse to simplify their macros, I wrote this because I had to small of a screen and to many bags open so they overlapped the merchant I wanted to open... now im looking at the floor to reduce lag and just use /rclicktarget to open him...

hmm...
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

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

Post by Mckorr » Tue Oct 28, 2003 1:19 pm

EQMule, MacroFiend: Took a look through the code, it wouldn't be that much trouble to do both of those. Just a little transposition of the current /lclicktarget|/rclicktarget, and some parameter checking in /click. Checking whether the function offset is defined is trivial... of course it won't do any good, because we'd still be using the current offsets for lclicktarget|rclicktarget, which would be defined, and broken by a patch just like all the rest.

Patches tend to break both detoured and nondetoured click as well.

EQM: It's not a matter of simplifying the code for anyone, it's a matter of having our scripting language try to follow some sort of logic. I like the functions, I just think we should integrate them with the existing click code. Sure, I know we aren't really clicking, but we are producing a click like effect. Why not attempt to keep things standardized instead of adding hosts of new functions that essentially are improvements of the old ones?

I can integrate the code, removing lclicktarget|rclicktarget and moving the direct calls to /click, in about 30 minutes. Just have to wait till I get home and have access to a compiler and EQ for testing.
MQ2: Think of it as Evolution in action.

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

Post by Mckorr » Tue Oct 28, 2003 1:51 pm

A quick hack and slash job, uncompiled and untested, gives us this for /click, integrating /lclicktarget and /rclicktarget into the standard form /click left|right target:

Code: Select all

VOID Click(PSPAWNINFO pChar, PCHAR szLine) { 
	CHAR szArg1[MAX_STRING] = {0}; 
	PCHAR szMouseLoc;
	MOUSE_DATA_TYPES mdType = MD_Unknown; 
	DWORD RightOrLeft = 0;

	GetArg(szArg1, szLine, 1); //left or right 
	szMouseLoc = GetNextArg(szLine, 1); //location to click
	
	//parse location for click location (szMouseLoc) here 
	if (szMouseLoc && szMouseLoc[0]!=0) {
		if (!strnicmp(szMouseLoc, "target", 6)) {
			if (!strnicmp(szArg1, "left", 4)) {
				if(!EQADDR_LCLICKTARGET) return;
				RightOrLeft = EQADDR_LCLICKTARGET;
			} else if (!strnicmp(szArg1, "right", 5)) {
				if (!EQADDR_RCLICKTARGET) return;
				RightOrLeft = EQADDR_RCLICKTARGET;
			}
			DWORD CEverQuest = 0;
			CEverQuest = (DWORD)*EQADDR_CLSMAINNEWUI;
			DWORD pTarget = NULL;
			if (EQADDR_TARGET && *(DWORD *)EQADDR_TARGET) {
				pTarget = *(DWORD *)EQADDR_TARGET;
				__asm {
					push ecx;
					push pTarget;
					mov ecx, dword ptr [CEverQuest];
					call dword ptr [RightOrLeft];
					pop ecx;
				}
			}
			return;
		} else if (!ParseMouseLoc(GetCharInfo(), szMouseLoc)) {
			DebugSpew("Invalid mouse loc to click, aborting: %s",szMouseLoc);
			return;
		}
	}
	
	if (szArg1[0]!=0) { 
		if (!strnicmp(szArg1, "left", 4)) { 
			mdType = MD_Button0; 
			MouseClickL(pChar,szLine); 
		} else if (!strnicmp(szArg1, "right", 5)) { 
			mdType = MD_Button1; 
            MouseClickR(pChar,szLine); 
        } else { 
	        WriteChatBuffer("Usage: /click <left|right>",USERCOLOR_DEFAULT); 
	        DebugSpew("Bad command: %s",szLine); 
	        return; 
        }
        PMOUSESPOOF pData = (PMOUSESPOOF)malloc(sizeof(MOUSESPOOF)); 
        pData->mdType = mdType; 
        pData->dwData = 0x00; 
        pData->pNext = NULL; 
        if (!gMouseData) { 
	        gMouseData = pData; 
        } else { 
	        PMOUSESPOOF pTemp = gMouseData; 
	        while (pTemp->pNext) { 
		        pTemp = pTemp->pNext; 
	        }
	        pTemp->pNext = pData; 
        }
    }
}
Wouldn't be surprised if I have a few braces missing or misaligned :D

Edit: missed a "return" that is needed to avoid parsing "target" twice and clicking it.
MQ2: Think of it as Evolution in action.

Joshjje
orc pawn
orc pawn
Posts: 18
Joined: Mon Oct 27, 2003 2:39 pm

...

Post by Joshjje » Tue Oct 28, 2003 8:08 pm

I like the idea, thats sorta what i initially stated using /click right target fake or something along those lines, but just making the existing command a direct "click" would obviously be more efficient. Sooo...do i win that little goodie package..or maybe half :)

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

Post by Mckorr » Tue Oct 28, 2003 8:12 pm

I just changed it in the dev CVS. The command will now be "/click left|right target", and that will invoke the direct calls of /lclicktarget and /rclicktarget instead of parsing "target" as previously done. Functionality will remain the same as /lclicktarget and /rclicktarget, but the command format will match other clicky things.
MQ2: Think of it as Evolution in action.

Kaitain
a ghoul
a ghoul
Posts: 109
Joined: Fri Oct 10, 2003 1:49 pm

Post by Kaitain » Wed Oct 29, 2003 7:08 am

<deleted>
Last edited by Kaitain on Thu Apr 15, 2004 5:31 pm, edited 1 time in total.

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

Post by Mckorr » Wed Oct 29, 2003 9:37 am

It's /click left|right target. No extra commands, and /lclicktarget and /rclicktarget have been removed. I used the code from those two to modify /click.
MQ2: Think of it as Evolution in action.