proc/Unique(speed)
while(src)
if (awake==1)
if (P in view(5))
if(hasspells==0)
step_towards(src,P)
if(Unique==1)
step_towards(src,P)
step_towards(src,P)
else
var/V = rand(1,6)
switch(V)
if(1)
if(fireboltlevel>0)
FIREbolt()
else
step_towards(src,P)
if(2)
if(iceboltlevel>0)
ICEbolt()
else
step_towards(src,P)
if(3)
if(lightningboltlevel>0)
LITbolt()
else
step_towards(src,P)
if(4)
if(feedbacklevel>0)
FEEDBACK()
else
step_towards(src,P)
if(5)
if(poisonlevel>0)
POISON()
else
step_towards(src,P)
if(6)
if(darklevel>0)
DARK()
else
step_towards(src,P)
else
awake=0
for(P in view(5))
awake=1
break
sleep(Speed)
Problem description: There isn't a problem with the coding, it works just fine. But i found out that its where ALL my lag is coming from. So if someone could please help me make this same code but make it so it wont cause all my lag.