@mapeditor/tiled-api
    TypeScript icon, indicating that this package has built-in type declarations

    1.6.0 • Public • Published

    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.

    Keywords

    none

    Install

    npm i @mapeditor/tiled-api

    DownloadsWeekly Downloads

    3

    Version

    1.6.0

    License

    MIT

    Unpacked Size

    78.7 kB

    Total Files

    5

    Last publish

    Collaborators

    • ablu
    • thorbjorn