Jump to content

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

is it possible to use arrow keys and other in a hotstring?


  • Please log in to reply
1 reply to this topic
bidomo
  • Members
  • 62 posts
  • Last active: Feb 04 2019 06:30 AM
  • Joined: 05 Feb 2009
Hi everyone!

I'm making my arcade cabinet, I'm using old ps/2 keyboard for the joysticks...

well, I don't want any kind of button to modify the configuration available, as I have tons of nephews and will screw it.

So, what I what I want to do (as I already soldered all together), is use some kind of contra flag code to send a TAB, so this way it would be possible to modify game configurations without using a keyboard.


I'm trying to achieve something like this:

:*?:UUDDLRLRBABARLRLDDUU::
send, {tab}
return

where
U is UP
D down
L left
R right
B second button first player (s)
A first button firts player (a itself)

could that be possible??

holding up a sequence could work too, and would do some digging in that direction too.

I didn't see so much escape sequences that could help as everything is almost in one piece.

Any help will be appreciated as always.




For curious people, i'm using:
old amd athlon xp 2000+
256 ram
geforce fx 5200 64mb
windows xp
it plays umk3! so I'm happy

MasterFocus
  • Moderators
  • 4323 posts
  • Last active: Jan 28 2016 01:38 AM
  • Joined: 08 Apr 2009
You could do something like this:
~Up::
~Down::
~Left::
~Right::
  AddAndCheckSequence(A_ThisHotkey)
Return

;================================
;================================

AddAndCheckSequence(input)
{

  static LastKeys, MaxLen := 30 ; max number of stored keys

  ; ---------------------------
  If ( input = "~Up" )
    input := "U"
  Else If ( input = ~Down )
    input := "D"
  ; etc ... insert all other "Else If"s here
  ; ---------------------------
  LastKeys := SubStr( LastKeys input , (-1)*(MaxLen-1) )
  ; ---------------------------
  Seq := "UUDDLRLRBABARLRLDDUU"
  If ( Seq == SubStr( LastKeys , (-1)*(StrLen(Seq)-1) ) )
    MsgBox Sequence found: %Seq%
  Seq := "UDLRABUUDDLRABAB"
  If ( Seq == SubStr( LastKeys , (-1)*(StrLen(Seq)-1) ) )
    MsgBox Sequence found: %Seq%
  ; copy and add any other sequences as desired
  ; ---------------------------
}

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

Antonio França -- git.io -- github.com -- ahk4.net -- sites.google.com -- ahkscript.org

Member of the AHK community since 08/Apr/2009. Moderator since mid-2012.