mouse.setVirtualPosition seems not to work in Archeage

http://www.archeagegame.com/en/
ArcheAge NA/EU
Post Reply
Message
Author
d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

mouse.setVirtualPosition seems not to work in Archeage

#1 Post by d003232 » Fri Nov 07, 2014 6:26 am

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
The RoM Bot Online Wiki needs your help!

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: mouse.setVirtualPosition seems not to work in Archeage

#2 Post by BlubBlab » Fri Nov 07, 2014 2:11 pm

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...
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

User avatar
Administrator
Site Admin
Posts: 4865
Joined: Sat Jan 05, 2008 4:21 pm

Re: mouse.setVirtualPosition seems not to work in Archeage

#3 Post by Administrator » Fri Nov 07, 2014 4:33 pm

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.

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: mouse.setVirtualPosition seems not to work in Archeage

#4 Post by d003232 » Sat Nov 08, 2014 5:34 am

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?
The RoM Bot Online Wiki needs your help!

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: mouse.setVirtualPosition seems not to work in Archeage

#5 Post by rock5 » Sat Nov 08, 2014 9:42 am

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.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: mouse.setVirtualPosition seems not to work in Archeage

#6 Post by d003232 » Sat Nov 08, 2014 10:12 am

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.
The RoM Bot Online Wiki needs your help!

User avatar
Administrator
Site Admin
Posts: 4865
Joined: Sat Jan 05, 2008 4:21 pm

Re: mouse.setVirtualPosition seems not to work in Archeage

#7 Post by Administrator » Fri Nov 14, 2014 1:29 pm

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.

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: mouse.setVirtualPosition seems not to work in Archeage

#8 Post by d003232 » Sat Nov 15, 2014 6:01 am

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?
The RoM Bot Online Wiki needs your help!

User avatar
Administrator
Site Admin
Posts: 4865
Joined: Sat Jan 05, 2008 4:21 pm

Re: mouse.setVirtualPosition seems not to work in Archeage

#9 Post by Administrator » Sat Nov 15, 2014 9:51 am

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.
Attachments
micromacro.1.9.21.zip
(272.48 KiB) Downloaded 109 times

d003232
Posts: 1252
Joined: Wed Jun 03, 2009 4:27 pm

Re: mouse.setVirtualPosition seems not to work in Archeage

#10 Post by d003232 » Tue Nov 18, 2014 5:22 am

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?
The RoM Bot Online Wiki needs your help!

User avatar
Administrator
Site Admin
Posts: 4865
Joined: Sat Jan 05, 2008 4:21 pm

Re: mouse.setVirtualPosition seems not to work in Archeage

#11 Post by Administrator » Tue Nov 18, 2014 9:18 am

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.

WarnerDop
Posts: 6
Joined: Fri Dec 21, 2018 12:59 pm
Location: Panama
Contact:

mouse setVirtualPosition seems not to work in Archeage

#12 Post by WarnerDop » Mon Dec 24, 2018 5:11 am

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest