Wesnoth WML Wiki

InternalActionsWML

最終更新:

Bot(ページ名リンク)

- view
メンバー限定 登録/ログイン

InternalActionsWML


インターナルアクション (Internal actions)

Internal actions are actions that WML uses internally that do not directly affect gameplay, for example storing a variable.
インターナルアクションは、ゲームプレイには直接影響を及ぼさず、WMLが内部的に使うアクションで、例えば変数への格納があります。

The internal actions [if], [while], and [event] describe when/whether sets of actions should be executed.
インターナルアクション[if], [while], [event]はアクションがどういう条件でどういう時に実行されるのかを記述します。



[if]

Executes different sets of actions based on whether the conditions described in the condition tags are true or not.
条件タグ内で書かれた条件が真になるかどうかに基づいた、様々なアクションの集合を実行します。

Condition tags:
条件タグ:

  • [have_unit]: a unit passing this filter with >0 HP exists
    • StandardUnitFilter (almost... Note: does not check for matching units in the recall list)
  • [have_location]: a location passing this filter exists
  • [and]: If an [and] is present, all must evaluate to true in order for the [if] to evaluate true. Useful as a bracket for complex conditions, but not strictly necessary.
    • condition tags as in [if]: if these evaluate to true, [and] evaluates to true.
  • [or]: If an [or] is present, one must evaluate to true in order for the [if] to evaluate true. (Example)
    • condition tags as in [if]: if these evaluate to true, [or] evaluates to true.
  • [not]: If a [not] is present, none must evaluate to true in order for the [if] to evaluate true.
    • condition tags as in [if]: if these evaluate to true, [not] evaluates to false.
  • [and],[or],[not]: all top-level filters will support in-order conditional handling of and, or, and not. One important thing to remember is, if you have multiple [or]s, you should not wrap your first conditional statement into an [or] block.
(註:[and],[or],[not]の条件指定に関しては 記述例:AdvancedConditionalWML がわかりやすい。)
  • [variable]: tests something about the value of a WML variable (see VariablesWML)
  • [variable]: WML変数に関する何かのテストをします。(VariablesWML を参照)
    • name: the name of the variable to test the value of
Only one of the following keys should be used for comparing the value of the variable to another value:
    • equals: $name is equal (string wise) to this
    • not_equals: $name is not equal to this
    • greater_than: $name is numerically greater than this
    • less_than: $name is less than this
    • greater_than_equal_to: $name is not less than this
    • less_than_equal_to: $name is not greater than this
    • numerical_not_equals: $name is greater than or less than this
    • numerical_equals: $name is not greater than or less than this
    • boolean_equals: $name has the same boolean value (e.g. off, false, 0, no)
    • contains: $name contains this string
    • contains: $nameがこの文字列を含む
    • (Development version only) --boolean_not_equals: $name has not the same boolean value. Strictly a syntactic shortcut for the following syntax that served its absence in 1.4:

[not]
  [variable]
    name=...
    boolean_equals=...
  [/variable]
[/not]

After condition tags:
条件の後ろに書くタグ:

  • [then]: contains a set of action tags which should be executed if all conditions are true, or all conditions in any single [or] are true
  • [else]: contains a set of action tags which should be executed if any condition is false, and all [or] tags are false



[switch] (開発バージョンのみ(Development version only))

<<開発バージョンのみなのでひとまず省略>>



[while]

Executes commands if all conditions are true. Continues to execute them until a condition is not true.
全ての条件が真であれば、コマンド群を実行します。条件が偽になるまで、これは繰り返されます。

Executes a maximum of 1024 iterations per invocation. Condition tags are the same as for [if]
[while] が実行されるとき、最高で1024の繰り返しがなされます。条件タグは [if] と同じです。

After condition tags:
([while] の)後続のタグ:

  • [do]: contains actions that should be executed repeatedly until some condition is false.
  • [do]: 含まれるアクションは、条件が偽になるまで繰り返し実行されます。
The [while] tag is useful for iterating over an array. An array is a list of values. The numberth value in the array array is stored in the WML variable array[number]. Note that if number is the value of the variable variable, the expression $array[$variable] will return the numberth value in array. The macros 'FOREACH' and 'NEXT' (UtilWML) can be used to iterate over an array; i.e. run a set of actions once per element of the array.
[while] タグは配列のイテレートをするのに便利です。 配列は値群のリストです。arrayという配列内のnumber番目の値はWML変数 array[number] に格納されています。numbervariableという変数の値である場合、 配列のnumber番目の値を返すのには$array[$variable] と書くことに注意してください。 'FOREACH' および 'NEXT' マクロ(UtilWML)で配列のイテレートができます。例えば、配列の要素毎に何組かのアクションを実行させるなど。

{FOREACH}

If you wish to use a "for-each" iteration format (useful for example when you want to do an iteration for each row in a table) you can use the FOREACH and NEXT prededined macros.
"for-each"のイテレーションフォーマット(訳註:おそらくPerlのそれ。Ruby/Pythonで言えばfor)を使いたい場合、予め定義されているマクロ FOREACHNEXT を使うことができます。(例えば、
テーブルの列に対して繰り返し処理したい場合に便利です。)

{REPEAT}

You can use the REPEAT macro to perform a quick iteration for a number of times you specify.
指定した回数だけ繰り返すには、REPEAT マクロを使うことができます。

[event]

{This adds a new event to the scenario. The event is in the normal format for an [event] tag (See EventWML). This is useful if you want an event that can only be triggered when a prior event is fulfilled
These tags describe actions that affect the values of WML variables (see VariablesWML for information on WML variables, and UtilWML for convenient macro shortcuts for some of these):}
これは、シナリオに新しいイベントを追加します。イベントは [event] タグの標準書式を使って書かれます。(EventWMLを参照)これは先に起こるイベント条件が満たされたことをトリガーにして、イベントを実行させたい場合に便利です。
これらのタグはWML変数に影響を与えるアクションを表現します:(WML変数についてはVariableWMLを、また、それらのショートカットを書くのに便利なマクロについてはUtilWMLを参照)
  • [set_variable]: manipulates a WML variable. (Note: You can use the VARIABLE prededined macro to achieve the same result in a shorter format)
  • [set_variable]: WML変数を操作します。(注意:予め定義されている VARIABLE マクロを使えば、同じことをするのに短い記述ができます
  • name: the name of the variable to manipulate
  • name: 操作する変数の名前
  • value: set the variable to the given value (can be numeric or string). This only interprets dollars signs if it is the very first character, and then the entire value must be a simple variable name. (in 1.3.2, has the same effect as format. Use literal for no substitution)
  • value: 変数に与えられた値を設定します(値は数値か文字列)。これは一番最初の文字がドル記号($)の場合のみ評価され、そして全体の値は単純な変数名でなければなりません。(ver1.3.2においては、同じ効果の書式があります。置換しない場合はリテラルを(literal)を使ってください)
  • literal: set the variable to the given value (can be numeric or string). This does not interpret any dollars signs.}
  • literal: 変数に与えられた値を設定します。(値は数値か文字列)。これはすべてのドル記号($)を評価しません。<<翻訳途中>>
  • format: set the variable to the given value. Interprets the dollar sign to a higher degree than most actions. (see VariablesWML)
  • format: 変数に与えられた値を設定します。これはほとんどのアクションより多くドル記号($)を評価します。(VariablesWMLを参照)<<翻訳途中>>
  • to_variable: Fully processes its value as in format, and then gets the variable with that name.
  • add: add the given amount to the variable. To subtract, add a negative number.
  • add: 変数に与えられた数を加えます。減算するには、負の数値を加えます。
  • multiply: multiply the variable by the given number. To divide, multiply by the inverse eg: 4/2 = 4 * 1/2 = 4 * 0.5. To negate, multiply by -1. The result is an integer.
  • multiply: 与えられた数値で変数を乗算します。除算をする場合は逆数で乗算します。例:4/2 = 4 * 1/2 = 4 * 0.5。プラスマイナスを反転させる場合は -1 で乗算します。結果は整数になります。
  • divide: divide the variable by the given number. The result is an integer.
  • divide: 与えられた数値で除算します。結果は整数になります。(訳註:おそらく切り捨て除算)
  • modulo: returns the remainder of an integer division. Both variables need to be an integer, the result is also an integer. eg 5 % 2 = 1.
  • modulo: 整数で割った余りを返します。両方の変数は整数である必要があります。結果もまた整数になります。例:5 % 2 = 1。
  • random: the variable will be randomly set.
  • You may provide a comma separated list of possibilities, e.g. 'random=Bob,Bill,Bella'.
  • You may provide a range of numbers (integers), e.g. 'random=3..5'.
  • You may combine these, e.g. 'random=100,1..9', in which case there would be 1/10th chance of getting 100, just like for each of 1 to 9. Dollars signs are only normally interpreted here, so it is harder to have a dynamically determined range. You would need to create the random-string with format.
  • random: この変数はランダムに設定されます。設定可能なもののリストをコンマ区切りで指定することができます。例: 'random=Bob,Bill,Bella' 数値の範囲を指定することもできます。例: 'random=3..5' この2つを両方使って、'random=100,1..9'のようにすることができ、この場合1/10の確率で100になり、同じように1/10の確率で1〜9のどれかになります。ドル記号は通常通り解釈されるため、動的に決まる範囲を指定することは困難です。そういったものを使いたい場合は、formatでランダム文字列(random-string)を使うとよいでしょう。
  • rand: does the same as random, but has better MP support. See [BuildingMultiplayerExamples>http://www.wesnoth.org/wiki/BuildingMultiplayerExamples]] for more info on the MP case. It is highly recommended that you use this feature for randomization.
  • rand: これはrandomと同じですが、MPをよりよくサポートします。MPの場合についてのもっと詳しい情報はBuildingMultiplayerExamplesを見てください。ランダム化機能においては、これを使うことが強く推奨されます。

<<あとで続きを書く>>
ウィキ募集バナー