ta-client-api v0.4.0
TA Client API
Control TA programmatically with JavaScript.
npm install ta-client-api
Usage
import { GameClient } from 'ta-client-api';
// The path to your TA executable (can be relative or absolute).
const path = 'C:/path/to/TribesAscend.exe';
// Create a new game client instance.
const client = new GameClient(path);
Configuration
The easiest way to configure the client is through the chainable settings methods. Each method is optional and can be used in any order. For example, to launch the game in a 700px ⨯ 450px window:
client
.windowed(true) // Enable windowed mode.
.resolution(700, 450) // Set the resolution.
.start(); // Launch the game.
Or to connect directly to a game server:
import { Team } from 'ta-client-api';
client
.connect('example.wilderzone.live', 7777) // Specify the server address and port to connect to.
.team(Team.DiamondSword) // Join the Diamond Sword team.
.start(); // Launch the game.
All available settings:
| Setting | Options | Default | Works with (đšī¸ game mode | đī¸ server mode) | Description |
| :----------- | :------------------- | :----------------- | :---------- | :---------------------------------------------------- |
| custom
| argument
| None | đšī¸đī¸ | Pass a custom argument to the game client. |
| connect
| address
, port-number
| None, 7777
| đšī¸ | Connect to a game server. |
| debug
| true \| false
| false
| đšī¸đī¸ | Enable debugging output. |
| fullscreen
| true \| false
| true
| đšī¸ | Enable fullscreen mode. |
| host
| address
| None | đšī¸đī¸ | Use a specific host login server. |
| log
| path
| {cwd}/logs
| đšī¸đī¸ | Output log files. |
| map
| map-name
| None | đšī¸đī¸ | Launch directly into a particular map. |
| position
| number
, number
| 0
, 0
| đšī¸ | The position of the game window on the screen. This only takes effect in windowed mode. |
| resolution
| number
, number
| None | đšī¸ | The resolution of the game window. |
| server
| port-number
| 7777
| đī¸ | Start the game as a server. |
| splash
| true \| false
| true
| đšī¸ | Show the splash screen. |
| team
| 0 \| 1 \| 2 \| 255
| 255
| đšī¸ | The team to join. |
| windowed
| true \| false
| false
| đšī¸ | Enable windowed mode. |
Events
You can register callback functions to listen for certain events emitted by the game client.
For example, to log a message when the client starts:
client.on('start', () => {
console.log('Woohoo!');
});
Event | Description |
---|---|
start | Emitted when the game client has started up and is ready to be interacted with. |
stop | Emitted when the game client has stopped running (intentionally) and is no longer accessible. |
crash | Emitted when the game client has stopped running (from a crash) and is no longer accessible. |