It's an interesting clue. I checked: the "gameWonCount" counter is only incremented once, when the game is virtually won.
Code: Select all
on game_new
...
put the seconds into BCA_GAME_STATUS["gameid"]
put 0 into BCA_GAME_STATUS["played"]
put -1 into BCA_GAME_STATUS["movestowin"]
put 0 into BCA_GAME_STATUS["movestowin"]
put 0 into BCA_GAME_STATUS["fixedmoves"]
statsUpdate "new"
end game_new
on game_won numCardsLeft // valeur négative, ou 0 (win effectif), ou nbre cartes restantes (win assuré)
put numCardsLeft into BCA_GAME_STATUS["movestowin"]
if (numCardsLeft = 0) then
if (userSettingsGet("prefs", "sounds") = 1) then get playSoundFile("Won.wav", "Sounds")
answer "<b><font size=18 color=#9C5D14>Congratulations</font><font size=18>, you win!</font></b><br><br> " with \
"OK" or "Quit" or "New Game" as sheet
if (it = "New Game") then
send "mouseUp" to btn "BtnNewGame"
else if (it = "Quit") then
quit
end if
else if (numCardsLeft > 0) then
showTip true, "The game will be won in" && numCardsLeft && "moves."
statsUpdate "won" // MAJ des stats (pas la peine de le refaire lors d'un win effectif)
game_won_effect true // visual effect
end if
end game_won
on statsUpdate event // "new", "won" ou "show"
put userSettingsGet("prefs", "stats") into arrStats
if (event = "new") then
------------------------------------------------------- new game
add 1 to arrStats["gameLaunchedCount"]
else if (event = "won") then
------------------------------------------------------- won game (virtual or effective)
----------------------------- stats générales
add statsIsPlayed() to arrStats["gamePlayedCount"]
add 1 to arrStats["gameWonCount"]
put (the number of elements in BCA_HISTO) + BCA_GAME_STATUS["fixedmoves"] + BCA_GAME_STATUS["movestowin"] into \
totalWinMoves
----------------------------- top scores
-------- check si ID game n'existe pas
local arrThisScore
put false into idExists
repeat for each element arrThisScore in arrStats["topScores"]
if (arrThisScore["gameid"] = BCA_GAME_STATUS["gameid"]) then
put true into idExists
exit repeat
end if
end repeat
if (not idExists) then // MAJ des top scores si ID game non trouvé dans les top scores
put 10 into maxLines // 10 lignes de top scores max
put "" into arrThisScore // ré-emploi
put $USER into arrThisScore["name"]
put BCA_GAME_STATUS["gameid"] into arrThisScore["gameid"]
put the seconds into arrThisScore["date"]
put arrThisScore into arrStats["topScores"][totalWinMoves]
put the keys of arrStats["topScores"] into theKeys
sort lines of theKeys ascending numeric
delete line (maxLines + 1) to (the number of lines in theKeys) of theKeys
local arrNewScores
repeat for each line tKey in theKeys
put arrStats["topScores"][tKey] into arrNewScores[tKey]
end repeat
put arrNewScores into arrStats["topScores"]
end if
else if (event = "show") then
------------------------------------------------------- show statistics (menu)
add statsIsPlayed() to arrStats["gamePlayedCount"]
end if
---------------------------------------------------------- update prefs user
userSettingsSet arrStats, "prefs", "stats"
end statsUpdate
function statsIsPlayed // renvoit 1 si jeu en cours, ou 0 si le jeu en cours n'est pas taggé "played"
if (the number of elements of BCA_HISTO > 0) then
if (BCA_GAME_STATUS["played"] <> BCA_GAME_STATUS["gameid"]) then
put BCA_GAME_STATUS["gameid"] into BCA_GAME_STATUS["played"] // flag pour non multiple updates du même jeu
return 1
end if
end if
return 0
end statsIsPlayed
Maybe the easiest way to solve this very strange behavior is to write a hotfix:
Code: Select all
if $USER = "Andreas" then divide gameWonCount by 8
EDIT: I have a new clue... stay tuned.