Post
by Dalvyn » Wed Sep 09, 2009 12:28 pm
Note that there's a difference between rand progs and rand checks.
Rand progs (>rand_prog X~) triggers constantly once every few ticks, which means that they run all the time (*). They can take a heavy toll on the server resource. Basically (and I know this is not 100% precise), a rand_prog 20 means that, every tick, the game rolls a d100 and, if the result is under 20, it runs that program. Whether the program is run or not, the roll is made. One roll is not a big problem, but 50 mobs with a rand prog means 50 rolls each tick, plus running 20% of those programs.
Rand checks inside a non-rand prog (e.g., rand checks inside a greet_prog like the one presented in the link you give) do not run constantly: they are triggered and checked only when someone goes into a room where the mob is (since it's a greet_prog).
Hope that clears things?
-----
(*) Though I'm not entirely sure how they are coded - it is possible that rand_progs only run when there is a character in the area or something like that. I know I have been surprised by their behaviour in the past.