ID:155045
 
Ok I have a fully working score system but I need it to overwrite if you get a high score than our previuosly set highscore, but also not oerwrite if you don't. Think you could help me out?
var/deletescores = list("Score"="")// Delete the previous score field.
world.SetScores(src.key, list2params(deletescores))// Delete the previous score field.


Then right under that just add the new scores.

var/addscore = list("Score"=src.Score)
world.SetScores(src.key, list2params(addscore))


PS: Probably a more code-efficient way out there, but this'll work.
In response to A. Ness
I could delete a score but I want to know how to compare the new score to the old score and thenif the new one is higher overwrite the old one.

P.S. This is greatfisher's other account I forgot to change aftert testing something.
In response to A. Ness
mob/proc


Scores()
var/scores = world.GetScores(key,"High Score")
if(!scores)
var/highscore = list("High Score"="[src.score]")
world.SetScores("[src]",list2params(highscore))
if(scores)
var/list/params = params2list(scores)
if(params["Score"])
var/high_score = text2num(params["Score"])
if(src.score > high_score)
world.SetScores("[src]",list2params(score))


This is what I have and it doesn't work.
In response to GreatFisher
I fixed it :).