ID:158470
 
If you've played Resident Evil by Ruben7, you should notice that when you unlock a medal that it pops up on your screen.

Any help on how to do this?

Oh and I don't mean just a text message, I mean the image of the medal.
Mickemoose wrote:
If you've played Resident Evil by Ruben7, you should notice that when you unlock a medal that it pops up on your screen.

Any help on how to do this?

I haven't played his game, but I can think of a few ways. The simplest is to create a special window in the skin called "medalpopup", put a label control in it for the image and another one for the text, and then fill that in when the medal is earned.

if(world.SetMedal(player, medalname))
var/popup = "medalpopup_[ckey(medalname)]"
winclone(player, "medalpopup", popup)
winset(player, "medalpopup", "title=[url_encode(medalname)]")
player << output(medalicons[medalname], "[popup].medalimage")
player << output(medaldesc[medalname], "[popup].medaldesc")
winshow(player, popup)


I used a cloned window instead of reusing the same window because if you earn multiple medals it's nice to see both.

Lummox JR
In response to Lummox JR
Alright, So I just have to put all my medals into the project. But what does urlencode do there? It just comes up as an undefined proc.
In response to Mickemoose
Mickemoose wrote:
Alright, So I just have to put all my medals into the project. But what does urlencode do there? It just comes up as an undefined proc.

Whoops--my error. I meant that to be url_encode(). What it's doing in there is converting the name of the medal to a form that's safe to use in a parameter string for winset(). Another option is to use list2params(list("title" = medalname)) instead of "title=[url_encode(medalname)]".

Lummox JR
In response to Lummox JR
Oh alright, thanks for the help.