how to hold multiple keys at once

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

how to hold multiple keys at once

#1 Post by Exempt » Sun Jul 24, 2016 7:51 pm

I'm trying to hold shift and enter at once but the enter key is never held down. Is there a way to fix this?
I tried with and without a small delay between holding the keys down.

Code: Select all

keyboard.hold(key.VK_SHIFT)
keyboard.hold(key.VK_ENTER)

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

Re: how to hold multiple keys at once

#2 Post by Administrator » Sun Jul 24, 2016 9:34 pm

I believe that depends on the specific way that application tries to read inputs. I'd try using the virtual methods instead. This jams the synthetic keypresses into the target application's input queue.

Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Re: how to hold multiple keys at once

#3 Post by Exempt » Sun Jul 24, 2016 9:53 pm

Sadly, virtual methods have no effect. It's a opengl/java made game. But it's odd the shift works perfect but enter fails..

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

Re: how to hold multiple keys at once

#4 Post by Administrator » Sun Jul 24, 2016 10:51 pm

Does it catch the shift and the enter by themselves, yet fail to see them in combination? Or does it just not see enter at all?

Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Re: how to hold multiple keys at once

#5 Post by Exempt » Sat Aug 06, 2016 12:07 pm

sorry, I got distracted for a few days. -.- It seems to just press enter and not hold it down.

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

Re: how to hold multiple keys at once

#6 Post by Administrator » Sat Aug 06, 2016 12:29 pm

My best guess is it has something to do with how the game is reading the key input. I've seen a ton of games that use GetKeyState() or GetAsyncKeyState() for modifiers (Shift, Control, Alt) and Enter. It is poor form on their part, but it's functional. These functions are built into the win32 library and have been knowingly buggy (or otherwise have undocumented behavior) since their introduction. They are intended to poll the hardware state of the key with a given virtual key code, so that could explain the behavior you're experiencing.

Is there perhaps another way you could go about what you're trying to accomplish?

Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Re: how to hold multiple keys at once

#7 Post by Exempt » Sat Aug 06, 2016 3:58 pm

Yes there is thankfully but it's not quite as efficient.

Edit: BTW.. that avatar is far less scary then your old one :D

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

Re: how to hold multiple keys at once

#8 Post by Administrator » Sun Aug 07, 2016 7:29 pm

Well I do have approximate knowledge of many things!

For efficiency, what have you tried? Have you considered flipping some memory flags to try and indicate that a certain key is pressed (often there will be a variable for keydown states; might be useful to touch this). Or you could even NOP/JMP some of the assembly to force that code to trigger even if the corresponding key wasn't pressed.

Or, an easier solution: change your key bind, and press some other key.

Exempt
Posts: 197
Joined: Wed Jan 20, 2010 9:55 am

Re: how to hold multiple keys at once

#9 Post by Exempt » Sun Aug 07, 2016 8:53 pm

When I search memory addresses things get really weird... I'll find a address for something like a coordinate but after about 5-10mins the address will change to something completely different. I'm really just trying to avoid memory stuff all together. The efficiency issue isn't a big one it's just a game mechanic that allows shift dragging many things at once instead of one at a time.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest