Access to the global grid configuration
Access to the lighting configuration
Access to the turn system
Add a custom action that appears in the global context menu (right click menu when not clicking on an object).
The name for the action in the context menu
The tooltip text to show for the custom action
An identifier passed to the onCustomAction event if you don't want to use the action name to identify what action is executed. If empty, the action name is used as identifier.
Add a drawn line to the table. Does not work if no table exists. Returns whether the line was added successfully. It can't be added if no table exists, if the DrawingLine is invalid, or if there are already too many lines drawn on the table and the new line would go beyond the limit.
Add a new global UI element in the world
The UI element to add
Add a new global UI element in the world
The UI element to add
Find all objects that would collide with a box
Center of the box
Dimensions of the box (from center to on of the corners)
Orientation of the box
Find all object hits with a box that is moved along a line, ordered by distance to start
Starting point of the box
End point of box movement
Dimensions of the box (from center to on of the corners)
Orientation of the box
Send a chat message to all players
Find all objects that would collide with a capsule
Center of the capsule
Dimensions of the capsule (from center to one of the corners of the surrounding box)
Orientation of the capsule
Find all objects hits with a capsule that is moved along a line, ordered by distance to start
Starting point of the capsule
End point of the capsule movement
Dimensions of the capsule
Orientation of the capsule
Clear the built-in JavaScript console. The same effect can be achieved by entering "clear()" in the console.
Create a new object from a JSON string
String containing Json representation of an object (can be obtained by calling toJSONString() on an object)
Starting position
Create a new object from a template
Template GUID for the new object
Starting position
Create a new object from a JSON string. Can create static objects or game objects.
String containing Json representation of an object (can be obtained by calling toJSONString() on an object)
Starting position
Create a new static object from a table template
Template GUID for the new table object
Starting position
Draw a box in 3d space. The box will only be visible on for the host!
The center of the box
Maximum point of the box
The rotation of the box
Color of the box. Alpha value is not used.
Amount of time in seconds to show the box. Can be 0 to show for one frame only.
Thickness of the lines. One pixel thick if 0, cm thickness for values > 0.
Draw a line in 3d space. The line will only be visible on for the host!
Starting point of the line
End point of the line
Color of the line. Alpha value is not used.
Amount of time in seconds to show the line. Can be 0 to show for one frame only
Thickness of the line. One pixel thick if 0, cm thickness for values > 0.
Draw a point. The point will only be visible on for the host!
Position of the point
Size of the point in cm
Color of the point. Alpha value is not used.
Amount of time in seconds to show the point. Can be 0 to show for one frame only.
Draw a point. The sphere will only be visible on for the host!
Position of the point
Color of the sphere. Alpha value is not used.
Amount of time in seconds to show the point. Can be 0 to show for one frame only.
Thickness of the lines. One pixel thick if 0, cm thickness for values > 0.
Get all labels currently in the game
Return all interactive objects currently in the game
If true, don't return objects in containers. Even when false, objects within lazy containers that haven't been loaded yet will never be returned. Use Container.getItems to load and return items in lazy containers. Default: false
Return all players currently in the game
Return all tables currently in the game
Return all tags that currently exist in the game
Get all zones currently in the game
Return all currently allowed packages
Return the filename of the current background. Empty string if no custom background is active.
Return the package id of the current background. Returns an empty string if no background is set.
Return all drawing lines on the object.
Return the time in seconds since the game session was started
Return the current gravity multiplier
Return the label with the specified id
Return the game object with the specified Id
The unique id of the object
Return an array of all currently used object group ids. Objects with the same group id are always picked up together.
Return an array of all objects with a given object group id.
The group id to query
Return all objects in the game with the specified template type
The template id to search for
Return the package with the specified id. Can return packages that are currently not allowed, but only finds packages that exist on the host.
Return the player with the given name
The name of the player
Return the player occupying the specified slot
The player slot (0-19)
Return data that was stored using setSavedData or loaded from a saved state.
Key for which to retrieve the data.
Return whether a message with results is shown whenever rolled dice come to rest
Return the color of a player slot.
The player slot (0-19)
Return the team (1-8) of a player slot. Returns 0 if the player slot is not associated to a team.
The player slot (0-19)
Return the Z coordinate of the table at a given point. Returns 0 if the point is outside of the table bounds. For many tables this will return the same values for the entire surface, but some tables (like the included Poker table) have more complex surface geometry.
The point where the table height should be evaluated. The Z coordinate of the Vector is ignored. Returns table height for the center of the map (0,0) if this parameter is not given.
Return the name of a template
Return the package id of a template
Return the zone with the specified id
Load a sound file from the Sounds folder of a package and store it in a sound object that can be played. Supports WAV, MP3, and FLAC files.
The filename of the sound
The id of the package that contains the sound file (in the Sounds folder). Can usually be empty when used from scripts to use the same package that contains the script file, but you need to explicitly pass refPackageId for the current package or a package id when you use it in a callback. You can find package ids in the manifest.json file in package folders. Usually you won't use this parameter, unless you have a specific reason to load a sound from a different package than where the script is located.
If true, load a new Sound even if a cached version already exists. Will take longer and take additional resources, only use if you need to play the same sound file multiple times at the same time. Default: false
Load a sound file from a web URL and store it in a sound object that can be played. Supports WAV, MP3, and FLAC files.
The URL from which to load the sound
If true, load a new Sound even if a cached version already exists. Will take longer and take additional resources, only use if you need to play the same sound file multiple times at the same time. Default: false
Load a text file from the Scripts folder of a package and return the text as string.
The filename of the text file
The id of the package that contains the text file (in the Scripts folder). Can usually be empty when used from scripts to use the same package that contains the script file, but you need to explicitly pass refPackageId for the current package or a package id when you use it in a callback. You can find package ids in the manifest.json file in package folders. Usually you won't use this parameter, unless you have a specific reason to load a text file from a different package than where the script is located.
Return whether the floor of the map is currently hidden.
Remove a custom action by identifier or name.
The identifier or name of the action to remove
Remove a drawn line at the given index from the table.
Remove a drawn line from the table.
Remove a global UI element.
The index of the UI element to remove
Remove a global UI element.
Remove a global UI element.
The index of the UI element to remove
Remove a global UI element.
Reset scripting environment and reload all scripts
Set the image shown as background of the map.
The filename of the image to load. Use an empty string to return to the default background for the map. Default: empty string.
The id of the package that contains the image file (in the Textures folder). Can usually be empty when used from scripts to use the same package that contains the script file, but you need to explicitly pass refPackageId for the current package or a package id when you use it in a callback. You can find package ids in the manifest.json file in package folders. Usually you won't use this parameter, unless you have a specific reason to load an image from a different package than where the script is located.
Set whether the floor of the map should be hidden. Persisted in saved states. Does not have an effect in 3D maps.
Set the gravity multiplier. 1 is standard gravity, 0 will disable gravity. Wakes up physics simulation for all objects that are not locked (for example because they are ground objects, or because the locked physics option is active)
The new gravity multiplier, between 0 and 2
Set the data that will stored in save game states. The data is available using getSavedData when the global
script is run after loading a save state. Try to keep this data small and don't change it frequently, it needs to
be sent over the network to all clients. A similar method exists for each game object:
GameObject.setSavedData.
If you want to use custom data that is not a string, you can encode it to JSON using JSON.stringify()
, and then
decode what you get from getSavedData using JSON.parse()
.
Data to store, maximum length 1023 characters
Key for the data. This works like a dictionary, you can store different data for each key
Replace a global UI element. Will not do anything if called with an index that doesn't have a UI element.
Set whether a message with results is shown whenever rolled dice come to rest
Set the color of a player slot
The player slot (0-19)
Set the team of a player slot
The player slot (0-19)
The new team for the slot. Use 0 to not associate the slot with a team.
Replace a global UI element. Will not do anything if called with an index that doesn't have a UI element.
Show a ping for all players, similar to when a player places a ping.
The position to ping
The color of the ping
If true, the ping sound will be played for all players
Find all objects that would collide with a sphere
Center of the sphere
Radius of the sphere
Find all objects hits with a sphere that is moved along a line, ordered by distance to start
Starting point of the sphere
End point of the sphere movement
Radius of the sphere
Start debug mode on the given port. You can use the Chrome DevTools or the Visual Studio Code debugger
to connect to the specified port and debug your scripts.
For example, with port 9229 (the default), open the following URL to open the DevTools:
devtools://devtools/bundled/inspector.html?v8only=true&ws=localhost:9229
For Visual Studio Code, add the following to your debug configurations:
{ "name": "Inspector", "type": "node", "protocol": "inspector", "request": "attach", "address": "localhost", "port": 9229 }
Update a global UI element. Will not do anything if called with a UI element that is not currently part of the global UI elements.
Update a global UI element. Will not do anything if called with a UI element that is not currently part of the global UI elements.
Used while executing the global script to determine why it was executed. Possible return values:
"ScriptReload" - The script was reloaded, for example because it was set in the session options, or because the scripting environment was reset
"StateLoad" - A game state that has the script set as global script was loaded
"" - If called at other times
The game world. Contains all global methods of the API. You don't create an instance of this class directly, instead use the world object that always exists.