Control Game
Key input
User keystrokes can be simulated through Gamium Client.
KeyBy allows you to specify the key input method.
You can use it as below.
- TypeScript
- Python
await gamium.sendKey(KeyBy.unityKeycode('Space'));
await gamium.sendKey(KeyBy.unityKeyboard('Space'));
gamium.send_key(KeyBy.unity_keycode('Space'));
gamium.end_key(KeyBy.unity_keyboard('Space'));
ActionChain
When manipulating the game through the Gamium Client, if you want to perform multiple actions continuously, you can use the Action Chain to perform the action at the most accurate time.
You can add multiple actions to ActionChain. When you call the performance() of ActionChain, the added actions are performed sequentially.
You can combine several actions as shown below.
Usage
- TypeScript
- Python
await gamium
.actions()
.move({ x: screen.width / 2, y: screen.height / 2 })
.click({ x: screen.width / 2, y: screen.height / 2 })
.perform();
await gamium
.actions()
.sendKeys([KeyBy.unityKeycode('W'), KeyBy.unityKeycode('A')])
.sendKeys([KeyBy.unityKeycode('Space')])
.perform();
gamium.actions()
.move(Vector2(screen.width / 2, screen.height / 2 ))
.click(Vector2(screen.width / 2, screen.height / 2 ))
.perform();
gamium.actions()
.send_keys([KeyBy.unity_keycode('W'), KeyBy.unity_keycode('A')])
.send_keys([KeyBy.unity_keycode('Space')])
.perform();