onCampaignLoad: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Edited note to be more precise and include more information.)
Line 2: Line 2:
'''• Introduced in version 1.3b51'''
'''• Introduced in version 1.3b51'''


A special macro that can be created on library tokens to have macro code automatically execute when a campaign is loaded. A campaign is considered to have been loaded if it is opened via the File menu, or upon connecting to a server running that campaign. All output from onCampaignLoad is discarded. This special macro is ideally suited for loading your defined functions via [[defineFunction|defineFunction()]].
A special macro that can be created on library tokens to have macro code automatically execute when a campaign is loaded. A campaign is considered to have been loaded if it is opened via the File menu, or upon connecting to a server running that campaign. All output from onCampaignLoad is discarded, when it is executed automatically. This special macro is ideally suited for loading your defined functions via [[defineFunction|defineFunction()]].
 
When onCampaignLoad is executed automatically, it is considered a [[Trusted Macro]]. If you wish to use trusted functions within 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.


===How to Create an onCampaignLoad Macro===
===How to Create an onCampaignLoad Macro===
You can create an onCampaignLoad macro on any library token; simply create a macro that is specifically named {{code|onCampaignLoad}}
You can create an onCampaignLoad macro on any library token; simply create a macro that is specifically named {{code|onCampaignLoad}}
Make sure on the Options tab, you uncheck "Allow Players to Edit Macro"


[[Category:Special Macro]]
[[Category:Special Macro]]

Revision as of 04:53, 28 May 2009

onCampaignLoad Macro

• Introduced in version 1.3b51

A special macro that can be created on library tokens to have macro code automatically execute when a campaign is loaded. A campaign is considered to have been loaded if it is opened via the File menu, or upon connecting to a server running that campaign. All output from onCampaignLoad is discarded, when it is executed automatically. This special macro is ideally suited for loading your defined functions via defineFunction().

When onCampaignLoad is executed automatically, it is considered a Trusted Macro. If you wish to use trusted functions within 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 Macros.

How to Create an onCampaignLoad Macro

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