Page 1 of 1

mouse.setVirtualPosition seems not to work in Archeage

Posted: Fri Nov 07, 2014 6:26 am
by d003232
I have some questions to MM2:

First:
I would like to set the mouse position while AA window is in background. Is there any way to do this??

'mouse.setVirtualPosition' doen't seems to work at all (with AA). It wont move the mouse position wether AA is in foreground or not.

'mouse.setPosition' seems to work even if the focus is set to another window (like the MM window). At least the mouse position at the AA windows has to be visible ... that means no other window covers the mouse position in AA.


Second question:
Is there a module in MM2 to check the color of a pixel like in MM1?


Third:
Isn't there a function in MM2 to send complete strings to the keyboard ... like keyboardType() im MM1? Or do I have to send a string keypress by keypress?


TY
Stephen

Re: mouse.setVirtualPosition seems not to work in Archeage

Posted: Fri Nov 07, 2014 2:11 pm
by BlubBlab
1.)AA has Hackshield so some functions will work some not try&error...
2.) Admin seems to have add the Cli module to MM2 http://www.solarstrike.net/wiki/index.p ... Cli_Module
3.) I don't see a way...

Re: mouse.setVirtualPosition seems not to work in Archeage

Posted: Fri Nov 07, 2014 4:33 pm
by Administrator
setVirtualPosition() does not move the mouse. It remembers the position, and uses that as the click position in future calls to virtualPress().
Is there a module in MM2 to check the color of a pixel like in MM1?
window.getPixel() does that.
Isn't there a function in MM2 to send complete strings to the keyboard ... like keyboardType() im MM1? Or do I have to send a string keypress by keypress?
No, it only really worked with one keyboard layout (US standard layout). I want to look into a better solution.

Re: mouse.setVirtualPosition seems not to work in Archeage

Posted: Sat Nov 08, 2014 5:34 am
by d003232
Administrator wrote:setVirtualPosition() does not move the mouse. It remembers the position, and uses that as the click position in future calls to virtualPress().
I understand it that way. But with setVirtualPosition() the virtualPress() seems not to reach the AA window. I will check that again next time.
Administrator wrote:window.getPixel() does that.
Ok. Didn't fount that. I will try to use it.
Administrator wrote:No, it only really worked with one keyboard layout (US standard layout). I want to look into a better solution.
I now do one keypress for every character. But it seems that I cant use special characters like '&%= etc' because they depent from the keyboard layout. I can only use keypress for charakters with a own virtual key?

Re: mouse.setVirtualPosition seems not to work in Archeage

Posted: Sat Nov 08, 2014 9:42 am
by rock5
d003232 wrote:I now do one keypress for every character. But it seems that I cant use special characters like '&%= etc' because they depent from the keyboard layout. I can only use keypress for charakters with a own virtual key?
I suspect this is because the keyboard functions are for pressing keys not for creating characters. So, for example, 5 and % are the same key. To create % you would hold shift and press 5. You could try that. Hm... MM1 allowed you to add a modifier to key presses but MM2 does not. So you would have to do each command separately, eg.

Code: Select all

keyboard.hold(key.VK_SHIFT)
keyboard.press(key.VK_5)
A bit tedious.

Re: mouse.setVirtualPosition seems not to work in Archeage

Posted: Sat Nov 08, 2014 10:12 am
by d003232
rock5 wrote:
d003232 wrote:I now do one keypress for every character. But it seems that I cant use special characters like '&%= etc' because they depent from the keyboard layout. I can only use keypress for charakters with a own virtual key?
I suspect this is because the keyboard functions are for pressing keys not for creating characters. So, for example, 5 and % are the same key. To create % you would hold shift and press 5. You could try that. Hm... MM1 allowed you to add a modifier to key presses but MM2 does not. So you would have to do each command separately, eg.

Code: Select all

keyboard.hold(key.VK_SHIFT)
keyboard.press(key.VK_5)
A bit tedious.
Yes I did this with '/' until I detected 'key.VK_DIVIDE'. And it works.

For the other charakters like '&%$()...' it would be the problem that they are dependig from the keyboard layout at different keys. Thereby I just ignore that charater in spam messages.

Re: mouse.setVirtualPosition seems not to work in Archeage

Posted: Fri Nov 14, 2014 1:29 pm
by Administrator
Administrator wrote:
Isn't there a function in MM2 to send complete strings to the keyboard ... like keyboardType() im MM1? Or do I have to send a string keypress by keypress?
No, it only really worked with one keyboard layout (US standard layout). I want to look into a better solution.
I've come up with a good solution that is much faster, simpler, and more accurate than previously. The limitation is that it is restricted to the 'virtual' set, as it posts the messages to the target's input queue rather than send individual key press/releases. As such, it may not work everywhere.

Example:

Code: Select all

	local window = window.find("* - Notepad", "edit");
	if( not window ) then
		error("Could not find window.", 0);
	end

	keyboard.virtualType(window, "Testing. Hello, how are you? !@#$%^&*()_+\nNewline\t\tTab");
Result:

Code: Select all

Testing. Hello, how are you? !@#$%^&*()_+
Newline		Tab
The text appears instantly instead of taking several seconds to type out.

Re: mouse.setVirtualPosition seems not to work in Archeage

Posted: Sat Nov 15, 2014 6:01 am
by d003232
Administrator wrote:

Code: Select all

	keyboard.virtualType(window, "Testing. Hello, how are you? !@#$%^&*()_+\nNewline\t\tTab");
I'm looking forward for that. I guess it's not in MM2 v1.9.20? At least I get an error as I was looking for that. Do you already have a new version?

Re: mouse.setVirtualPosition seems not to work in Archeage

Posted: Sat Nov 15, 2014 9:51 am
by Administrator
There's no full release, but I'll upload a copy of just the executable. It contains some other, much more experimental, changes. Don't be surprised if it crashed or otherwise behaves abnormally.

Re: mouse.setVirtualPosition seems not to work in Archeage

Posted: Tue Nov 18, 2014 5:22 am
by d003232
Administrator wrote:window.getPixel() does that.
I spend some time with that. Not very succesfull.

Code: Select all

window.getPixel(win, _harvestNoticeX, _harvestNoticeY)
If I'm understanding it the right way x,y is realativ to the AA window while mouse.getPosition() is absolute to the whole screen?

I have little problems now to find the exact position of the pixel within the 'F' harvesting notice/icon. : I'm doing it in windows mode, not fullscreen and it seems like the windows title area (about 31 pixel high) is somehow responsible for the difference betwenn the cursor position and the pixel position I'm reading out. Any experiences like that?

Re: mouse.setVirtualPosition seems not to work in Archeage

Posted: Tue Nov 18, 2014 9:18 am
by Administrator
Yeah, that makes sense. I think the coordinates should be in client coordinates (ie. the section inside the border and title bar, but not including it). The window size will vary depending on if it is windowed or not (due to the titlebar height, as you've pointed out) so that could cause problems like what you are experiencing.

Can you do some testing to tell if the exact position you're after changes based on if it is windowed or not? Maybe something is wrong with my code and it is using global coordinates instead of client coordinates of the target window, but it is hard to tell if it is because of that or because the actual position is changing with window size.

mouse setVirtualPosition seems not to work in Archeage

Posted: Mon Dec 24, 2018 5:11 am
by WarnerDop
Are you running with -nomouse command line parameter? Mine seems to be running ok... tried in debug, plus the first version 30 and then the unofficial version 30 and they are working.