Agent Wanderer

Random trail of blocks

The Agent randomly walks around leaving a trail of blocks.

Try the code:

let item = 0
player.onChat("wander", function () {
    agent.teleportToPlayer()
    agent.setItem(STONE, 50, 1)
    agent.setSlot(1)
    agent.setAssist(PLACE_ON_MOVE, true)
    agent.setAssist(DESTROY_OBSTACLES, true)
    for (let i = 0; i < 100; i++) {
        item = Math.randomRange(0, 10)
        if (item <= 1) {
            agent.turn(LEFT_TURN)
        } else if (item <= 3) {
            agent.turn(RIGHT_TURN)
        } else {
            agent.move(FORWARD, 1)
        }
    }
})