Hi all,
I'm just learning to code. I'm trying to code my first game. I want to have resources gather over time. I have the math part figured out, and have a simple 'count up' timer, but I'm lost as to how they can be combined. I've looked on other forums and haven't found anyone with a similar issue. Any help would be highly appreciated.

Here's the code I'm working with:
<HTML>
<HEAD>
<label id="minutes">00</label>:<label id="seconds">00</label>
<script type="text/javascript">
var minutesLabel = document.getElementById("minutes");
var secondsLabel = document.getElementById("seconds");
var totalSeconds = 0;
setInterval(setTime, 1000);

function setTime()
{
++totalSeconds;
secondsLabel.innerHTML = pad(totalSeconds%60);
minutesLabel.innerHTML = pad(parseInt(totalSeconds/60));
}

function pad(val)
{
var valString = val + "";
if(valString.length < 2)
{
return "0" + valString;
}
else
{
return valString;
}
}
</script>
<br />
<SCRIPT>
c=2 * 500 ;
document.write('Coal = ');
document.write(c);
</SCRIPT>
<br />
<script>
w=3 ;
document.write('Wood = ');
document.write(w);
</script>
<br />
<SCRIPT>
e=2 * 500 ;
document.write('Electricity = ');
document.write(e);
</SCRIPT>
<br />
<script>
g=0 * 100
document.write('Gold = ');
document.write(g);
var tim = window.setTimeout("countToTen()", 1000); // increase count by 1 per second
</script>
<br />

</HEAD>
<body>
</body>
</body>
</HTML>