Jump to content
LaunchBox Community Forums

I ask for help with the ahk script.


Soomin papa

Recommended Posts

 


I googled and found a suitable hotkey script for a standalone emulator.

Through it, I was able to apply functions such as save, load, and quit the emulator by combining the select button and other buttons in xbox 360 pad mode.

What I want is for the hotkey to work when another button is pressed while the select button is pressed, and most of them work the way I want them to.

 

However, when the select button and the RT button or LT button are combined, the action of pressing the trigger button while the select button is pressed has no response.

Conversely, pressing the select button while pressing the trigger button reacted.

What I want to do is to do the sequence of pressing the trigger button while the select button is pressed.

I want to create a motion that moves to the next save slot with the Select+RT button combination and the previous save slot with the Select+LT button combination.

Attached here is the ahk script I got from Googling.

I applied this script to the pcsx2 emulator and it helped me to make the hotkey work.

Here, I would like to modify the operation order of the select button and trigger button as I want.

 

Joy5::
Joy6::
Joy7::
{
    GetKeyState, SelectButton, Joy7
    GetKeyState, L1Button, Joy5
    GetKeyState, R1Button, Joy6
    GetKeyState JoyZButtons, JoyZ
    JoyZButtons := Round(JoyZButtons)

    if (SelectButton = "D")
    {
        if (L1Button = "D")
        {
            ; Load state
            SendInput {F3}
        }
        else if (R1Button = "D")
        {
            ; Save state
            SendInput {F1}
        }

        else if (JoyZButtons > 60)
        {
            ; Prev slot
            SendInput !{F2}
        }
        else if (JoyZButtons  < 40)
        {
            ; Next slot
            SendInput {F2}
        }
    }
}

Link to comment
Share on other sites

11 hours ago, Soomin papa said:

What I want to do is to do the sequence of pressing the trigger button while the select button is pressed.

Z-triggers are an animal of their own and require special attention.  It probably could be cleaned up a bit, but I think this gives you what you're trying to do.

Joy5::
Joy6::
Joy7::
Press=
SetTimer, WatchAxis, 5
return

WatchAxis:
{
   GetKeyState, SelectButton, Joy7
   GetKeyState, L1Button, Joy5
   GetKeyState, R1Button, Joy6
   GetKeyState JoyZButtons, JoyZ
   JoyZButtons := Round(JoyZButtons)
   PressPrev= %Press% 
   
   if (SelectButton = "D")
   {
      if (L1Button = "D")
      {
         ; Load state
         Press=L1
         if Press= %PressPrev%
            return
         SendInput {F3}
         Sleep 750
         
      }
      else if (R1Button = "D")
      {
         ; Save state
         Press=R1
         if Press= %PressPrev%
            return
         SendInput {F1}
         Sleep 750
      }
      
      else if (JoyZButtons > 60)
      {
         ; Prev slot
         Press=LZ
         if Press= %PressPrev%
            return
         SendInput !{F2}
         Sleep 750
         Press=
      }
      else if (JoyZButtons < 40)
      {
         ; Next slot
         Press=RZ
         if Press= %PressPrev%
            return
         SendInput {F2}
         Sleep 750
         Press=
      }
   }
}

 

Link to comment
Share on other sites

Thank you very much, JoeViking245. You saved me. 😀 I modified the script you made and succeeded in working as I wanted. I put my script here for anyone who needs it.

 

Joy5::
Joy6::
Joy7::
Joy8::
Press=
SetTimer, WatchAxis, 5
return

WatchAxis:
{
    GetKeyState, SelectButton, Joy7
           GetKeyState, StartButton, Joy8
    GetKeyState, L1Button, Joy5
    GetKeyState, R1Button, Joy6
    GetKeyState JoyZButtons, JoyZ
    JoyZButtons := Round(JoyZButtons)
           PressPrev= %Press% 
           PressNext= %Press% 

    if (SelectButton = "D")
    {
        if (L1Button = "D")
        {
            ; Load state
            SendInput {F3}
                                  Sleep 750
        }
        else if (R1Button = "D")
        {
            ; Save state
            SendInput {F1}
                                  Sleep 750
        }
        else if (JoyZButtons > 60)
                      {
                                ; Prev slot
                                Press=LZ
                                if Press= %PressPrev%
                                return
                                SendInput, {Shift down}{F2 down}
                                Sleep 750
                                SendInput, {F2 up}{Shift up}
                                Press=
                      }
                      else if (JoyZButtons < 40)
                      {
                                 ; Next slot
                                 Press=RZ
                                 if Press= %PressNext%
                                 return
                                 SendInput {F2}
                                 Sleep 750
                                 Press=
                      }
                      else if (StartButton = "D")
                      {
                                  ; This section closes PCSX2 when pressing Escape
                                  WinClose, ahk_exe {{{StartupEXE}}}
                      }
    }
}

 

 

 

Edited by Soomin papa
  • Game On 1
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

×
×
  • Create New...