ID:140961
 
Code:
Give_Badge(mob/M in world)
set name = "Give Gym Badge"
set category = "Gym"
if(usr.GymType=="Rock")
var/obj/Rockbadge/B = new/obj/Rockbadge
var/B.loc = M
if(usr.GymType=="Psychic")
var/obj/Psychicbadge/B = new/obj/Psychicbadge
var/B.loc = M
if(usr.GymType=="Grass")
var/obj/Forestbadge/B = new/obj/Forestbadge
var/B.loc = M
if(usr.GymType=="Thunder")
var/obj/Thunderbadge/B = new/obj/Thunderbadge
var/B.loc = M
if(usr.GymType=="Darkness")
var/obj/Darknessbadge/B = new/obj/Darknessbadge
var/B.loc = M
if(usr.GymType=="Flying")
var/obj/Featherbadge/B = new/obj/Featherbadge
var/B.loc = M
if(usr.GymType=="Water")
var/obj/Waterbadge/B = new/obj/Waterbadge
var/B.loc = M
if(usr.GymType=="Fire")
var/obj/Firebadge/B = new/obj/Firebadge
var/B.loc = M
usr<<"You have given [M] your badge"
M<<"[usr] has given you the [usr.GymType] Badge"


Problem description:
its not wut ghost said i think its something else i made all exits and it still does this
well now it says:

Gym leader.dm:163:error:/obj/Grassbadge:undefined type path
Gym leader.dm:169:error:/obj/Darknessbadge:undefined type path
Gym leader.dm:172:error:/obj/Featherbadge:undefined type path
I do not think you understand what I said in [link]

I said that programming is CASE SENSITIVE. That means that /turf/xYz is NOT the same as /turf/XYz nor is it the same as /turf/XYZ, etc.

Did you even try to look up switch()? It would make programming easier when looking for multiple if()s/values from one reference.

The solution to your problem is simple: The object(s) you are creating do not exist. You never made an /obj/Grassbadge, etc... so either make one for check if your path is correct.


Also, this is a forum, not a chatroom; take your time typing things out. The less clear you are, the less help you will receive (and increases the chance of a wrong solution being posted).
In response to GhostAnime
aw come on ghost lol im doing the best i can to understand this coding stuff its my first game give me some slack and i will try to do that
In response to Roflmao1298
And Ghost is doing the best S/HE can. At this rate, you don't seem to want to learn.

1. Use switch() to check for "usr.GymType", and if you don't know what it is, look it up. switch() is a MUCH better method for what you want.

2. The objects you are "attempting" (I'll explain this later) to create cannot be created; they do not exist. The object must be in one of the included .dm files for it to exist.

3. There's no need to use such an extensive type path for your new(). Just use var/obj/B = new/obj/Darknessbadge, because you're not using any var's available to only Darknessbadge.

4. You will find an error pop-up, which is the obj won't be given to M. Why? Because var/B.loc is not how you access an already built in var, you simply use B.loc.

5. At this point, don't worry about what I said in 3 and 4. Why? Because for all you're doing, there's a MUCH easier way. Which is to use new() PROPERLY. With new, you use it like this:

new /obj/Thisobj(src)


Where new is used as a label to start the proc, /obj/Thisobj is whatever you are making, and whatever's in (), in this example src, is where the atom will be sent.
In response to Demon_F0rce
Demon_F0rce wrote:
1. Use switch()

Or, make use of a very weird and obscure principle called modular programming (please note the sarcasm).
text2path is an incredibly useful tool in DM.