Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to control an agent? #8

Open
and7ey opened this issue Jun 12, 2020 · 4 comments
Open

How to control an agent? #8

and7ey opened this issue Jun 12, 2020 · 4 comments
Labels
question Further information is requested

Comments

@and7ey
Copy link

and7ey commented Jun 12, 2020

I create an agent with the NewAgent command. It is created at the user's position.

  1. How could I teleport the agent to the user's position? The standard command tp @c doesn't work (looks like @c works at Education Edition only). Is there any way to kill and create the agent again?
  2. How could I give something to the agent? I tried replaceitem and give, but again it doesn't accept neither @c nor player.Agent. I was thinking about using the agent collect command (it works!), but I see no way to drop blocks near the agent.
@Sandertv
Copy link
Owner

This page may be useful: https://education.minecraft.net/wp-content/uploads/Code_Connection_API.pdf. It has an agent tptoplayer command and and an agent drop command.

@Sandertv Sandertv added the question Further information is requested label Jun 13, 2020
@and7ey
Copy link
Author

and7ey commented Jun 13, 2020

Thanks. I've read that document.

  1. agent tptoplayer doesn't work - it says 'tptoplayer' part is unknown (I use it with player.Exec() - is that right?). Upd. agent tp works :).
  2. agent drop drops the items, which is already in the agent's inventory. But I would like to add something to its inventory.

I am experimenting with the standard (non-education) edition of Minecraft. But the education edition option is enabled.

@Sandertv
Copy link
Owner

I don't think there is any way to give the agent items without actually dropping it to it, but I'm not entirely sure.

@and7ey
Copy link
Author

and7ey commented Jun 15, 2020

Thanks. Looks like the agent can build something without having blocks in its inventory. The following JS code works in Education Edition -

agent.setItem(RED_SAND, 1, 1)
agent.setAssist(PLACE_ON_MOVE, true)
agent.move(FORWARD, 1)

The question is how to perform the first command?
https://minecraft.makecode.com/reference/agent/set-item

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants