Map Building Admin User Developer Tutorials Login Get Started Search ctrl K
WorkAdventure APIs Map Scripting API Api Reference Map Editor API
Detecting when the user enters/leaves an area
Inbound API edited by the map editor
Map Scripting API Map Editor API Getting the list of all areas created in the map
editor
Variables
Currently, the map editor API provides a way to read the areas defined in the map editor and to detect when the user enters or leaves
Events
an area. It is "read-only". You cannot modify the map using this API.
Api Reference
We opted for a different approach to the event's detection of 'enter' and 'leave' zones when dealing with an area edited by the map
Camera
editor.
Chat
Controls
Event
Detecting when the user enters/leaves an area edited by the map
Map Editor API
editor
Metadata
[Link](name: string): Subscription
Navigation [Link](name: string): Subscription
Player
Listens to the position of the current user. The event is triggered when the user enters or leaves a given area.
Players
Room name: the name of the area defined in the map editor.
Sound
Example:
Start
State const myAreaEnterSubscriber = [Link]("myAreaName").subscribe(() => {
[Link]("Hello!", "Mr Robot");
UI
});
Deprecated Functions
const myAreaLeaveSubscriber = [Link]("myAreaName").subscribe(() => {
Extended utility functions [Link]("Goodbye!", "Mr Robot");
[Link]();
Scripting Internals
});
Using Typescript
// If you want to stop listening to the events at some point:
Map Storage API [Link]();
[Link]();
Room API
Getting the list of all areas created in the map editor
[Link](): MapEditorArea[]
Returns the list of all areas created in the map editor.
interface MapEditorArea {
name: string;
x: number;
y: number;
width: number;
height: number;
description: string|undefined;
searchable: boolean|undefined;
}
Example:
const areas = await [Link]();
for (const area of areas) {
[Link](`Area ${[Link]} at (${area.x}, ${area.y}) with width ${[Link]} and height ${[Link]}
}
Edit this page
Previous Next
« Event Metadata »
Docs Need help ? Follow us
Map Building Book a demo Linkedin
Admin Discord Twitter
Developer GitHub Facebook
Copyright © 2024 [Link] - All Rights Reserved