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 instead 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 received 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§

messages
Incoming and Outgoing messages
tcp
The TCP connection used for communication between the external API and Tabletop Simulator

Macros§

json
Construct a serde_json::Value from a JSON literal.

Enums§

Value
Represents any valid JSON value.