Ask coding questions

← Back to all posts
Automation Is Hard
AstrumDeorum (51)

Yes, hi, it's me again. I'm trying to figure out how to make the clickers increase your cookie count.
But I can't get anything to work.
I have some code in the actual js file now because that seems to be the only actual way to use setInterval().

Answered by InvisibleOne (2687) [earned 5 cycles]
View Answer
Comments
hotnewtop
InvisibleOne (2687)

Use a setInterval function

setInterval(function() {
cookies += clickers;
document.getElementById('cookieCount').innerHTML = cookies;
}, 1000)

You should be able to put that in your `<script>` tags inside your HTML file or in your js file and link it to the page. 
AstrumDeorum (51)

@InvisibleOne That worked.
It was a little weird at first, but I just had some things the wrong way.

InvisibleOne (2687)

Alright, let me know if you need any more help @AstrumDeorum

Bookie0 (5978)

Check this out! :) I think it responds to what you need.

AstrumDeorum (51)

@Bookie0 The answer there is a lot to unpack.
This is way more complicated than previously expected.