ID:2482521
 
(See the best response by Kaiochao.)
Code:
mob/var
UP=0
UPMod=1

obj/Unlock_Potential/verb/Unlock_Potential()
set category="Skills"
var/mob/M=input("Who?","") as null|mob in view(1)
if(M) switch(input(M,"[usr] wants to unlock your hidden powers. Do you want to do this?", "",text) in list("No","Yes"))
if("Yes")
if(!M.UP) <---Says there is an error here
usr<<"You use Unlock Potential on [M]."
var/boost=100000*M.BPMod*M.UPMod*M.StatRank
if(boost>M.RecordBP*5) boost=M.RecordBP*5
M.RecordBP+=boost
M.RecordBP+=500*M.UPMod
M.Pow+=(500*M.PowMod)
M.MaxKi+=200*M.KiMod
M.kimanip+=10
M.flightskill+=(20*M.flightmod)
M.haszanzo=1
M.zanzoskill+=(20*M.zanzomod)
M.MaxBPpcnt+=(50*M.KiRegen)
M.GravMastered+=50*M.GravMod
M.DeclineAge+=10
M.UP=1 <--- says there is an error here


else usr<<"[M]'s potential is already unlocked."
return
if("No") usr<<"[M] declined your offer."

It works fine when compiled but I am just trying to get to the object tree so I can experiment around with the code. I am thinking there is some confusion between usr and the definition of M here?


Regenerate.dm:37:error: M.16: undefined var
Regenerate.dm:52:error: M.16: undefined var


Best response
UP is a preprocessor constant for the number 16. It's a direction like NORTH or EAST and stepping by it moves you "up" one z level.

Best and easiest way to avoid these kinds of naming collisions is to follow a proper naming convention which includes not using ALL CAPS for anything except constants (or anything at all).
Thank you, so would UnlockedPotential be fine or should I avoid all use of capitals? I knew I was going to have to rename every instance of UP.
In response to Kjjoker
The naming style I use is a hybrid of the official C# naming guidelines and the naming style used in the engine itself:

UpperCase for
* non-global procs (except verbs), such as movable.Move, world.IsSubscribed.
* global variables/constants (this comes from C#; basically never use all-caps for anything), such as TileWidth.

lower_case for pretty much everything else:
* types, such as mob, mutable_appearance
* global procs, such as step_to (though a lot of built-in global procs don't seem to follow any kind of naming convention... ckeyEx, istype, time2text...)
* non-global variables and proc arguments, such as density, appearance_flags
* verbs, such as pick_up which appears as "pick up"