Jump to content

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

Same key press initiates a new sequence cmd, in order, with the same key.


  • Please log in to reply
1 reply to this topic
allindal
  • Members
  • 1 posts
  • Last active: Feb 18 2014 10:34 PM
  • Joined: 18 Feb 2014

Hi,

 

I need to make a script that will toggle different keys in the "held/ down" position and then release them and immediatly press the new key and hold it until the next time, again and again.

 

Basically, i want to be able to press a key on my keyboard, lets say "numpad5" and I want the script to do these commands... lets say push and hold 1, than 2, than 3. , but only one at a time, when i push numpad5 and only numpad .

 

So to draw it out even more, I push numpad5 and in game, it simulates me pressing and holding 1, until I release numpad5, when it releases the 1 key. Then, I want to push numpad5 and in game it simlates me pressing the 2 key, and holding the 2 key until i release the numpad5.

 

I was thinking an if than/ else function like, but I don't think it needs to that complex since the sequence of commands will never change and is linear.

 Another way of attacking the problem would be to just re assign the numpad5 key a new "key binding" after the previous one has been pressed.

 

I'm attempting to simulate making music in a game, but by only pressing one key and having the notes play in order. I can make the sequence of notes, say 123234345456 for an arpeggio. so I push numpad5 when i want the next note to ring out.

 

Numpad5::
Send {1 down}
sleep 1000
send {1 up}
send {2 down}
sleep 1000
send {2 up}
send {3 down}
sleep 1000
Send {3 up}
 

This gives me sort of what I want, except that I don't want to initiate the entire sequence by pushing numpad5, i want it to for each new press of numpad5, but play the next note, or key binding.

 

 

 

 

 

 

 



Morpheus
  • Members
  • 475 posts
  • Last active: Oct 21 2014 11:08 AM
  • Joined: 31 Jul 2008

You should be able to do this using the hotkey command.


Any code that I post will be for AHK Basic.
I'm not always right, but I still try to help.