Agent Dig

The agent digging

The agent works hard for you!

Try the code:

player.onChat("come", function () {
    player.say("Hello Agent!")
    agent.teleportToPlayer()
})
player.onChat("dig", function (levels) {
    for (let i = 0; i < levels; i++) {
        for (let i = 0; i < 4; i++) {
            agent.move(FORWARD, 1)
            if (agent.detect(AgentDetection.Block, DOWN)) {
                agent.destroy(DOWN)
                agent.collectAll()
            }
            agent.turn(LEFT_TURN)
        }
        agent.move(DOWN, 1)
    }
})