Hi everyone.
I'm here with a slightly odd question regarding using Apple Script to carry out timed commands on the Playstation Remote Play application in a game. There's a post from a few years ago with a similar problem I've been trying to use as a guide, but I need help getting the script to run. For context, I have no previous experience with programming, so I've been using guides online to help with no success.
The idea was to use Apple Script to carry out timed commands through the PS Remote Play app, which would trigger in my game. The game is Yakuza 0, and there's a baseball minigame with fairly precise timing that's hard for me to pull off. Here's a video of the game for reference.
While looking around online, I found a post about using scripts for this exact purpose, inspired by the post from this site I linked earlier. I copied the Apple Script code left in the comments and tried running it, and nothing happened. I start the code and then switch to the Remote Play window, and nothing happens. I experimented with changing "System Event" to "RemotePlay" in the code, thinking that would trigger it, but it doesn't make any difference.
Below is the code that is supposed to work with Yakuza 0's batting minigame.
All the code is meant to do is press x (or whatever the equivalent is on the keyboard through Remote Play) at a set time to hit the ball at the right time to pass the minigame. This post has the specific timings and an explanation of the Windows equivalent of the code.
I hope I have provided enough information to help solve this. As I've mentioned, the code I'm using is supposed to work, but I still need to get it to do something; it just runs in the background without doing anything in Remote Play like it's meant to.
I'm here with a slightly odd question regarding using Apple Script to carry out timed commands on the Playstation Remote Play application in a game. There's a post from a few years ago with a similar problem I've been trying to use as a guide, but I need help getting the script to run. For context, I have no previous experience with programming, so I've been using guides online to help with no success.
The idea was to use Apple Script to carry out timed commands through the PS Remote Play app, which would trigger in my game. The game is Yakuza 0, and there's a baseball minigame with fairly precise timing that's hard for me to pull off. Here's a video of the game for reference.
While looking around online, I found a post about using scripts for this exact purpose, inspired by the post from this site I linked earlier. I copied the Apple Script code left in the comments and tried running it, and nothing happened. I start the code and then switch to the Remote Play window, and nothing happens. I experimented with changing "System Event" to "RemotePlay" in the code, thinking that would trigger it, but it doesn't make any difference.
Below is the code that is supposed to work with Yakuza 0's batting minigame.
display dialog "Bring up your window where you want to play Baseball, you have 5 seconds to do so after pressing OK"
delay 5
if shiftKeyPressed() is true then exit repeat
tell application "System Events" to keystroke return
delay 5.2
tell application "System Events" to keystroke return
delay 5
tell application "System Events" to keystroke return
delay 5
tell application "System Events" to keystroke return
delay 7
tell application "System Events" to keystroke return
delay 5.248
tell application "System Events" to keystroke return
delay 5
tell application "System Events" to keystroke return
delay 5.1
tell application "System Events" to keystroke return
delay 5
tell application "System Events" to keystroke return
delay 5.72
tell application "System Events" to keystroke return
display dialog "Script Ended"
--Actual shift key detection below
use framework "Foundation"
use framework "AppKit"
on shiftKeyPressed()
set |DnS| to current application
set cMods to |DnS|'s class "NSEvent"'s modifierFlags()
return (cMods div (get |DnS|'s NSShiftKeyMask) mod 2 is 1)
end shiftKeyPressed
All the code is meant to do is press x (or whatever the equivalent is on the keyboard through Remote Play) at a set time to hit the ball at the right time to pass the minigame. This post has the specific timings and an explanation of the Windows equivalent of the code.
I hope I have provided enough information to help solve this. As I've mentioned, the code I'm using is supposed to work, but I still need to get it to do something; it just runs in the background without doing anything in Remote Play like it's meant to.