Skip to content

Mod Heartbeat vs. Mod pseudo Heartbeat

NeverwinterWightsNeverwinterWights Member Posts: 339
edited December 2019 in Builders - Scripting
So I'm wondering if it is better for a PW to just use a modules heartbeat event to "tick up" and execute a script or multiple scripts after 5 minutes, or run a pseudo heartbeat/recursive script "on module load" that reruns itself after 5 minutes? I somewhat remember the days of the old bioware forums and the back and forth associated with pseudo heartbeats (they were frowned upon). Not sure if anything changed resource/lag wise in NWN:EE for PWs in this regard.

P.S. Does anyone use pseudo heartbeats on PCs or is that still a no no?

Comments

  • ProlericProleric Member Posts: 1,283
    There's no problem with using pseudo-heartbeat on today's hardware.

    Both of the methods you mention are fine.

    Of course, it's wise to avoid running scripts at very high frequency, or when they're no longer needed. A pseudo-heartbeat every 5 minutes is very undemanding - 1 second or so is feasible these days, as long as it's not over-used.

    For frequencies below 6 seconds (the module heartbeat) it is necessary for the script to be recursive, i.e. re-run itself after a delay. This can be done for longer intervals, too.

    I'm probably over-cautious, but I prefer to return control to the official heartbeat after a while (for example, I make a one-second PHB recursive for 6 ticks then have the official heartbeat re-launch it). At any rate, a recursive script needs to start with code that says "stop if the circumstances have changed". Nothing more scary than a script that runs forever with no means of stopping it!

    In addition to the module heartbeat, you can run PHB's on most objects. I haven't tried running them on PCs, though.
Sign In or Register to comment.