mob/var
tmp/training=0
player/p
mob/proc
TrainingLoop()
var/player/p=usr
while(p&&p.training)//While both values are true
p.TrainGain()//Wait 300 ticks (30 seconds)
spawn()
p.TrainingLoop()
Stop_TrainingLoop()
var/player/p=usr
p.training=0
Start_TrainingLoop()
var/player/p=usr
p.training=1
p.TrainingLoop()
TrainGain()
var/player/p=usr
if(p.potlvl=="Weak")
//Hidden, basically was the gainlayout for training. No proc or anything game after it.
mob/verb
Train()
set hidden=1
var/player/p=usr
if(p.training==0)
p.Start_TrainingLoop()
p.icon_state="Train"
p << "You start to train."
p.frozen=1
else
p.Stop_TrainingLoop()
p.icon_state=""
p << "You stop training."
p.frozen=0
Problem description:
First off... I've never in my life of coding ever understanded how to functionally loop without all this bunch of lag and errors and what not.
This is my first time working on a project where certain loops are included and I wanted to try this on my own.
Using a reference from a friend, I still can't come to get a functional loop and I've tried everything from set background =1 , to spawn(1), to while() to... idk.
You could see in the coding via // comments, I even had to delete certain spawn's because I felt like they were the problems, still no change.
But nothing works and I always end up with this error:
Infinite loop suspected--switching proc to background.
If it is not an infinite loop, either do 'set background=1' or set world.loop_checks=0.
proc name: TrainingLoop (/mob/proc/TrainingLoop)
source file: Training and Gains.dm,9
usr: Boiy (/player)
src: Boiy (/player)
call stack:
Boiy (/player): TrainingLoop()
Boiy (/player): Start TrainingLoop()
Boiy (/player): Train()