About the extended features

WorkAdventure features can be extended through the use of the scripting API.

This means anyone can write "scripts" that can be imported in any map and that add new properties to WorkAdventure. If you are a developer, do not hesitate to have a look at the scripting API and to create your own custom properties / features.

The WorkAdventure team also provides its own scripts that add various features. We put those features in a common package we call Scripting API Extra.

In this section, you will find a list of these extended features.

Importing the "extended features"

Because a script is hosting the extended features, you need to import that script explicitly into your map.

There are 2 ways to import those extended features:

  • importing the "Scripting API Extra" library directly in your map
  • or importing the "Scripting API Extra" library in your own script

Importing the script in the map

You can do so by adding a "script" property at the top level of your map, pointing to the URL: https://unpkg.com/@workadventure/scripting-api-extra@^1/dist/bundle.js

Importing the "Scripting API Extra" library using the "script" property.

Reminder: To access the map properties in Tiled, you can click on the Map > Map Properties menu.

Importing the "Scripting API Extra" library

If you already have a script in your map (this is the case if you are using the WorkAdventure Map Starter Kit), you can import the "Scripting API Extra" library as a "dependency" of your script.

Note: The WorkAdventure Map Starter Kit is already importing the Scripting API Extra library as a dependency.

npm install --save @workadventure/scripting-api-extra

Here, we assume that the script you wrote is using a bundler (like Webpack) and that you already have dependencies in your project using a package.json file. If you are not familiar with NPM, or bundlers, we highly recommend using the WorkAdventure Map Starter Kit that comes with sane defaults.

Once the "Scripting API Extra" library is imported, you still need to initialize it. This can be done by calling a single bootstrapExtra() method:

import { bootstrapExtra } from "@workadventure/scripting-api-extra";

// Calling bootstrapExtra will initiliaze all the "custom properties"  

Need some help?

WorkAdventure is a constantly evolving project and there is plenty of room for improvement regarding map editing.

If you are facing any troubles, do not hesitate to open an "issue" in the GitHub WorkAdventure account.

🔍 Found a typo? Want to propose improvements? Do not hesitate to directly propose changes.