Jump to content
Macro Express Forums

Macro programming on Java games


Recommended Posts

Hi,

 

I'm a new user of macro express pro. I'm trying to create a macro where i can input keystrokes on the java game.

I have used the capturing tool to create a script but the script commands does not play on the java game.

Is there a way to perform this? The clicking part works; however, keyboard key input does not.

 

Thank you,

Link to comment
Share on other sites

Hi,

 

I'm a new user of macro express pro. I'm trying to create a macro where i can input keystrokes on the java game.

I have used the capturing tool to create a script but the script commands does not play on the java game.

Is there a way to perform this? The clicking part works; however, keyboard key input does not.

 

Thank you,

 

Welcome to the forum!

 

Do you need to send a keystroke to the game or you need to simulate a key being held down for a period of time?

If the second, it can't be done be simple sending the keystroke, but there are ways to deal with it.

I.e. if you were playing tetris, and captured a macro in which you press left arrow and keep it pressed for 5 seconds, and then run this macro, it would only move the block one position to the left instead of moving it all the way to the left side (as it would during capturing the macro). But as I said there are ways to deal with it.

Link to comment
Share on other sites

Tetris is a great example. Basically I need to send several keystrokes to the game.

(keeping key stroke pressed for 5 seconds is too long)

For example, I want to do the following commands:

 

To do (left-> left-> change block position -> put it down)

I would need to press the left key, left key, up key, space bar.

 

Please teach me how to deal with this xD.

Link to comment
Share on other sites

Tetris is a great example. Basically I need to send several keystrokes to the game.

(keeping key stroke pressed for 5 seconds is too long)

For example, I want to do the following commands:

 

To do (left-> left-> change block position -> put it down)

I would need to press the left key, left key, up key, space bar.

 

Please teach me how to deal with this xD.

 

Copy and paste these commands into a macro:

<TEXT TYPE Action="0" Text="<ARROW LEFT>"/>
<DELAY Flags="\x02" Time="500"/>
<TEXT TYPE Action="0" Text="<ARROW LEFT>"/>
<DELAY Flags="\x02" Time="500"/>
<TEXT TYPE Action="0" Text="<ARROW UP>"/>
<DELAY Flags="\x02" Time="500"/>
<TEXT TYPE Action="0" Text="<SPACE>"/>

Make sure the window game has focus before running the macro.

I tested it on some online Tetris in Java and it works as expected. Time delays are added so you can see what's happening step by step.

Is that what you needed? And does it work with your game?

Link to comment
Share on other sites

Yes this is what I needed but it does work on my game.

Is there a way to hold the <ARROW LEFT> for 1 seconds?

If this can be done, I'll be on my next step to coordinate all the movements.

 

This command,

<TEXT TYPE Action="0" Text="<ARROW LEFT>"/>

only presses once very fast. I've tried putting several of these commands, but I need something more powerful and accurate.

 

Thank you again, Arek!

 

------------------------------------------------------------------

Link to comment
Share on other sites

Is there a way to hold the <ARROW LEFT> for 1 seconds?

It can't be done with the text type command.

I'm not a VB or Java programmer therefore I can't resort to it. I'd think there's a way to perform this using VB/Java script (inserted using External Script command in ME). If you know either of the languages you might give it a try.

That would be the easiest way I guess.

 

However, when I had to write some game macros that required a key pressed down for a period of time, I used a different approach. Pretty rough... but it worked.

I installed some customizable on-screen keyboard (similar to the one build into Windows). I was able to decrease it's size so it was reallly small and I was able to see the game window without any troubles.

 

Instead of using Text Type command if I wanted to press "Left arrow" button, I had my macro:

1. Move mouse over the Left Arrow position on the on-screen keyboard

2. Mouse button down

3. Delay 1 second

4. Mouse button up

This is akward, no doubt bout that, but if you don't know your way around Java or VBA, this might be the only way to simulate the key being pressed for a period of time.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...