if(!world.GetMedal("Summer 2014 Finalist", usr.key))
if(!world.GetMedal("Summer 2014 Pewter", usr.key))
backs -= "** Summer 2014 Pewter Custom"
if(!world.GetMedal("Summer 2014 Bronze", usr.key))
backs -= "** Summer 2014 Bronze Custom"
if(!world.GetMedal("Summer 2014 Silver", usr.key))
backs -= "** Summer 2014 Silver Custom"
if(!world.GetMedal("Summer 2014 Champion", usr.key))
backs -= "** Summer 2014 Champion Custom"
backs -= "** Summer 2014 Seasonal"
Problem description:
Is there a way to use world.GetMedal to check to see if a player has a medal in-general before looking for individuals? Im adding in a series of unlocks for my game for tournament winners but it's causing certain aspects of the game to run a bit slow when it checks for each of the medals.
I'd really like to be able to check a player for a medal first and if they dont have any, dont bother with the rest of the checks. Is that possible?
The way things go right now it takes ~30 seconds to run through the checks of all ~20 medals that could give these rewards.
Is there a better way I could be doing this?
Note that above is just a section of the checks. I have 4 seasons that all have similar layouts.
From the DM reference on the GetMedal() proc:
Don't call SetScore or Set/GetMedal repeatedly. It waits around for the calls to finish. I recommend setting up an asynchronous non-blocking proc to do the job for you. Ideally, you'd like some sort of a mechanism for responding to medal award failures too, but this should at least get you started.
Updated it a bit to use associative lists rather than the in operator. It'll be a lot faster to check a ton of medals now.