onChangeMap: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 18: Line 18:
You can use {{code|macro.args}} to retrieve the following information from this event:
You can use {{code|macro.args}} to retrieve the following information from this event:


{{code|map ID}} map ID of the landing map
{{code|map ID}} map ID that's been changed to


[[Category:Special Macro]][[Category:Event]]
[[Category:Special Macro]][[Category:Event]]
[[Category:Macro Function]]
[[Category:Macro Function]]

Revision as of 19:42, 12 February 2024

• Introduced in version 1.14.0

This event is triggered whenever the map is changed.

Set up

A special macro that can be created on library tokens to have macro code automatically execute when the map is changed.

This special macro is ideally suited for setting parameters specific to the map you've changed to.

When an onChangeMap macro is executed automatically, it is considered a Trusted Macro. If you wish to use trusted functions within onChangeMap and execute it manually (e.g. while developing macros), you will have to make sure that it follows all of the rules of Trusted Macros.

How to Create an onChangeMap Macro

You can create an onChangeMap macro on any library token; simply create a macro that is specifically named onChangeMap.

The library token must have "Owner: All Players" unchecked, otherwise onChangeMap is not executed. To avoid permission issues with called functions, the onChangeMap macro should have "Options: Allow Players to Edit Macro" unchecked.

Variables Provided to onChangeMap Macro

You can use macro.args to retrieve the following information from this event:

map ID map ID that's been changed to