ID:151740
 
What kind of strain would be put on a server if you had a proc that had the proc itself inside of it was used often?

Just out of curiosity. Say you have a proc that if the source has a certain variable set do a specific number, or setting, repeats the proc (until that variable changes).

Something like...

mob proc Repeatproc() if(src.repeating==1) step (src,src.dir) sleep (#) <- Some time src.Repeatproc() else ..()

In this specific example, I assume the total time that sleep() is activated could make a significant change on the strain..
A proc infinitely calling itself would eventually crash.

Everytime a proc is called in another it's added to a stack, if the stack gets too big the whole thing crashes.
In response to T3h P3ngu1n
T3h P3ngu1n wrote:
A proc infinitely calling itself would eventually crash.

Everytime a proc is called in another it's added to a stack, if the stack gets too big the whole thing crashes.

Right, that's what I thought. Do you know of a more efficient way to go about something like this, though?

I know that there's a safety feature that checks for things looping like that, and unless you disable it, the proc would be canceled after a couple runs through it.
In response to Nightmare3
If you use a normal for() or while() loop with a sleep, it will not activate the infinite loop check.

while(repeating)
sleep (#) <- Some time
...



In response to T3h P3ngu1n
I got it, thanks! :)
In response to T3h P3ngu1n
T3h P3ngu1n wrote:
If you use a normal for() or while() loop with a sleep, it will not activate the infinite loop check.

spawn()ing a recursive loop will also prevent it from crashing. As for strain on the server, it depends what the proc is doing.
In response to Falacy
Falacy wrote:
T3h P3ngu1n wrote:
If you use a normal for() or while() loop with a sleep, it will not activate the infinite loop check.

spawn()ing a recursive loop will also prevent it from crashing. As for strain on the server, it depends what the proc is doing.

It is, however, vastly silly. A while() loop is the correct solution.