0.4.0 â€ĸ Published 4 months ago

ta-client-api v0.4.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

TA Client API

npm version

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!');
});
EventDescription
startEmitted when the game client has started up and is ready to be interacted with.
stopEmitted when the game client has stopped running (intentionally) and is no longer accessible.
crashEmitted when the game client has stopped running (from a crash) and is no longer accessible.

References

0.3.0

4 months ago

0.4.0

4 months ago

0.3.1

4 months ago

0.2.0

4 months ago

0.1.0

4 months ago