ID:140074
 
Code:
mob/verb/rest()
while(1)
energy += 5
sleep(200)
if(usr.energy = usr.energy)
usr << "Your all rested up!"


Problem description: Alrighty this is my "rest" verb. I want it to recover energy at a certain rate but not let the character move while this verb is activated. I also want it to stop regaining energy after it has hit the character's max energy. Could I get some help with tidying up this code and help answering these specific questions?

Again: [link]
I suggest you take a visit before trying to code: http://www.byond.com/developer/articles/start
In response to Leur
Like I haven't heard that one before. I realize that it will help my overall coding skills. But I don't see it helping my SPECIFIC problem
In response to Beerizant
If you learn how to code then you will learn how to set up your code structure and you want have to ask that SPECIFIC problem because you'll know how to fix it.
In response to Leur
Fine... I've read the guides before. Idk, I'll kepp on keppingo n.
In response to Beerizant
The DM guide, DM reference and tutorials in Dream Makers are all there to help guide you learning the DM language. They do not tell you one specific thing but teaches you how to use the basic tools so you can make your own complex ones.

Anyways, the problem is:
1) Nothing is indented under the while(). What this does is causes you to enter an infinite loop with no exit! Translation in brackets:
while(1){
}
energy...


2) X = Y is setting X's value to Y. == is used for comparison.