Dakutis, what do you mean by "not working"?
I tried your code by replacing gameShowTopScore() in the AC example, added some dummy calcScoreN() functions and it seems to be working. Or at least it does what it is told to do.
My quick check code looks like this:
- Code: Select all
function calcScore2() { return 20 }
function calcScore3() { return 30 }
function calcScore4() { return 40 }
function calcScore5() { return 50 }
function calcScore6() { return 60 }
function calcScore7() { return 70 }
function calcScore8() { return 80 }
function calcScore9() { return 90 }
function calcScore10() { return 100 }
function gameShowTopScore() {
var DayOfWeek = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
var Day; //must range from 0 to 6
var DayName;
Day = readVar("Day");
DayName = DayOfWeek[Day % 7];
var inStats = readVar(gInStats);
var numSetAchieves = CountSetAchieves();
var numMaxAchieves = CountMaxAchieves();
var score = calcScore();
var score2 = calcScore2();
var score3 = calcScore3();
var score4 = calcScore4();
var score5 = calcScore5();
var score6 = calcScore6();
var score7 = calcScore7();
var score8 = calcScore8();
var score9 = calcScore9();
var score10 = calcScore10();
var str = "Day " + score + " " + DayName +".| Time " + score2 +".00 | stat1 " + score4 + " | stat2 " + score5 + " | stat3 " + score6 +
" | stat4 " + score7 + " | stat5 " + score9 + " | stat6 " + score8 +" | stat7 " + score10 +" | $ " + score3 + " | ";
var gotoStats = "<br/><a onclick=\"GotoStatsPage('_stats.htm');\" href='#'>Go to Stats Page</a> ";
var stats = "You've earned " + numSetAchieves + " out of " + numMaxAchieves + " Achievements.";
if (inStats == 0)
{
outputScoreString(str + gotoStats);
}
else
{
outputScoreString(stats);
}
// Set the sizes of the bars to the left and right of the image.
var green = document.getElementById("green");
var red = document.getElementById("red");
if (green && red)
{
green.style.height = CalcBarHeight("happy") + "px";
red.style.height = CalcBarHeight("angry") + "px";
}
}
And it generates the following lines:
Day 0 Sun.| Time 20.00 | stat1 40 | stat2 50 | stat3 60 | stat4 70 | stat5 90 | stat6 80 | stat7 100 | $ 30 |
Go to Stats Page
Without seeing what each of your calcScore(), calcScore2(), etc functions do, I can't say for sure that the stat-line will be as you intended. And I'm assuming here that all of these calcScoreN() functions are correct.
For example I don't know if
calcScore() calculates the day-number or some other score, because you use
score to denote the number of the current day. This could simply be:
- Code: Select all
var score = Day + 1;
Also check that there are no duplicate calcScore() functions in _game.js
And in case your stat-page is not showing up then check if you have a '_stats.html' or a '_stats.htm' file - check the extension. In your code you reference a '_stats.html'.
Other than these, I can't think of anything.