{"id":18276405,"url":"https://github.com/matanlurey/tts-editor","last_synced_at":"2025-04-05T03:31:34.050Z","repository":{"id":37007038,"uuid":"261030140","full_name":"matanlurey/tts-editor","owner":"matanlurey","description":"Node.js implementation of the External Editor API for Tabletop Simulator","archived":false,"fork":false,"pushed_at":"2023-02-11T11:35:35.000Z","size":757,"stargazers_count":7,"open_issues_count":4,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-20T21:42:01.088Z","etag":null,"topics":["editor","external-api","node-js","tabletop","tabletop-simulator","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matanlurey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-03T22:08:17.000Z","updated_at":"2024-08-04T09:11:56.000Z","dependencies_parsed_at":"2023-01-17T12:44:13.853Z","dependency_job_id":null,"html_url":"https://github.com/matanlurey/tts-editor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matanlurey%2Ftts-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matanlurey%2Ftts-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matanlurey%2Ftts-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matanlurey%2Ftts-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matanlurey","download_url":"https://codeload.github.com/matanlurey/tts-editor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284911,"owners_count":20913691,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["editor","external-api","node-js","tabletop","tabletop-simulator","typescript"],"created_at":"2024-11-05T12:15:58.768Z","updated_at":"2025-04-05T03:31:29.014Z","avatar_url":"https://github.com/matanlurey.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tts-editor\n\nA Node.js implementation of the [External Editor API][1] for Tabletop Simulator.\n\nThis is intended to make it easier to write development tools and plugins\nintead of using the built-in script editor or the [Official Atom Plugin][2] for\nTabletop Simulator. There are two classes provided by this API -\n[ExternalEditorApi](#externaleditorapi) and [TTSApiBackend](#ttsapibackend).\n\n## `ExternalEditorApi`\n\nThis is the client/server representing the _editor_. You can listen for\nconnections from an active instance of Tabletop Simulator, and send messages\nto an active instance.\n\n```ts\n(async () =\u003e {\n  // Create an API client and listen to incoming messages.\n  const api = new ExternalEditorApi();\n  await api.listen();\n\n  // You are now ready to send/receive messages.\n  await api.executeLuaCode('print(\"Hello, World\")');\n})();\n```\n\nYou can send four outgoing message types:\n\n### Get Lua Scripts\n\nhttps://api.tabletopsimulator.com/externaleditorapi/#get-lua-scripts\n\n```ts\nasync function getLuaScripts(api: ExternalEditorApi) {\n  const gameState = await api.getLuaScripts();\n  console.log(gameState);\n}\n```\n\n### Save \u0026 Play\n\nhttps://api.tabletopsimulator.com/externaleditorapi/#save-play\n\n```ts\nasync function saveAndPlay(api: ExternalEditorApi) {\n  const gameState = await api.saveAndPlay();\n  console.log(gameState);\n}\n```\n\n### Custom Message\n\nhttps://api.tabletopsimulator.com/externaleditorapi/#custom-message\n\n```ts\nasync function customMessage(api: ExternalEditorApi) {\n  await api.customMessage({\n    foo: 'Hello',\n    bar: 'World',\n  });\n}\n```\n\n### Execute Lua Script\n\nhttps://api.tabletopsimulator.com/externaleditorapi/#pushing-new-object\n\n```ts\nasync function executeLuaCode(api: ExternalEditorApi) {\n  await api.executeLuaCode('print(\"Hello, World\")');\n}\n```\n\n---\n\nYou can also listen to eight incoming message types:\n\n### Pushing New Object\n\nhttps://api.tabletopsimulator.com/externaleditorapi/#pushing-new-object\n\n```ts\nasync function pushingNewObject(api: ExternalEditorApi) {\n  const gameState = await api.once('pushingNewObject');\n  console.log(gameState);\n}\n```\n\n### Loading a New Game\n\nhttps://api.tabletopsimulator.com/externaleditorapi/#loading-a-new-game\n\n```ts\nasync function loadingANewGame(api: ExternalEditorApi) {\n  const gameState = await api.once('loadingANewGame');\n  console.log(gameState);\n}\n```\n\n### Print/Debug Messages\n\nhttps://api.tabletopsimulator.com/externaleditorapi/#printdebug-messages\n\n```ts\nasync function printDebugMessage(api: ExternalEditorApi) {\n  const debugMessage = await api.once('printDebugMessage');\n  console.log(debugMessage);\n}\n```\n\n### Error Messages\n\nhttps://api.tabletopsimulator.com/externaleditorapi/#error-messages\n\n```ts\nasync function errorMessage(api: ExternalEditorApi) {\n  const errorMessage = await api.once('errorMessage');\n  console.log(errorMessage);\n}\n```\n\n### Custom messages\n\nhttps://api.tabletopsimulator.com/externaleditorapi/#custom-messages\n\n```ts\nasync function customMessage(api: ExternalEditorApi) {\n  const customMessage = await api.once('customMessage');\n  console.log(customMessage);\n}\n```\n\n### Return messages\n\nhttps://api.tabletopsimulator.com/externaleditorapi/#return-messages\n\n```ts\nasync function returnMessage(api: ExternalEditorApi) {\n  const returnMessage = await api.once('returnMessage');\n  console.log(returnMessage);\n}\n```\n\n### Game Saved\n\nhttps://api.tabletopsimulator.com/externaleditorapi/#game-saved\n\n```ts\nasync function gameSaved(api: ExternalEditorApi) {\n  await api.once('gameSaved');\n}\n```\n\n### Object Created\n\nhttps://api.tabletopsimulator.com/externaleditorapi/#object-created\n\n```ts\nasync function objectCreated(api: ExternalEditorApi) {\n  const objectCreated = await api.once('objectCreated');\n  console.log(objectCreated);\n}\n```\n\n## `TTSApiBackend`\n\nA stub of the Tabletop Simulator server, or backend, is also provided to make\nit easier to test usages of the [`ExternalEditorApi`](#externaleditorapi)\nclient. For examples of use see `test/fake_tts_test.ts`.\n\n[1]: https://api.tabletopsimulator.com/externaleditorapi/\n[2]: https://api.tabletopsimulator.com/externaleditorapi/atom\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatanlurey%2Ftts-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatanlurey%2Ftts-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatanlurey%2Ftts-editor/lists"}