Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

[assumed impossible] How to ControlSend arrow keys (held down for a period)


  • Please log in to reply
21 replies to this topic
MapleBish
  • Members
  • 64 posts
  • Last active: Mar 30 2015 12:47 AM
  • Joined: 05 Jun 2012

Update after years hahaha: so as far as I know (after thorough thorough experimentation), there is no possible way to controlsend held down arrowkeys to maplestory. My last theory was that since I controlSend to MapleStory, it only sends those commands to the foremost window and most likely, maple has some hidden windows (one of which presumably responds to the arrows). I'm still playing around with PID identification of all the maple windows and it's a pain cause PID changes after each restart of maple

 

 

Thanks for taking the time to read this.
When I was reading the tutorials, I didn't see anything about being able to controlsend a held down arrow key. Here is the part of the code I am trying to change:
I am able to use ControlSend for the other keys, but am not sure how to do it for the up and down arrow keys.

$-:: ; start the loop

htoggle := !htoggle

while (!htoggle) ; loop 6 times, approaching max number of times before anymore repetitions of the keystroke have no more effec

{



controlSend,,{pgup}, MapleStory ; hotkhey for hs (holy symbol the skill)

sleep 30000 ; wait 30 seconds till next cast

controlSend,,{pgup}, MapleStory ; hotkey for hs (holy symbol the skill)

sleep 30000 ; wait 30 seconds till next cast

controlSend,,{pgup}, MapleStory ; hotkey for hs (holy symbol the skill)

sleep 30000 ; wait 30 seconds till next cast

controlSend,,{pgup}, MapleStory ; hotkey for hs (holy symbol the skill)

sleep 30000 ; wait 30 seconds till next cast

controlSend,,{pgup}, MapleStory ; hotkey for hs (holy symbol the skill)

sleep 4000

controlSend,,{space}, MapleStory ; activate another skills which grants temporary invincibility and has 90s cooldown

sleep 2000

[color=#FF0000]Send {Down down}[/color] ; move character off rope to recast skills and reset limit

sleep 2000 ; estimated 3 seconds to move off rope

Send {down up} ; to stop holding down and prepare for recast

sleep 1000

ControlSend,,{pgup}, MapleStory ; hotkey for skill to recast and reset limit

sleep 4000 ; wait for cast animation to finish

Send {up down} ; press up key and hold to climb back up rope

sleep 1500 ; estimated time to get back to original position

Send {up up} ; release up key



}

return


0x150--ISO
  • Members
  • 657 posts
  • Last active: Apr 07 2012 09:06 PM
  • Joined: 01 Jan 2011
Try this
$-:: ; start the loop

htoggle := !htoggle

while (!htoggle) ; loop 6 times, approaching max number of times before anymore repetitions of the keystroke have no more effec

   {

   SetKeyDelay, 30000

   controlSend,,{pgup 4}, MapleStory ; hotkhey for hs (holy symbol the skill)

   SetKeyDelay, 4000

   controlSend,,{pgup}, MapleStory ; hotkey for hs (holy symbol the skill)

   SetKeyDelay, 2000

   ControlSend,,{space}{Down down}{Down up}, MapleStory

   SetKeyDelay, 1000

   ControlSend,,{pgup}, MapleStory ; hotkey for skill to recast and reset limit

   SetKeyDelay, 4000 ; wait for cast animation to finish

   ControlSend,, {up down}{up up} ; press up key and hold to climb back up rope

   }

return
Untested.

MapleBish
  • Members
  • 64 posts
  • Last active: Mar 30 2015 12:47 AM
  • Joined: 05 Jun 2012
Hmmm. Interesting. That certainly shortens the script a lot for easier reading. Thanks. Will test tomorrow and get back to you ASAP.

MapleBish
  • Members
  • 64 posts
  • Last active: Mar 30 2015 12:47 AM
  • Joined: 05 Jun 2012
Hi I tested several hours today. Everything but the arrow keys worked. I checked in word as well. The pg up keys worked but up up and down down failed. My only goal is to be able to control send those held down keys.

MapleBish
  • Members
  • 64 posts
  • Last active: Mar 30 2015 12:47 AM
  • Joined: 05 Jun 2012
Don't mean to selfishly bump this, but I've looked for any alternate methods and have been unsuccessful. Could anyone point me in a general direction.

0x150--ISO
  • Members
  • 657 posts
  • Last active: Apr 07 2012 09:06 PM
  • Joined: 01 Jan 2011
I'm unable to test this in your particular app but this example should tell you if the keys are being pressed and held.
#InstallKeybdHook
KeyHistory
SetKeyDelay, 1000 [color=#008000]; arbitrary number for test purposes only.[/color]
ControlSend,, {Down down}{Down up}, A [color=#008000]; remove this line or[/color]
Send, {Down down}{Down up} [color=#008000]; this line to test either command.[/color]
KeyHistory
Return
ESC::ExitApp	[color=#008000]; <-- Press escape to exit.[/color]
If one doesnt work use the other.

MapleBish
  • Members
  • 64 posts
  • Last active: Mar 30 2015 12:47 AM
  • Joined: 05 Jun 2012
Thank you sir, appreciate the help.

MapleBish
  • Members
  • 64 posts
  • Last active: Mar 30 2015 12:47 AM
  • Joined: 05 Jun 2012
Just tested it out. ControlSend one does not work. Send does work. But the problem is that the aim of my script is to be able to send a held-down arrow key when that window is minimized (aka I'm alt tabbed doing something else). Is there any possibility of being able to send a command to a minimized window to hold down an arrow key?

0x150--ISO
  • Members
  • 657 posts
  • Last active: Apr 07 2012 09:06 PM
  • Joined: 01 Jan 2011
Again its kind of hard to say as I don't have the app to test it on.
Maybe postmessage WM_KEYDOWN = 0x100, WM_KEYUP = 0x101 will work for you?
The only thing is the window would have to except these messages.

MapleBish
  • Members
  • 64 posts
  • Last active: Mar 30 2015 12:47 AM
  • Joined: 05 Jun 2012
Testing in word achieves the same purpose and using that key history script also works. The problem is whether there is anyway to send held down movement key to minimized window. Thanks for all the help, but many people have told me that what I'm looking for cant be done on this program D:

I will try this out and get back to you tomorrow. Thanks so much for sticking with me.

MapleBish
  • Members
  • 64 posts
  • Last active: Mar 30 2015 12:47 AM
  • Joined: 05 Jun 2012
Didn't work out sorry. Nothing happened when I tested in Word, or the game.
Just curious, if the arrow keys can be held down in Send (Send {up up}/{down down}), why is it that this function would not be included in ControlSend.

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
they should be working in controlsend as well.

how are you checking in word that it is working? I may be able to run the same test here.

MapleBish
  • Members
  • 64 posts
  • Last active: Mar 30 2015 12:47 AM
  • Joined: 05 Jun 2012
@Engunneer You're right. ControlSend does work for {down down} and {up down}, but I discovered the reason why in my script, they failed.
Here are two samples of the code I'm using to test in word:
In the 1st script, the held down key actually works because its in an infinite loop and therefore, will keep going down text in Word.

In the 2nd script, my problem is displayed. In my complete script, the ControlSend {down down} is followed by a Sleep 5000. I theorize that the down key is pressed once, then released due to "sleep". Is there a way to "hold" the controlSend command for 5 seconds (which would accomplish the same thing as sleep 5000 in my case)


$0:: ; start the loop
htoggle := !htoggle
while (!htoggle) ;

   {
   [color=#FF0000]controlSend, _WwG1,{down down}, Document1 - Microsoft Word [/color]
   }
return

; and


$-:: ; start the loop
htoggle := !htoggle
while (!htoggle) 

   {
  [color=#FF0000] controlSend, _WwG1,{down down}, Document1 - Microsoft Word ; 
   sleep 5000[/color]
   }
return


engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
sleep does not inherently release a key. at what point are you sending {down up} again? (down 'release')

my main point is asking what effect you are looking for in word. ControlSend holding down a key is not the same as you holding down a key, since when you hold down a key, you eventually start a auto-repeat.

in a game, it probably looks for the pressed state, but in something like word, it is looking for press events. Holding a physical key on your keyboard will generate multiple press events, while controlSend only sends the events specified, and does not trigger teh repeating effect.

MapleBish
  • Members
  • 64 posts
  • Last active: Mar 30 2015 12:47 AM
  • Joined: 05 Jun 2012
All right, so in the game, the point of the ControlSend command would be to hold down a certain arrow key to climb up/down a certain rope. So perhaps, I should try testing directly in the game rather than in Word? Is there anyway to proc the repeating effect in ControlSend?

Here is the related portion of the actual game script and the highlighted commands that I am currently trying to convert into ControlSend. I included descriptions of each command.

controlSend,,{space}, MapleStory ; activate another skills which grants temporary invincibility and has 90s cooldown
   sleep 500
   [color=#FF0000]Send {Up down} ; move character off rope to recast skills and reset limit[/color]
   sleep 1500 ; estimated 3 seconds to move off rope
[color=#FF0000]   Send {Up up} ; to stop holding down and prepare for recast[/color]
   sleep 500
   ControlSend,,{pgup}, MapleStory ; hotkey for skill to recast and reset limit
   sleep 2000 ; wait for cast animation to finish
 [color=#FF0000]  Send {down down} ; press up key and hold to climb back up rope[/color]
   sleep 1700 ; estimated time to get back to original position
[color=#FF0000]   Send {down up} ; release up key[/color]
   sleep 500