Eternity Angel
10-02-2002, 07:10 PM
I am absolutely PUZZLED as to what exactly is going wrong..
I have a button, it simply calls a function, that function being:
function exploring(valued)
{
if (paused == "yes") {
return;
}
if (gameon == "no") {
return;
}
var random = valued*100;
if (random > money) {
alert('You do not have enough Gold to explore '+valued+' Land');
return;
}
random = (valued*20)+100;
if (random > popu) {
alert('You do not have enough Population to explore '+valued+' Land');
return;
}
money = money-(valued*100);
popu = popu-(valued*20);
gold.innerHTML = money;
pop.innerHTML = popu;
if (currexplore == 0) {
currexplore = valued;
currexplorenum = valued*5;
setTimeout("explorer();",1000);
} else {
currexplore = currexplore+valued;
currexplorenum = currexplorenum+(valued*5);
}
edes.innerHTML = currexplore;
erem.innerHTML = currexplorenum;
}
Now, with a whole wack of confusing stuff there, seep through it to the:
if (currexplore == 0) {
currexplore = valued;
currexplorenum = valued*5;
setTimeout("explorer();",1000);
} else {
currexplore = currexplore+valued;
currexplorenum = currexplorenum+(valued*5);
}
Now, what happens is, instead of doing currexplore + valued (which should equal 2 if it already equals one, and you add one [valued]) it does it as if it was a string, it prints out "11" instead of "2". I have NO clue why it is doing this, and it is annoying the heck out of me...
I am guessing it thinks either that currexplore is a string, and not a number, or that valued is...
The button that calls this function is:
<input class="buttons" onfocus="this.blur();" type=button onclick="exploring(building.expnum.value);" value="Explore" name="toexplore">
But I do not think there is anything wrong with the button..
I have a button, it simply calls a function, that function being:
function exploring(valued)
{
if (paused == "yes") {
return;
}
if (gameon == "no") {
return;
}
var random = valued*100;
if (random > money) {
alert('You do not have enough Gold to explore '+valued+' Land');
return;
}
random = (valued*20)+100;
if (random > popu) {
alert('You do not have enough Population to explore '+valued+' Land');
return;
}
money = money-(valued*100);
popu = popu-(valued*20);
gold.innerHTML = money;
pop.innerHTML = popu;
if (currexplore == 0) {
currexplore = valued;
currexplorenum = valued*5;
setTimeout("explorer();",1000);
} else {
currexplore = currexplore+valued;
currexplorenum = currexplorenum+(valued*5);
}
edes.innerHTML = currexplore;
erem.innerHTML = currexplorenum;
}
Now, with a whole wack of confusing stuff there, seep through it to the:
if (currexplore == 0) {
currexplore = valued;
currexplorenum = valued*5;
setTimeout("explorer();",1000);
} else {
currexplore = currexplore+valued;
currexplorenum = currexplorenum+(valued*5);
}
Now, what happens is, instead of doing currexplore + valued (which should equal 2 if it already equals one, and you add one [valued]) it does it as if it was a string, it prints out "11" instead of "2". I have NO clue why it is doing this, and it is annoying the heck out of me...
I am guessing it thinks either that currexplore is a string, and not a number, or that valued is...
The button that calls this function is:
<input class="buttons" onfocus="this.blur();" type=button onclick="exploring(building.expnum.value);" value="Explore" name="toexplore">
But I do not think there is anything wrong with the button..