Item interaction from Python
I would like to use items directly from python code. To make it clearer, here is an example: if I would like to use BONE_MEAL
blocks.place(BONE_MEAL,world(0,0,0))
will throw an error, because BONE_MEAL is not a block that is "placable". On the otherhand, if you put BONE_MEAL in the inventory of your agent, he is able to place it:
agent.teleport_to_player()
agent.set_item(BONE_MEAL, 1, 1)
agent.place(FORWARD)
so... does anyone know if it is possible to place or use those items directly with python-code? Something like player.interact_item or sort of?
Best regards and thx for your help
-
Dealing with items is tricky because they persist for varying degrees of time, and have various properties. Can you give me a few more details of where you are going with this? For example, I do not believe you can get the agent to feed any animals.
To clarify, you are in Makecode Python. You don't throw an execution error, but the agent doesn't place the bone meal either, as far as I can see. (I get the whispered error - in the upper left corner, like you get when the agent runs out of blocks, or there is a block in the way.)
Maybe you are in a different environment? (those tricky details!) =]
0
Please sign in to leave a comment.
Comments
1 comment