How to automate things?

title explains it all(im new to tmt)

Too simple

autoPrestige() {

return hasMilestone("otherLayer", 5) // Automatically resets if milestone 5 is owned

},

automate() {

// Loops through upgrades 11, 12, and 13

for (let x = 11; x <= 13; x++) {

    if (canAffordUpgrade("p", x) && !hasUpgrade("p", x)) {

        buyUpgrade("p", x)

    }

}

}

And

milestones: {

0: {

    requirementDescription: "100 Upgrade Points",

    effectDescription: "Automatically buy Buyable 11.",

    done() { return player\[this.layer\].points.gte(100) },

    // This function runs every tick

    automate() {

        if (canAffordBuyable("p", 11)) {

            buyBuyable("p", 11)

        }

}

}

}

All the examples

Got codes from Gemini, idk how to code but see if this works