メインコンテンツまでスキップ

Score マクロ

概要

Score マクロ は、スコアボードから値を取得するマクロです。
実行者のスコアを取得して、テキストとして使用できます。

構文

<!score=スコア名>

パラメータ

パラメータ説明
スコア名取得したいスコアボードのオブジェクト名

戻り値

指定されたスコアボードの値を返します。
スコアが設定されていない場合は、マクロがそのまま残ります。

使用例

所持金の表示

プレイヤーの所持金を表示します。

/execute as @a run scriptevent capi:actionbar 所持金: <!score=money>円

出力例:

所持金: 1000円

体力の表示

プレイヤーの体力を表示します。

/execute as @a run scriptevent capi:actionbar §c HP: <!score=capi:health> / 20

出力例:

HP: 18 / 20

renameでの使用

プレイヤー名の下に体力を表示します。

/execute as @a run scriptevent capi:rename <!name><!nl>§c HP: <!score=capi:health>

出力例:

Notch
HP: 20

レベル表示

プレイヤーのレベルを表示します。

/execute as @a run scriptevent capi:tell <!name>はレベル<!score=capi:level>です!

出力例:

Notchはレベル42です!

複数のスコアを表示

複数のステータスを同時に表示します。

/execute as @a run scriptevent capi:actionbar HP: <!score=capi:health> | LV: <!score=capi:level> | XP: <!score=capi:total_xp>

出力例:

HP: 20 | LV: 42 | XP: 1500

計算と組み合わせ

スコアを計算に使用します。

/execute as @a run scriptevent capi:actionbar 合計ダメージ: <!calc=<!score=attack>*<!score=multiplier>>

出力例:

合計ダメージ: 150

変数からの移行

以前の変数構文からマクロ構文への変更:

旧構文(変数)新構文(マクロ)
{score:money}<!score=money>
{score:Capi:health}<!score=capi:health>
移行のポイント

旧構文の {score:スコア名} は新構文の <!score=スコア名> に置き換えます。
コロン(:)がイコール(=)に変わることに注意してください。