ID:264936
 
Code:
client
proc
get_medals(verbose = 0)
if(verbose)
src << "getting medals for [ckey]"

var/medal_str = world.GetMedal("", ckey)

if(isnull(medal_str))
if(verbose)
src << "GetMedal returned null"
return

if(verbose)
src << "[src] has: ([medal_str])"

// ...


Problem description:
world.GetMedal returns an empty string when the player does in fact have medals.

The reference says:

Whenever possible, GetMedal() will avoid contacting the hub by using the information it was given when the user logged in. If contacting the hub is required, the proc may take a few moments to return a result.

I'm not sure what this means but it sounds like this could be related to the problem. This issue only happens when you're not the host. The game is almost always able to look up the host's medals.

It seems like the server is somehow getting the idea that the client has no medals so it doesn't even bother checking the hub. What does the underlined part of the quote from the reference mean? What information can be provided when the user logs in? Is there a way to prevent this to force the game to check the hub for medals?
Any ideas?
In response to Forum_account
I think it has to be like this. Example, world.SetMedal("Adventure Started", usr)
In response to Imzco
Imzco wrote:
I think it has to be like this. Example, world.SetMedal("Adventure Started", usr)

If you don't specify a medal name (for GetMedal) its supposed to return the list of medals that the player has. The code I posted works occasionally, so the format appears to be correct.
In response to Forum_account
Using <small>params2list</small> should do the trick.

var/list/medal_list = params2list(world.GetMedal())


It will get each medal from off the hub, adding it to the list.

Edit: Re-read your post, you want it to return the medals you have. I misread the post.
In response to Neimo
The problem is that sometimes the code works and sometimes it doesn't.
In response to Forum_account
Are you calling it frequently?
In response to ExPixel
It's called each time a player logs in.
In response to Forum_account
I'm having the same problem actually.
In response to Yusuke13
Same here.