GameOver()
src << output("Game over! Final Score: [src.Score].","Chat")
if(Score == 63)
switch(Mode)
if("Casual")
world.SetMedal("Ace of the Board",src)
if("Classic")
world.SetMedal("Experienced Traveler",src)
switch(Mode)
if("Casual")
var/result = world.GetScores(src.key,"Score")
if(isnull(result))
var/list/params = list("Score"="[src.Score]")
world.SetScores("[src.key]",list2params(params))
else // Got here
var/X = text2num(result)
src << output("[result]","Chat")
src << output("[X]: It works","Chat")
if(X < src.Score)
var/list/params = list("Score"="[src.Score]")
world.SetScores("[src.key]",list2params(params))
Problem description:
Okay, so Masterdarwin noted that my scores updates incorrectly in The Knight. I've tried fixing it, and this is what I came up with. It doesn't work. My debugging lines are showing, only the second one "[X]" is shown as null (or just lack of text?) What am I doing wrong?
First, you need to check that result is not null (give a warning or something if it is). If it's not, then run params2list() on result. Now you can check if the key "Score" has a value and if it's less than the current score. Then if the score should be updated, use SetScores().
I would do it like this: