ID:148205
 
There are a few problems:
1) It doesn't give you any exp.
2) Every 10 seconds (100 ticks) it asks if you wanna train
3) The icon for training doesn't appear
What am i doing wrong??? Thanks
mob
proc
train2()
usr << "You begin training."
usr.train = 0
usr.stamina -= rand(1,7)
usr.random = rand(1,2)
usr.EXP += rand(1,10)
usr.random = rand(1,30)
if(usr.random == 1)
usr << "You feel like you have more Fighting Spirit. "
usr.spirit += 1
usr.random = rand(1,5)
if(usr.stamina <= 0)
usr.stamina = 0
sleep(50)
usr.train()
mob
verb
train()
set category = "Training"
switch(input("Do you wish to train",text) in list ("Yes","No"))
if("Yes")
usr.train = 1
train2()
usr.icon_state = "train"
if("No")
usr.train = 0
if(usr.train == 1)
usr.move = 0
if(usr.train == 0)
usr.EXP += 0
usr << "You stop training. "
sleep(100)
usr.EXP += 0
atom/movable
var
train
train2
No put usr in proc. Ungh.

Lummox JR
Your first problem is that you're using usr in a proc, which is generally a big no-no.

Your second problem is that you're creating a recursive loop. You should use spawn() to call iterations of a loop, or it will eventually overflow the stack.

Your third problem is that you are using a training system that requires users to click a verb and go watch a movie, then come back and be obscenely powerful. This is just as bad or worse than "pbags." I suggest you scrap this whole thing and put in something that requires actual thought on the user's part.
In response to Garthor
well i fixed the usr thing and now this is my proc:
and i wanted a training system that didn't require pbags...i wanted it to so you could train anywhere, but it wouldn't be as good as other training methods...i want it like zeta2's meditate
mob
proc
train2()
usr << "You begin training."
train = 0
stamina -= rand(1,7)
random = rand(1,2)
EXP += rand(1,10)
random = rand(1,30)
if(usr.random == 1)
usr << "<font size = 2>You feel like you have more Fighting Spirit.</font> "
spirit += 1
random = rand(1,5)
if(stamina <= 0)
stamina = 0
sleep(50)
usr.train()
In response to YamiGotenks
You still have usr all over that proc, you still are calling the loop recursively, and you still have a horrible system of advancement.
In response to Garthor
usr is in the messages only, unless u want me to say that i began trainin to the whole world...i'm still learning about sleep and spawn and maybe i just should delete it...and right now i hav no clue what to do
mob
proc
train2()
usr << "You begin training."
train = 0
stamina -= rand(1,7)
random = rand(1,2)
EXP += rand(1,10)
random = rand(1,30)
if(usr.random == 1)
usr << "<font size = 2>You feel like you have more Fighting Spirit.</font> "
spirit += 1
random = rand(1,5)
if(stamina <= 0)
stamina = 0
sleep(50)
usr.train()
mob
verb
train()
set category = "Training"
switch(input("Do you wish to train",text) in list ("Yes","No"))
if("Yes")
usr.train = 1
train2()
usr.icon_state = "train"
if("No")
usr.train = 0
if(usr.train == 1)
usr.move = 0
if(usr.train == 0)
usr.EXP += 0
usr << "You stop training. "
spawn(100)
usr.EXP += 0
In response to Lummox JR
Lummox JR wrote:
No put usr in proc. Ungh.

With work, we can get this response down to three words:

"No put usr."

Then maybe two words, with one for flavor:

"No usr. Ungh."

I hear that civilzations more advanced than ours managed to get it down to one letter.
In response to Deadron
A slightly-less-advanced-than-more-advanced-than-us (does that make sense?) civilisation that I heard of got it down to a single pictogram. A rough translation would be:
      _
     | |
     | |
 _ _ | | _ _
| | || || | |
| | || || | |     (Wow, my ASCII art sux0rs...!)
| | || || | |
 \         /
  \       /
   \_____/


Hehe. I couldn't resist that. =)


Maybe we should all get together and form the NPUIP organisation - No Put Usr In Procs! And we could have slogans like "The Programmers Shall Control The Means of Variable Referencing (With Regard to Usr, Especially When Used In Procs)!", and "Usr Friendly is not User Friendly!" And "npuip.org" doesn't appear to have been registered. Viva la revolution!
In response to Deadron
lol that helped >.>
In response to Crispy
Um are we going to chat or help me with this? lol
In response to YamiGotenks
YamiGotenks wrote:
usr is in the messages only, unless u want me to say that i began trainin to the whole world...

src would be correct there, not usr. (And it's not just in the messages; you used usr.random in the if() statement.) Everywhere in that proc where you have usr it can and should be changed to src. (In some procs it needs to be changed to something different. In those cases you'd need to add an argument to the proc like mob/M. That doesn't apply here though.)

Lummox JR
In response to Crispy
Crispy wrote:
Viva la revolution!

Viva la resistance

Hmm... Mine sounds better >:P

--Lee
In response to Lummox JR
so i should put src where usr was in the 1st post or just in one of the last posts?
In response to YamiGotenks
YamiGotenks wrote:
so i should put src where usr was in the 1st post or just in one of the last posts?

Either; it should end up the same way regardless.

Lummox JR
In response to Lummox JR
mob
proc
train2()
usr << "You begin training."

src.stamina -= rand(1,7)
src.random = rand(1,2)
src.EXP += rand(1,10)
src.random = rand(1,30)
if(src.random == 1)
src << "<font size = 2>You feel like you have more Fighting Spirit.</font> "
src.spirit += 1
random = rand(1,5)
if(src.stamina <= 0)
src.stamina = 0
src << "You are too tired to train! "
sleep(50)
//usr.train()
mob
verb
train()
set category = "Training"
switch(input("Do you wish to train",text) in list ("Yes","No"))
if("Yes")
usr.icon_state = "train"
usr.train = 1
if("No")
usr.train = 0
if(usr.train == 1)
usr.move = 0
usr.icon_state = "train"
train2()
if(usr.train == 0)
usr.EXP += 0
usr << "You stop training. "
usr.EXP += 0


I fixed most of it, but I don't know what i'm doing wrong now, plz help thanks
In response to Mellifluous
It does not. =P
In response to Crispy
I know all of you are good coders, can at least one of ya tell me what i'm doing wrong....
In response to YamiGotenks
I already told you.