Fix for mouse movement problems using /mouseto and /click

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

Moderator: MacroQuest Developers

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

Fix for mouse movement problems using /mouseto and /click

Post by Mckorr » Tue May 20, 2003 9:11 am

Since /click and /mouseto should be back in circulation with the next CVS update I wanted to post these small changes early. Hopefully this will avoid a host of "my mouseto isn't working" messages:

First, the correct format for the mouseto command is now:

/mouseto X Y abs|rel

You MUST specify either "abs", for absolute coordinates, or "rel", for coordinates relative to the current mouse position. Eventually I'll fix it so that "abs" is the default and won't have to be specified.

You CAN NOT, at this time, do

/mouseto location

The MouseTo function does not support location parsing yet. I never got around to writing it in, should be a simple fix however.

Click takes the format

/click left|right
/click left|right location

If the location desired is not in locations.txt the mouse will move to 0,0.

Now, actual code. If your mouse is not moving to the correct location, before you yell for help try the following changes to EQLib.cpp:

In ParseMouseLoc, change

Code: Select all

ClickX = (atoi(ButtonX) + XMLloc.x + (int)(XMLloc.w/2) - MouseInfo->X)/2; 
ClickY = (atoi(ButtonY) + XMLloc.y + (int)(XMLloc.h/2) - MouseInfo->Y)/2;
to

Code: Select all

ClickX = (atoi(ButtonX) + XMLloc.x + (int)(XMLloc.w/2) - MouseInfo->X); 
ClickY = (atoi(ButtonY) + XMLloc.y + (int)(XMLloc.h/2) - MouseInfo->Y);
AND in the MouseTo function, change

Code: Select all

if (!strncmp(szArg3, "abs", 3)) { 
               nX = (atoi(szArgX)-MouseInfo->X)/2; 
               nY = (atoi(szArgY)-MouseInfo->Y)/2; 
               } else if (!strncmp(szArg3, "rel", 3)) { 
                   nX = atoi(szArgX)/2; 
                   nY = atoi(szArgY)/2; 
            } 
      }
to

Code: Select all

if (!strncmp(szArg3, "abs", 3)) { 
               nX = (atoi(szArgX)-MouseInfo->X); 
               nY = (atoi(szArgY)-MouseInfo->Y); 
               } else if (!strncmp(szArg3, "rel", 3)) { 
                   nX = atoi(szArgX); 
                   nY = atoi(szArgY); 
            } 
      }
Explanation: when working on the code I found that all mouse movements were double what I needed, so I divided them all by two. Others don't have this problem, no idea why.

Hopefully this will forestall a mass of questions about why the mouse is only moving part of the way to where you want it.

Edit: EqMule -> since this is oudated info, im unsticking this post to make room for other stickys.

Pragma
a ghoul
a ghoul
Posts: 91
Joined: Sat May 03, 2003 1:45 am

Post by Pragma » Tue May 20, 2003 5:20 pm

worked for me :)

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

Post by Mckorr » Tue May 20, 2003 5:32 pm

Look at that, fixed before the code hit the streets. Damn I'm good... donate to the Horse Fund :D

Jay
a lesser mummy
a lesser mummy
Posts: 59
Joined: Tue Jan 28, 2003 11:37 am

Post by Jay » Tue May 20, 2003 7:08 pm

Did not work for me, but my mouse is going to 0,0 so...

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Tue May 20, 2003 8:33 pm

Did not work for me.. the one without the /2 went to 0 0 everytime.. the one with /2 would go to all sortsa strange places on the screen.. when I would start my mouse at 0 0 (move it to the top left manually) and do a /mouseto <x> <y> abs to the loc that my /mousepos told me, it would overshoot the actual location by about 210pixels.. then if I would try to get my mouse to just goto 0 0, it would go to the top left the first time, then the top right the second time.. I dont know what I'm missing.. could it be figuring my resolution incorrectly? I'm running in 1152 x 864.. if resolution is the issue, is there a way to code it so it doesnt have find my resolution, but I provide it instead? the way its overshooting locations, it feels like its resolution related..



edit: tried different resolutions and nothing.. = \

Oh, and /click left auto and /click left destroy find the bottom right corner of the screen every time.. = ( Compiling with C++ 6
LOADING PLEASE WAIT...

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

Post by Mckorr » Tue May 20, 2003 9:45 pm

I'm running at the same resolution, 1152x864, so it's not a resolution issue. It MAY be a VC6 issue; I'm using VC.NET, and compiling straight from the CVS solution files.

Will download the CVS and compile straight from the distribution, see if that shows me any problems.

Check your eqgame.ini file. Have to have correct offsets for Mouse in both DirectX and Memory Locations, and have to have ServerHost in Memory Locations. Incorrect mouse offsets cause major movement errors, sending the mouse to edges or corners of the screen. Dunno what an incorrect ServerHost setting will do. Probably result in incorrect path parsing, and the mouse will move to 0,0.

Check your EQPath in macroquest.ini. If that is wrong you will get a parsing error, and the mouse will move to 0,0.

If you add anything to locations.txt, double check your additions, especially spelling. Even a minor error can cause a parsing error, which will move the mouse to 0,0.

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Tue May 20, 2003 9:57 pm

my eqpath was ..\everquest changed that to just c:\everquest.. trying that now.. oh, and /unload crashes..


edit: Just tried the change in the eq path.. didnt work.. and I'm using the offsets from the CVS..

edit2: curious.. we're moving the mouse via direct input, correct? think the direct x versions make a differnce.. I have dx9 installed, but the CVS is using dx8.1 correct? dont know if this matters.. but somthing wierd..

BTW, the mouse moves.. just to a different location every time I do a /mouseto X Y abs same with /mouseto X Y rel and /click left auto still goes to the bottom right corner of the screen, using the default Locations.txt from CVS.. if it helps.. I'm also using the VertUI.. tried the default UI, with no change..
Last edited by loadingpleasewait on Tue May 20, 2003 10:08 pm, edited 1 time in total.
LOADING PLEASE WAIT...

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

Post by Mckorr » Tue May 20, 2003 10:05 pm

Your EQPath must be RELATIVE to your MacroQuest directory. The CVS macroquest.ini is MY file, not the old stock one.

So, since I have MQ in C:\MacroQuest, and EQ in C:\Everquest, then EQPath=..\EverQuest. If you put the C: in there it WILL fail.

If you let me know what directories you have MQ and EQ in I will tell you what you need to set EQPath equal to.

Oh, and /unload... yes, that will cause a crash. That's from ourdetours being changed from ourdetours[7] to ourdetours[8]... yeah, I know that doesn't mean much to most of you. A detour was added to support mouse DirectInput, and MQ doesn't unload that extra detour correctly, causing the crash.

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Tue May 20, 2003 10:13 pm

EQ is in C:\everquest and Macroquest is in C:\MQ


with that being the case, it should follow your example and be

EQPath=..\EverQuest

which didnt work..
edit: Just tried the change in the eq path.. didnt work.. and I'm using the offsets from the CVS..

edit2: curious.. we're moving the mouse via direct input, correct? think the direct x versions make a differnce.. I have dx9 installed, but the CVS is using dx8.1 correct? dont know if this matters.. but somthing wierd..

BTW, the mouse moves.. just to a different location every time I do a /mouseto X Y abs same with /mouseto X Y rel and /click left auto still goes to the bottom right corner of the screen, using the default Locations.txt from CVS.. if it helps.. I'm also using the VertUI.. tried the default UI, with no change..
LOADING PLEASE WAIT...

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

Post by Mckorr » Tue May 20, 2003 10:16 pm

Moving to the bottom right corner of the screen.... you didn't change the CVS code, did you?

A bit of history... when I was working with the initial mouse code written by NealThorpayt, I'd always jump to the bottom right corner. Turned out that the values being sent were DOUBLE what they should have been. I added the /2 to the end of the coordinate calculations, and it all started working.

The CVS code is mine, so it takes into account that my cursor moves twice the distance it should. You should only make the code changes above if your mouse IS NOT MOVING FAR ENOUGH.

UI should not make a difference, but I expect problems there. That will only affect location parsing though, not /mouseto.

DirectX version does not make a dffierence. I have DX9 installed, but compile with the DX8 dinput.h provided by the CVS.

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

Post by Mckorr » Tue May 20, 2003 10:17 pm

Your problem isn't with EQPath then, so leave it be :)

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Tue May 20, 2003 10:22 pm

with changing the CVS code, all I did was try your changes posted at the top of this thread, when they wouldnt move anything anywhere, I redownloaded the CVS and recompiled it.. question, would the detours library make a difference? I have always used my own compiled detours, as the VC6 one included with the CVS has always compiled with errors, and my own compiled detours.lib has had no problems..

I dont think the detours is the issue.. and I dont know enough about coding to even attempt poking around the code.. heh, I'm grasping at straws.. is anyone else having a similiar problem?
LOADING PLEASE WAIT...

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

Post by Mckorr » Tue May 20, 2003 10:27 pm

Hmm, that one I can't answer. I used to use my own compiled Detours, but had a computer crash and had to reconstruct all my code. I started with the CVS, put back in the mouse code from the boards here, and finished the parser. Otherwise have been using all the files direct from the CVS, including DirectX and Detours.

It's sounding like the problem is VC6. Need input from more users to find out though.

Are you using the VC6 project files from the CVS, or did you create your own? Or are you compiling using the makefile?

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Tue May 20, 2003 10:30 pm

I'm using the project files from the CVS.. I used to use my own, but the project files are so easy.. :) also, I just did the /mouseto 100 100 abs test, then did a /mousepos, and it went to 1151 150.. you did say top right, right?? I always thought the top left was 0 0 ... got the /mouseto test from another post you made..
LOADING PLEASE WAIT...

loadingpleasewait
a snow griffon
a snow griffon
Posts: 332
Joined: Sat Sep 14, 2002 8:46 am

Post by loadingpleasewait » Tue May 20, 2003 10:32 pm

Oh, and starting in top left, /mouseto 100 100 abs then doing /mousepos gives me location 150 150..


Man, I am surely post padding tonight.. LOL.. anyways.. somthing else I noticed.. /click left auto somehow, dont ask, I didnt change a thing.. some how magically started moving elsewhere other than the bottem right.. still missing auto, but the main thing is..

it seems like its moving relative no mater what, wheather I use abs or not.. = (

edit: whats sad is I'm on a raid right now, and /click left auto just clicked off a very important buff.. = (
Last edited by loadingpleasewait on Tue May 20, 2003 10:37 pm, edited 1 time in total.
LOADING PLEASE WAIT...