ID:2010173
 
(See the best response by GreatPirateEra.)
Code:
mob/proc
Levelup()
if(exp >= maxexp)
level ++
exp -= exp
maxexp *=1.1
src<<"You have gained a level!"

verb
Punch(Punchingbag in oview(1))
usr<<output("You hit the bag","system")
exp += 10
stamina += 4
Levelup()


Error:
Train.dm:13:error: exp: undefined var
Train.dm:14:error: stamina: undefined var
Train.dm:15:error: Levelup: undefined proc
Where it was defined
mob
var
title = "Hero"
rank = "C Class"
level = 1
exp = 0
maxexp = 5
money = 25000
tnl = 1500
strength = 50
power = 50
speed = 50
Hit_Bag = 0
defense = 50
stamina = 0
maxstamina = 100

Problem in words
Although the variables are obviously defined and work very well with other code they don't seem to register in the punching bag snip. I've tried using src.exp mob.exp and just plain old exp and non of the above work. I restarted the source, because sometimes errors occur and can only be fixed with a good reboot, however it also did not work. Any help would be appreciated.
You didn't attach that verb to /mob, so the variables are undeclared (since those are /mob variables, also a mob proc.)

Try mob/verb/Punch().
Thank you so much for the help, now I have a new problem I want the Punch verb to only show whenever 1 tile away from punching bag and only can hit punching bag. I tried in view but that didn't work so well.
mob/proc
Levelup()
if(exp >= maxexp)
level ++
exp -= exp
maxexp *=1.1
src<<"You have gained a level!"

mob
verb
Punch(Punchingbag in view(1))
usr<<output("You hit the bag","system")
exp += 10
stamina += 4
Levelup()
In response to Dayoak
Sorry forgot to reply to you.
That would require you to put the Punch() verb on the obj itself.

obj/Punching_Bag/verb/Punch()
set src in oview(1)
usr << output("You hit the bag", "system")
usr.exp += 10
usr.stamina += 4
usr.Levelup()
Best response
Stupidity.
In response to GreatPirateEra
Lol you are right.
In response to Dragonpearl123
Dragonpearl123 wrote:
Lol you are right.

It happens to the best of us. Just the other day, I submitted a bug report and then remembered that I'd just made a small error that led to unexplainable behavior.
Please don't put pbags in your game.
In response to Lummox JR
pbags?
In response to Lummox JR
Oh punching bags, what is wrong with punching bags?
In response to Dragonpearl123
Dragonpearl123 wrote:
Oh punching bags, what is wrong with punching bags?

Pbags are a long-running joke on BYOND, because so many poorly-written anime games have used them as cheap training. In the worst cases (which is to say most of them), they're exploitable to the point where you can just set your character next to one, hold down a macro, and let it keep going ad infinitum until you're as high a level as you want--without ever truly playing.

Experience gain in any game should always involve either risk or investment. Risk, in that by going out and attacking things--or even running the risk of an ambush while searching for quests or secrets or other XP sources--you might get hurt and end up losing something valuable: gold, XP, items, etc. Risk-based investments in XP also tend to take a certain amount of time, and a good design strategy is to plan that the expected time for each level should go up by some fixed amount. A strictly time-based investment might be one where a player can only do a certain form of training once every X hours.
In response to Lummox JR
Mr.Lummox sir you are absolutely right, that is why the punching bags are only for people who are under a certain level, mostly for starting players who need a boost to start there are plenty of crawling demons out there that give much more exp.

Edit: Also the punching bags break.
mostly for starting players who need a boost to start

This underscores a scaling/design problem in your overall game.

When I'm playing a new game, one of the first things that I do is evaluate whether this game is for me. The way I look at it is: "Has this developer made an interesting, engaging experience for me to enjoy?"

If I have to go to the gym and do pushups or run on a treadmill in order to enjoy the game, the answer to that question is no.

Games are supposed to be fun. Going to the gym is only fun because your body drugs you when you work out and you feel good. When playing your game, I'm not going to the gym. I'm sitting in front of a computer watching a man punch a bag. Does that sound fun? If it's not fun, it shouldn't be in the game.

That's just my two cents.

EDIT: That's not to say that you can't use tedium to try to direct the player. Making grinding an absurd number of crafted items tedious in order to keep the economy somewhat under control isn't a bad thing. However, I shouldn't be forced to endure tedium in order to get to my first bit of fun.