ID:875643
 
(See the best response by Nadrew.)
Is there any way to reset the scoreboard on a hub entry?
Yes, something like this. (I can't create a hub to make sure, I'm not a member)

mob/verb/reset_scores()
var/list/l = params2list(world.GetScores())
for(var/a in l)
world.SetScores(a, "")
That definitely makes it a lot easier. Just from the looks of it, it should work. Thanks a lot.
In response to Oondivinezin
I suggest placing an output after and outside the for() loop to know when it's finished.
I take it that it may take a while to reset all of them? Considering there's 33 pages of players (20 per page) that need to reset, is there an estimated time of how long it might take?
In response to Oondivinezin
Oondivinezin wrote:
I take it that it may take a while to reset all of them? Considering there's 33 pages of players (20 per page) that need to reset, is there an estimated time of how long it might take?

Shouldn't take that long depending on the connection to the hub and if the hub has a limit of connections or something.

Just give it a whirl

mob/verb/reset_scores()
var/count = 0
var/countmax = 20
var/list/l = world.GetScores()
for(var/a in l)
count ++
if(count >= countmax)
world << "up to [count]"
countmax + 20
world.SetScores(a, "")


The above will report every 20 players / a page.

[EDIT] NOT Tested and I wrote it on my iPhone I think I missed something:/ oh well you can figure it out :)
Yeah I think the count++ and if(count >= countmax) needed to be indented once.

Well when I run it, I made it so it gives me a count update every single time it gets a new score, however when used, the verb doesn't report anything back.
mob
Admin/verb
Reset_Scores()
set category = "Admin"
var/count = 0
var/countmax = 20
var/list/l = world.GetScores()
for(var/a in l)
count ++
src << "Current count: [count]"
if(count >= countmax)
countmax += 20
world.SetScores(a, "")

Is what I have now.
mob
Admin/verb
Reset_Scores()
set category = "Admin"
var/count = 0
var/list/l = world.GetScores()
world << l.len // see the length of the list
for(var/a in l)
count ++
src << "Current count: [count]"
world.SetScores(a, "")


Reporting every single time it removes something is going to either stall your game or just lag it.. depending on cpu etc.

That len.l may need to be changed to length.l use F1 in Dream Maker.
Been a while away from DM, ATHK? Should be l.len :)
In response to Nadrew
Nadrew wrote:
Been a while away from DM, ATHK? Should be l.len :)

Thanks! and yea it's been awhile :(
So it doesn't even output the list's length (l.len). The verb doesn't really show much of anything happening at all.
        Set_Scores()
set category = "Admin"
var/playerkey = input("Which player key?") as text
spawn() world.SetScores(playerkey,"")


However this works perfectly fine, the problem is the fact that I'd have to put each key in that's on the scoreboard individually. 655 BYOND keys to reset is not fun.

Update here. Runtime error just popped up, if it helps at all.

runtime error: Cannot read "1Light1;1mathew;2landman;2mari...".len
proc name: Reset Scores (/mob/TrueOwner/verb/Reset_Scores)
usr: Oondivinezin (/mob)
src: Oondivinezin (/mob)
call stack:
Oondivinezin (/mob): Reset Scores()
Best response
That's because GetScores() with an empty argument doesn't return a list, it returns a parameter set.

var/list/L = params2list(world.GetScores())
for(var/I in L)
world.SetScores(I,"")
sleep(1)
src << "Done!"


Give that a crack
Use params2list().
That definitely helped out, now it's relaying information back to me. Much appreciated guys.
In response to Nadrew
Nadrew wrote:
That's because GetScores() with an empty argument doesn't return a list, it returns a parameter set.

> var/list/L = params2list(world.GetScores())
> for(var/I in L)
> world.SetScores(I,"")
> sleep(1)
> src << "Done!"
>

Give that a crack

I should read the guide again lol I lost it :( DM that is.