Crate tts_external_api

source ·
Expand description

A Rust implementation of the External Editor API for Tabletop Simulator.

This is intended to make it easier to write development tools and plugins intead of using the built-in script editor.

Communication between the editor and TTS occurs via two localhost TCP connections: one where TTS listens for messages and one where the ExternalEditorApi listens for messages. All communication messages are sent in JSON.

Quick Start

All messages are sent and recieved through the ExternalEditorApi struct. Creating the struct binds the TcpListener to port 39999. In order for messages to be sent, a game has to be loaded inside Tabletop Simulator.

use tts_external_api::ExternalEditorApi;

fn main() {
	let api = ExternalEditorApi::new();

    api.execute(String::from("print('Hello World')"))
        .expect("Can't connect. Is a save loaded?");
}

Re-exports

pub use crate::tcp::ExternalEditorApi;

Modules

In- and Outcoming messages
The TCP connection used for communication between the external API and Tabletop Simulator

Macros

Construct a serde_json::Value from a JSON literal.

Enums

Represents any valid JSON value.