Appreciate it halls. appologies on the above, but it frustrates me when people do that kind of thing.
it works... kinda lol.
but i have managed to alter it, because it was displaying minutes with decimals in :s
Code: Select all
var bufftimeEXP = <?php echo $EXPtime;?>;
var milisecEXP=0;
var minutesEXP = 0;
var secondsEXP=bufftimeEXP;
if (secondsEXP > 60)
{
minutesEXP = parseInt(secondsEXP / 60);
secondsEXP = secondsEXP % 60;
}
function displayEXP(){
if (minutesEXP < 1){
if(secondsEXP <=20){
document.counter.experience.style.color='red';
}
}
if (milisecEXP<=0){
milisecEXP=9
secondsEXP-=1
}
if (secondsEXP<=-1){
milisecEXP=0
secondsEXP+=1
}
if (secondsEXP<=0){
secondsEXP=60
minutesEXP-=1
}
if (secondsEXP < 60 && minutesEXP <= -1){
secondsEXP = 0;
minutesEXP = 0;
milisecEXP = 0;
}
else
milisecEXP-=1
if (secondsEXP < 10){
displaysecondsEXP = "0"+secondsEXP
} else if (secondsEXP > 9) {
displaysecondsEXP = secondsEXP
}
document.counter.experience.value=minutesEXP+":"+displaysecondsEXP
setTimeout("displayEXP()",100)
}
displayEXP()
whether what i have added in there (the parseInt part) which has caused the next problem, i dont know. but i cant seem to fix it lol.
when it hits 0:0 it goes to -1:60 and counts down again... then -2, -3 the list goes on lol. i have tried moving the if statements around, and no joy. i have tried killing off the timeout... no joy. i have become confused lol
also. a minor thing.... then the seconds reach less then 10, how to i add a 0 infront of the 9,8,7,6 etc and then have it removed when its a double figure?
ok i seem to have fixed the whole running into minus minutes problem. i added
if (secondsEXP < 60 && minutesEXP <= -1){
secondsEXP = 0;
minutesEXP = 0;
milisecEXP = 0;
}
which seems to have done the job. just a case of the missing 0 now -.-
edit again.
i have fixed the missing 0 ^^
damn im getting good @ this lol.
added this into the else conditional
if (secondsEXP < 10){
displaysecondsEXP = "0"+secondsEXP
} else if (secondsEXP > 9) {
displaysecondsEXP = secondsEXP
}
i am sure there are better ways of going about all this. but i dont care lol... i got it working. thts all i give a hoot about