ID:273519
 
Trying to remove the medal from everyone that's earned it.

var/list/L =  params2list(world.GetMedal())
for(var/K in L)
world.ClearMedal("Stuck in a Loop", K)


Doesn't work, sadly. How would I go about doing this?
I cannot seem to find a method to retrieve all the people with a specific medal but you can do it the old fashion way:
#define GMSG(X) {world.log << X; world << X}
var/Erase_Medal = "Stuck in a Loop"
GMSG("Starting Erasing of the medal [Erase_Medal]")
for(var/A in params2list(world.GetScores())) // Get all players listed on the Scoreboard
if(world.ClearMedal(Erase_Medal,A))
GMSG("Erased [A]")

GMSG("All who earned [Erase_Medal] hopefully should be erased.")


(If you are thinking about making a feature request about retrieving a list of players who earned a specific medal, don't. It has been suggested before: http://www.byond.com/members/ DreamMakers?command=view_tracker_issue&tracker_issue=1399 - though I would love to see it like the format presented, the issue caused is understandable).
In response to GhostAnime (#1)
Thanks for the reply, but the scoreboard has been cleared already. Still looking for another way.
In response to Yuuki Kei (#2)
Look again.
He's giving you that workaround because there's no built-in way to get a list of all the players who have medals.
You could parse the hub entry or the medal management page to manually get such a list, though.
In response to Kaioken (#3)
Guess I'll just wait for when/if a proc is added or changed to do it. Not really a big deal.

Thanks anyway.
In response to Yuuki Kei (#4)
I was bored so I did the parsing on the medals page:
client/New()
var
medal_url_page = "http://www.byond.com/games/YuukiKei/BFS?command=view_medals_ajax&medal=12206&full=1" // You can get the medal # by looking through the page source on the medal section
medal_name
http
i = 1
src << "Starting erasing"
for()// Infinite loop, like while(1)
http = world.Export(medal_url_page) // Gets the HTML info
if(!http)
CRASH("Is your internet working?")
return
http = file2text(http["CONTENT"]) // Parses through the HTML of the file

if(findtext(http,"no players have earned this medal")) // If this cannot be found, that means all of the medals for that has been gone
break
if(!medal_name) // Making sure you want to delete the medal
alert(http)
var/n = findtext(http,"title=")+7
n = copytext(http,n,findtext(http,"\"",n))
if(alert(src,"Are you sure you want to delete the medal \"[n]\"?","Erase Medal: [n]","?_?","No","Yes") != "Yes")
break

medal_name = n
for()
var/Xkey=findtext(http, "http://www.byond.com/members/")
if(!Xkey) // If no more members for that page remains, we break out of the loop to get other people
break
Xkey+=29
var/End = findtext(http, "\"", Xkey)
Xkey = copytext(http, Xkey, End)
// src << "world.ClearMedal([medal_name],[Xkey])"
if(world.ClearMedal(medal_name,Xkey))
src << "Erased [Xkey] (#[i++])"
http = copytext(http, End)
src << "Ending erasing!"
return


This will erase all the entries for the Stuck in a Loop medal (and made it so it can easily be edited to erase other medals).

This is essentially a plug-and-play snippet, enjoy ^_^

I'm sure it could be improved but it works, or at least it does when I tried it...