ID:272897
 
Is there anyway i can make it to where i click a person on my game and it shows me there achived ingame medals?
i got the click to view stats part down just can't view medals
Maybe GetMedal(medal, player, hub=world.hub) would work for you.
mob
Click()
var/list/medalslist = params2list(world.GetMedal(src.ckey))
var/output = "<b>[src.name]'s Medals</b>"
for(var/a in medalslist)
output += "<br>[a]"
if(!medalslist.len)
output += "<br>[src.name] doesn't have any medals (yet!)."
usr << browse(output)


Here you go.

EDITL Revised. It's not that I'm a bad coder, I just do extremely weird things...
In response to Guy Hendricks
Not sure what you think about usr arbitrarily changing on its own or something; it could only become null in this case, but you're not accounting for that anyway (tho you probably don't need to). usr is a proc/local var, not a global one, so it won't be changed by, say, some verb running or something.
Also, might as well check medalslist.len to see if there are medals, and not use spawn(), since there isn't a particular reason to.
In response to Kaioken
Kaioken wrote:
Not sure what you think about usr arbitrarily changing on its own or something; it could only become null in this case, but you're not accounting for that anyway (tho you probably don't need to). usr is a proc/local var, not a global one, so it won't be changed by, say, some verb running or something.
It's local? Well gee, the guy who explained it to me was wrong.
Also, might as well check medalslist.len to see if there are medals, and not use spawn(), since there isn't a particular reason to.
You can your good coding practices! ;P Anyway, I used spawn() just to get into the habit of defaulting to using spawn() when dealing with Medals and Scores instead of defaulting to not using them. I realize now that Click() isn't going to keep anything waiting, so I'm going to revise that code now. Thank you.
In response to ANiChowy
Thanks everyone for so much help! i Got it now...

-Nightmare