Add time in the CPU interruption notifications

  • Hi all,

    We all have received timeout notifications from time to time because our script reached CPU limit:

    Script execution has been interrupted with a hard reset: CPU limit reached

    It is sometimes hard to debug though as you don't really know when it happened.

    Would it be possible to add the time (tick number) to these notifications (and maybe the real date/time too) ?
    It's probably an easy quality of life improvement.


  • AYCE

    If it is technically possible I would also love to have file+linenumber the execution was at when the reset occured. That would actually enable me to figure out which part of my code caused the reset. Right now I just have to guess.

  • Culture

    @kasami identifying the line and file isn't possible (this has come up before).

  • For those interested, you can log the tick and timestamp at which resets occur using this snippet:

    // Notify if last tick was reset
    let { timestamp = null, tick = null } = Memory.os || {};
    if (tick !== null && tick + 1 !== Game.time) {
        let time = new Date(timestamp).toTimeString();
        console.log(`Tick ${tick} got reset at ${time}`);
    // Save current time and tick
    Memory.os = { timestamp:, tick: Game.time };

    Regards, Hiryus.