ID:263957
 
Code:
mob/proc
Warrior_Level()
usr<<"You has gained a level!"
usr<<"HP has went up by [hvalue]!"
var/hvalue=(rand,5,20) //it's supposed to be random from anywhere from 5, to 20


Problem description:
levelup.dm:22:hvalue:warning: use of hvalue precedes its definition
levelup.dm:23:hvalue :warning: definition is here
levelup.dm:23:error:rand:undefined var
levelup.dm:23:error::invalid expression


mob/proc
Warrior_Level()
var/hvalue= rand(5,20) //it's supposed to be random from anywhere from 5, to 20
usr<<"You has gained a level!"
usr<<"HP has went up by [hvalue]!"

There it has no errors for me. The two problems you had is you have to define the var before you call it and the second was rand is placed like "rand(#,#)" not "(rand,#,#)"
Hope that helps!
What Nategrant mentioned, as well as do not abuse the usr variable :O!

http://www.byond.com/members/ DreamMakers?command=view_post&post=35932
In response to GhostAnime
lol ghost your really hate that usr proc don't you. I'll fix to your likings.
mob/proc
Warrior_Level(mob/M)
var/hvalue= rand(5,20) //it's supposed to be random from anywhere from 5, to 20
M<<"You has gained a level!"
M<<"HP has went up by [hvalue]!"
In response to Nategrant
Actually, src would be the best in this case, as src is the source of the procedure (the mob who had that procedure called on):
mob/proc
Warrior_Level()
var/hvalue= rand(5,20)
src.hp += hvalue
src<<"You has gained a level!\nHP has went up by [hvalue]!"
(\n is a text macro for new line)

Yeah, I really hate using usr variable in most cases (in some, you have no other choice... but those are usually the places where you can use usr, like in Click()!)

I remember when I programmed in an AI system for a game before, an enemy kept damaging/killing me even though I was 3 Z levels away. Later I found out it was because of usr and I was the first one to invoke that procedure...
In response to GhostAnime
lol, well better to drill that into our heads then having us come onto the threads later. Well mind helping me out on a problem of my own (acouple threads below this one) now that we fixed this?