obj/Decoration
icon='InteriorDeco.dmi'
Bed1
icon_state="bed1"
density = 1
Bed2
icon_state="bed2"
Entered(mob/M)
M.bedresting=1
Exited(mob/M)
M.bedresting=0
Bench
icon_state="Bench"
Entered(mob/M)
M.benchresting=1
Exited(mob/M)
M.benchresting=0
Bed3
icon_state="bed3"
density = 1
Bed4
icon_state="bed4"
Entered(mob/M)
M.bedresting=1
Exited(mob/M)
M.bedresting=0
mob/proc
meditate()
if(usr.resting)
usr.MaxPower += (1 *0.0030)
usr.Exp += (1 *0.0015)
spawn(100)
usr.meditate()
if(usr.bedresting==1)
usr.Exp += (1 *0.0015)
usr.icon_state="Focus"
usr.bedrest()
if(usr.benchresting==1)
usr.icon_state="KO"
usr.benchrest()
if(usr.Power > usr.MaxPower)
usr.Power = usr.MaxPower
usr.meditate()
Problem description: Alright so I am trying to make it so that when you walk up to a bed, jump in it, and hit meditate you automatically begin to go through a rest proc, different from the normal meditation. However. In game when you go up to the bed and lay in it it does not toggle the 'bedresting' var to one like I have it set, same with benchresting. I can not figure out what is going on at -all- and was wondering if someone could help me
There are a few other issues with your meditate() procedure however. In a procedure, you should not be using usr (as there will be some scoping confusion in certain circumstances). You're better off using src there.
Secondly, meditate() is an infinite recursion error waiting to happen. The spawn statement is meant to start a new block—much like an if statement. The way you have it now however, spawn (100) will do... nothing and it will immediately call usr.meditate() in meditate(), resulting most likely in a crash.