ID:270051
 
Hey people, i need to know how to do a proc in every one second, like a loop.Please answer and help me this time ;)
That really would lag the world, depending on what you were doing.

world/New()
..()
while(world)
sleep(600)//Does an action every minute, would be better.
//Do world actions here.

It really depends on what you need, can you be more specific?
In response to Flame Sage
Flame Sage wrote:
That really would lag the world, depending on what you were doing.

> world/New()
> ..()
> while(world)
> sleep(600)//Does an action every minute, would be better.
> //Do world actions here.
>

It really depends on what you need, can you be more specific?

its this proc:
mob/proc/check()
var/fHP = (HP / MaxHP) * 100
var/meterHP
if (fHP < 100&&fHP > 89)
meterHP = 90
else if (fHP == 0)
meterHP = 0
else if (fHP == 100)
meterHP = 100
else if (fHP <= 10&&fHP != 0)
meterHP = 110
else if (fHP > 100)
meterHP = 120
else
meterHP = (round(fHP) - 5)
if (((meterHP / 5) % 2) == 1)
meterHP += 1
meterHP = round(meterHP,10)
for(var/obj/HP/P in client.screen)
P.icon_state = "power_[num2text(meterHP)]"
//check for stat caps
if (Strength > 100000000) //max 100 million
Strength = 100000000
if (MaxHP > 1000000000) //max 1 billion
MaxHP = 1000000000
if(HP < 0) HP = 0
In response to Pharaoh Atem
A much easier thing to do, would just call that everytime the PL changes, you could make a proc to make it easier.
mob/proc/alter_powerlevel(var/n as number)
src.powerlevel+=n//you can change it to positive to add, or minus to subtract.
src.check()
In response to Flame Sage
Flame Sage wrote:
A much easier thing to do, would just call that everytime the PL changes, you could make a proc to make it easier.
> mob/proc/alter_powerlevel(var/n as number)
> src.powerlevel+=n//you can change it to positive to add, or minus to subtract.
> src.check()
>

thank you