エージェントを指定した場所へテレポートさせる agent.teleport
ひとことで言うと
指定した方向、位置にエージェントをテレポートさせる。
ブロックとコード
エージェントを~0 ~0 ~0へ西向きにテレポートさせる
ブロックの文言は公式の日本語版に合わせています(形は簡易表示です)。
agent.teleport(pos(0, 0, 0), WEST)agent.teleport(pos(0, 0, 0), WEST)引数(ひきすう)
引数とは、ブロックの中で自分で選んだり入力したりする部分のことです。
| 名前 | 選べる値 | 意味 |
|---|---|---|
| pos | 座標 | エージェントをテレポートさせる位置 |
| dir | 方向 | テレポートさせられたエージェントが向く向きの四方位 |
使用例
Teleport the Agent 100 blocks up when the agentjump command is typed in the chat.
JavaScript
player.onChat("agentjump", function () {
agent.teleport(pos(0,100,0), WEST);
});Python
def on_on_chat():
agent.teleport(pos(0, 100, 0), WEST)
player.on_chat("agentjump", on_on_chat)Teleport the agent anywhere in two dimensions from the current location. The Agent goes to a random location 50 blocks North or South, and 50 blocks East or West. The agent moves when the sendagent command is typed in the chat.
JavaScript
player.onChat("sendagent", function () {
agent.teleport(randpos(
pos(-50, 0, 50),
pos(50, 0, -50)), NORTH);
});Python
def on_on_chat():
agent.teleport(randpos(pos(-50, 0, 50), pos(50, 0, -50)), NORTH)
player.on_chat("sendagent", on_on_chat)