ID:141285
 
Code:
mob
proc
Medal1()
if(src.HM1==0)
world.SetMedal("Getting Stronger", src.key, "Forerunnerz.DBTG", "hubpassword")
var/gotmedal = world.GetMedal("Getting Stronger", src.key)
if(isnull(gotmedal))
src<<"The hub could not be contacted, your medal was not obtained, please check your connection and try again."
return
else
src<<"You have unlocked the Getting Stronger medal."
return


Problem description:

I don't understand, I read the DM guide on this but I'm getting 3 errors. Inconstant indentation, even though it looks perfectly indented and the code looks like it can't get any better.

Also, is this the right way to get a medal unlocked? Here is my hub: http://www.byond.com/games/Forerunnerz/DBTG

PS: This isn't a rip. Completely original game 100% from scratch.

Doesn't Look proper to me.

mob
proc
Medal1()
if(src.HM1==0)
world.SetMedal("Getting Stronger", src.key, "Forerunnerz.DBTG", "hubpassword")
var/gotmedal = world.GetMedal("Getting Stronger", src.key)
if(isnull(gotmedal))
src<<"The hub could not be contacted, your medal was not obtained, please check your connection and try again."
return
else
src<<"You have unlocked the Getting Stronger medal."
return

Change spaces to tab keys.
In response to Howey
Woah. Guess I accidently deleted spaces from the 3 codes. I usually use TAB. Oh well. Thanks a lot man for pointed it out. Oh and do you think that I set up the medals right? It's still very new to me.
In response to Forerunnerz
I would think the world.setmedal() would be after the line
     src<<"You have unlocked the Getting Stronger medal."
Not to sure though. Not looked into medals that much.
To shorten it:
You could just put world.SetMedal() in gotmedal. It returns true if it successfully contacted the hub, as the reference says.
You can use boolean in both the isnull() and ==0 conditions.
if(!HM1) can replace if(HM1==0).. and of course, if(HM1) can replace if(src.HM1), it's a matter of preference and four extra characters to type.
The isnull() line can be reduced to if(!gotmedal).
In response to Kaiochao
Kaiochao wrote:
The isnull() line can be reduced to if(!gotmedal).

No, it can't; in some cases, such as this, distinguishing between the different false values is meaningful. For this case, GetMedal() is used to check if a player has a certain medal, or not. If he has it, it returns 1, if he doesn't, it returns 0*. When something's not right and the hub can't be contacted however, it returns the specific value of null, which in most cases you'd want to account for.
*: So if he used ! in this specific code, a player would get the "You've unlocked the medal" message even if he already had it before.
EDIT: So, okay, that's not precisely the case here (but the point still stands). His code is a little 'confused', the GetMedal() call is entirely redundant in the first place.