1.10.1 • Published 1 year ago

@mapeditor/tiled-api v1.10.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

tiled-api

This package includes TypeScript definitions for the Tiled scripting API which (depending on your editor support) also allow you to write simple JavaScript scripts with automatic code completion.

Online documentation

See: https://www.mapeditor.org/docs/scripting

Writing a Tiled plugin with code completion in VS Code

Create a new project:

mkdir example-tiled-ts-plugin
cd example-tiled-ts-plugin
npm init

Install the Tiled definitions:

npm install @mapeditor/tiled-api --save-dev

Write your plugin and enjoy code-completion:

/// <reference types="@mapeditor/tiled-api" />

const action = tiled.registerAction("CustomAction", function(action) {
    tiled.log(action.text + " was " + (action.checked ? "checked" : "unchecked"))
})

action.text = "My Custom Action"
action.checkable = true
action.shortcut = "Ctrl+K"

tiled.extendMenu("Edit", [
    { action: "CustomAction", before: "SelectAll" },
    { separator: true }
]);

Of course, when writing TypeScript code instead of JavaScript you also get compilation errors instead of only syntax highlighting.

1.10.1

1 year ago

1.10.0

1 year ago

1.9.2

2 years ago

1.8.2

2 years ago

1.8.1

2 years ago

1.8.0

2 years ago

1.6.0

3 years ago

1.6.0-beta

3 years ago

1.4.3-beta

3 years ago

1.4.3-alpha2

3 years ago

1.4.3-alpha

3 years ago