- Write automated scripts for console games
Supported Devices:video_game: | Xbox One X | Xbox Series X | PlayStation 4 | PlayStation 5 |
---|---|---|---|---|
Test Result |
✅ | ✅ | ❓ | ✅ |
- You need a PC, an Xbox (or PS5, PS4)
- The idea is to stream an Xbox (or PS5) on a PC over a local area network, and then use the software to send virtual gamepad signals to a streaming window on the PC
- Install the virtual gamepad driver ViGEmBusSetup.msi in the Drivers directory
- Run Xbox.exe (or PS Remote Play.exe) to stream your Xbox (or PS5).
- Configure config.ini and set the GamepadType parameter
- Xbox:GamepadType=0
- PlayStation:GamepadType=1
- Run AutomaticGamepad.exe
- Select the script you want to run, confirm that the window binding is successful, set the number of times to run, and finally click Start
- The scripting language is JavaScript
- The script file suffix is .ag
- Place the script file in the same directory as the current program, and click Refresh in the program to view it
// Put the program to sleep for a while
void sleep(double milliseconds)
- milliseconds:sleep time
// The delay after a method is called. For example, call button(), dpad()
void setdelay(double delay)
- delay:delay time(milliseconds)
// Press button
// For example, press LB button, or L1 button
void button(string name, double duration = 200)
- name:Button Key Name
- duration:Duration of the press. The default value is 200 ms
// Press the DPAD button
// For example, press the up button of the DPad
void dpad(string name, double duration = 200)
- name:DPad Key Name
- duration:Duration of the press. The default value is 200 ms
// Press the trigger
// For example, press LT or RT, L1 or R1
void trigger(string name, double val, double duration = 200)
- name:Trigger Key Name
- val:Trigger press value, range is [0, 1], full press is 1
- duration:Duration of the press. The default value is 200 ms
// Push the single axis of the joystick
// For example, push the X-axis or Y-axis of the left joystick, or push the X-axis or Y-axis of the right joystick
void axis(string name, double val, double duration = 200)
- name:Axis Key Name
- val:The joystick push value, the range is [-1, 1], the lower left is -1, and the upper right is 1
- duration:Duration of the press. The default value is 200 ms
// Push the two axes of the joystick
void axis2(string name1, string name2, double val1, double val2, double duration = 200)
- name1:Axis Key Name
- name2:Axis Key Name
- val1:The joystick push value, the range is [-1, 1], the lower left is -1, and the upper right is 1
- val2:The joystick push value, the range is [-1, 1], the lower left is -1, and the upper right is 1
- duration:Duration of the press. The default value is 200 ms
// Press or release the button
void buttonstate(string name, bool state)
- name:Button Key Name
- state::press is true, release is false
// Press or release the dpad button
void dpadstate(string name, bool state)
- name:DPad Key Name
- state::press is true, release is false
// Press or release the trigger
void triggerstate(string name, double val)
- name:Trigger Key Name
- val:Trigger press value, range is [0, 1], full press is 1
// Push the single axis of the joystick
void axisstate(string name, double val)
- name:Axis Key Name
- val:The joystick push value, the range is [-1, 1], the lower left is -1, and the upper right is 1
// Push the two axes of the joystick
void axis2state(string name1, string name2, double val1, double val2)
- name1:Axis Key Name
- name2:Axis Key Name
- val1:The joystick push value, the range is [-1, 1], the lower left is -1, and the upper right is 1
- val2:The joystick push value, the range is [-1, 1], the lower left is -1, and the upper right is 1
- Xbox:XboxGamepad.cs
- PlayStation:PlaystationGamepad.cs
Xbox | PlayStation | ||
---|---|---|---|
A Button | "a" | △ Button | ”b1“ |
B Button | "b" | ○ Button | "b2" |
X Button | "x" | X Button | "b3" |
Y Button | "y" | □ Button | "b4" |
Left Bumper | "lb" | L1 Button | "l1" |
Right Bumper | "rb" | R1 Button | "r1" |
Left Stick Button | "lsb" | Left Stick Button | "l3" |
Right Stick Button | "rsb" | Right Stick Button | "r3" |
Menu Button | "menu" | Share Button | "share" |
View Button | "view" | Option Button | "option" |
XBOX Button | "home" | PS Button | "home" |
Touchpad Button | "touchpad" |
Xbox & PlayStation | |
---|---|
Up key | "up" |
Down key | "down" |
Left Key | "left" |
Right Key | "right" |
Xbox | PlayStation | ||
---|---|---|---|
Left Trigger | "lt" | L2 Key | "l2" |
Right Trigger | "rt" | R2 Key | "r2" |
Xbox & PlayStation | |
---|---|
X-axis of left joystick | "lsx" |
Y-axis of left joystick | "lsy" |
X-axis of right joystick | "rsx" |
Y-axis of left joystick | "rsy" |
// For example (XBOX)
// 1. Go to the ’Palace Approach Ledge Road‘ Site of Grace
// 2. Please two-hand your equipped 'Sacred Sword Relic' weapon
// 3. Finally, please follow the ‘Usage’ steps
// Go to the Site of Grace
button("view")
button("y")
button("a")
button("a")
// Wait for the map to finish loading
sleep(5500)
// Move to the front left
axis2("lsx", "lsy", -0.31, 1, 5200)
// Cast weapons skill
trigger("lt", 1)
// wait for the monsters to die
sleep(5000)