onChangeMap: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Created page with "==onChangeMap Macro== '''• Introduced in version 1.14.0''' 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 {{code|onCampaignLoad}} and execute it...")
 
m (Added Languages tag)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
==onChangeMap Macro==
{{Languages|onChangeMap}}
'''• Introduced in version 1.14.0'''
'''• Introduced in version 1.14.0'''


This event is triggered whenever the map is changed.
Returns the {{code|map ID}}
== Set up ==
A special macro that can be created on [[Library_Token|library tokens]] to have macro code automatically execute when the map is changed.
A special macro that can be created on [[Library_Token|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.
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 {{code|onCampaignLoad}} and execute it manually (e.g. while developing macros), you will have to make sure that it follows all of the rules of [[Trusted Macro]]s.
When an onChangeMap macro is executed automatically, it is considered a [[Trusted Macro]]. If you wish to use trusted functions within {{code|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 Macro]]s.


===How to Create an onChangeMap Macro===
===How to Create an onChangeMap Macro===
Line 13: Line 18:
The library token must have "Owner: All Players" unchecked, otherwise {{code|onChangeMap}} is not executed. To avoid permission issues with called functions, the {{code|onChangeMap}} macro should have "Options: Allow Players to Edit Macro" unchecked.
The library token must have "Owner: All Players" unchecked, otherwise {{code|onChangeMap}} is not executed. To avoid permission issues with called functions, the {{code|onChangeMap}} macro should have "Options: Allow Players to Edit Macro" unchecked.


You can use {{code|macro.args}} to retrieve {{code|map ID}} map ID.


[[Category:Special Macro]][[Category:Event]]
[[Category:Special Macro]][[Category:Event]]
[[Category:Macro Function]]
[[Category:Macro Function]]
{{Languages|onChangeMap}}

Latest revision as of 23:59, 17 February 2024

Languages:  English  • 日本語

• Introduced in version 1.14.0

This event is triggered whenever the map is changed.

Returns the map ID

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.

You can use macro.args to retrieve map ID map ID.

Languages:  English  • 日本語