対象としてコマンドを実行する mobs.execute
ひとことで言うと
他のターゲットとしてコマンドを実行します。
ブロックとコード
@sとして 位置~0 ~0 ~0で コマンド""を実行する
ブロックの文言は公式の日本語版に合わせています(形は簡易表示です)。
mobs.execute(
mobs.target(LOCAL_PLAYER),
pos(0, 0, 0),
""
)mobs.execute(mobs.target(LOCAL_PLAYER), pos(0, 0, 0), "")引数(ひきすう)
引数とは、ブロックの中で自分で選んだり入力したりする部分のことです。
| 名前 | 選べる値 | 意味 |
|---|---|---|
| target | ターゲットセレクター | どのエンティティがコマンドを実行するのかを決定するターゲットセレクター |
| position | 座標 | コマンドを実行する位置の座標 |
| command | 文字列 | 選択したターゲットが実行する完全なコマンド。たとえば:「say Hi!」 |
使用例
When the player types "ping" in the chat, all players reply with "pong".
JavaScript
player.onChat("ping", function () {
mobs.execute(
mobs.target(ALL_PLAYERS),
pos(0, 0, 0),
"say pong"
);
});Python
def on_on_chat():
mobs.execute(mobs.target(ALL_PLAYERS), pos(0, 0, 0), "say pong")
player.on_chat("ping", on_on_chat)