onCampaignLoad/ja

From RPTools Wiki
Revision as of 08:12, 16 February 2024 by Fourwoods (talk | contribs) (Created page with "{{Languages|onCampaignLoad}} ==onCampaignLoad Macro== '''• バージョン1.3b51より導入''' <div style="color:gray">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 an {{code|onCampaignLoad}} macro is discarded, when it is exec...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Languages:  English  • 日本語

onCampaignLoad Macro

• バージョン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 an onCampaignLoad macro is discarded, when it is executed automatically.

ライブラリートークン上に作成可能な特殊マクロであり、キャンペーン読込完了時に自動的に実行される。キャンペーンがファイルメニューから開かれた場合や、そのキャンペーンを実行しているサーバーに接続した場合に、読込されたと見做される。このマクロが自動的に実行された場合、onCampaignLoad マクロからの全ての出力は破棄される。

This special macro is ideally suited for loading your User Defined Functions (UDFs) via defineFunction().

この特殊マクロは、君のユーザー定義関数を defineFunction() を通して読込むのに理想的な方法である。

When an onCampaignLoad macro 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.

onCampaignLoad マクロが自動的に実行された場合、これは信頼済みマクロとして扱われる。onCampaignLoad の中で信頼済み関数を使い、手動で実行する事を望むのであれば(開発中のマクロなどで)、信頼済みマクロの規則に全て従わなければならない。

onCampaignLoad マクロの作り方

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

任意のライブラリートークン上onCampaignLoad マクロを作る事ができる; 単に固有のマクロ名称である onCampaignLoad を名付けてマクロを作成するだけだ。

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

このライブラリートークンは『所有権:全プレイヤー』のチェックを外さなければならず、そうしなければ onCampaignLoad は実行されない。関数呼び出しに伴う権限の問題を避けるため、onCampaignLoad の『オプション:プレイヤーマクロ編集の許可』のチェックは外しておくべきだろう。

制限事項

  • Do not make changes within the onCampaignLoad macro to the library token it resides upon. This is not supported by MapTool. A duplicate lib token can/will appear and this will/can break stuff.
  • Some macro functions may not work as expected if run in onCampaignLoad without deferring their execution by using the defer option of execLink().
  • onCampaignLoad マクロ内で、それ自身が存在するライブラリートークンに変更を加えない事。これは MapToolによってサポートされていない。重複したlibトークンが現れる可能性があり、それにより何かを破壊する可能性がある。
  • いくつかのマクロ関数は、execLink() の defer オプションを使って実行を遅延させる事なく onCampaignLoad 上で実行させると、期待通りに動作しない恐れがある。
    • このため、goto()setZoom()、および同様の関数呼び出しは、execLink() を介して呼び出される別のマクロに配置する必要がある。

関数遅延呼び出しの例

Inside the onCampaignLoad macro place code like this:

onCampaignLoad マクロ内に下記のようなコードを記述:

[h: link = macroLinkText("deferredCalls@"+getMacroLocation())]
[h: execLink(link,1)]
And in the deferredCalls() macro place the functions to be deferred.

そして、deferredCalls() マクロの中に、遅延させる関数を配置する。

[h: goto("2")]
[h: setZoom(2)]