ID:263325
 
Code:
turf
var
flame
Entered(var/obj/Spells/DarkMagic/Fire/F)
var/turf/T
if(T.flame = 1)
new var/obj/Flame/F
F.loc=T.loc
else
return


Problem description:

error : var/obj/Flame/F:undefined var
Arr...I hate it when I stop coding, then take it back up, then stop again... :(
var/obj/Flame/F = new
turf
var
flame
Entered()
var/turf/T
if(T.flame==1)
var/obj/F=new/obj/Flame
F.loc=T.loc
else
return ..()


Not sure what your doin.
In response to Popisfizzy
:( I hate it when I stop coding, I forget everything...
Now I get the runtime error cannot read null.flame everytime something moves that is not a flame object.
There are several erros so I will list them to you in the order I see them:

1) var/turf/T - two things about this: one- you do not need to make a new variable to reference to the turf itself, you could use src (think src as "source"); two- T was never defined (meaning you would get a null.___ error)

2) if(T.flame = 1) - Besides the T. thing explained in point #1 (so it should be src.flame), it should be ==1... or if it is a boolean type of variable (which it seems to be), it should be if(src.flame) to save a few bytes. Click here to learn about boolean variables. Also, remember this:
(variable =/== value)
= means to change the variable to the value
== checks if the variable is equal to the value

3) new var/obj/Flame/F - Argh, look up new in DM reference and you'll probably see why this is wrong.

i) It should be var/obj/Flame/F=new which is basically saying var/obj/Flame/F=new/obj/Flame

ii) You really do not need to make a variable just to set the location since you could change it directly in new's argument (which you probably would've known about if you read about new in the DM Reference). new /type/path/here(location) so to have the same effect of what you want, saving a few bytes: new/obj/Flame(src.loc)

iii) You already defined the variable F in your Entered() argument[var/obj/Spells/DarkMagic/Fire/F ... which is wrong to use there anyways, because it does not actually look for the path you entered in the argument)

4)else return You really do not need this here... because if it isn't in the if(), it wouldn't happen anyways.

5) As mentioned in point 3.iii, the argument of Enter() and its' family do not look for a specific path as defined, meaning that you'll have problems. Eg: If a mob entered that turf, it would be var/obj/Spells/DarkMagic/Fire/F = /mob[that entered], which leads to errors.

6) Remember Murphy's Law (look up on google if you don't know about it), safety checks are always crucial, because if anything can go wrong, it will go wrong.
turf
var
flame
Entered(atom/A)
if(istype(A,/obj/Spells/DarkMagic/Fire))
if(src.flame)new/obj/Flame(loc)


Remember to read the points >_>

I would nicpick more, and proofread what I said, but I am very tired at the moment .-.'

- GhostAnime