ID:158981
 
Well, I suppose it's my fault really, but I have scores set for people on my hub in the format charactername(key) and recently required the wiping of save files due to a huge change/update. Now I haven't stored these names anywhere to remove them individually with a system, so I was wondering if there's possibly some way of using SetScores() to remove the whole list versus just one key at a time.

I currently remedy this by hiding the old scores and simply using new names for them. But I don't get that clean feeling inside when I do it.
var/hubkeys=params2list(world.GetScores())
var/delscoreplz[0]
delscoreplz["field name"]=null
delscoreplz=list2params(delscoreplz)
for(var/key in hubkeys)
world.SetScore(key,delscoreplz)

You need to null every single field associated with each key on the scoreboard so it gets removed.
In response to Ruben7
Ruben7 wrote:
var/hubkeys=params2list(world.GetScores())
> var/delscoreplz[0]
> delscoreplz["field name"]=null
> delscoreplz=list2params(delscoreplz)
> for(var/key in hubkeys)
> world.SetScore(key,delscoreplz)

You need to null every single field associated with each key on the scoreboard so it gets removed.

The "field name" portion would include the key then?

Because the way it is currently is Buster(Bustercannon).

name(key)

So I suppose I would need to include a findtext() correct?
In response to Bustercannon
Not the name field, every other one.

Just try running this verb:
mob/verb/DeleteScores()
var/hubkeys=params2list(world.GetScores())
var/delscoreplz[0]
delscoreplz["Levels"]=null
delscoreplz["Kill Rank"]=null
delscoreplz["Tournament Victory"]=null
delscoreplz=list2params(delscoreplz)
for(var/key in hubkeys)
world.SetScore(key,delscoreplz)
In response to Ruben7
Ruben7 wrote:
Not the name field, every other one.

In your case:
delscoreplz["Levels"]=null
> delscoreplz["Kill Rank"]=null
> delscoreplz["Tournament Victory"]=null


Oh wow, highly appreciated, thank you.