universal getUsedCpu



  • Put this in the beginning of your script to have a getUsedCpu function which works in the simulation mode:
    ```javascript
    var usedOnStart = 0;
    usedOnStart = getUsedCpu ();

    function getUsedCpu ()
    {
    return Game.rooms.sim ? performance.now () - usedOnStart : Game.getUsedCpu ();
    }
    ```



  • var usedOnStart = 0;
    usedOnStart = getUsedCpu ();
    
    function getUsedCpu ()
    {
        return Game.rooms.sim ? performance.now () - usedOnStart : Game.getUsedCpu ();
    }