Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. Hello Guest!
    Welcome to the Bug Report forum, please make sure you search for your problem before posting here. If you post a duplicate (that you post the same issue while other people have already done that before) you will be given a warning point which can eventually lead into account limitations !

    Here you can find a guide on how to post a good bug report thread.
    Space Engineers version --- Medieval Engineers version
  2. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

[1.185.013] Programmable block triggered twice per tick if you use both internal and external timers

Discussion in 'Bug Reports' started by Blargmode, Nov 17, 2017.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Blargmode Trainee Engineer

    Messages:
    21
    I noticed that my 60 seconds countdown in Aggressive airlocks (which relies on ticks an not actual time) was running at twice the speed.

    This is with a Timer block with "Trigger now" and the new built in timer set to update every tick.

    Reproduction rate:
    3/3

    Affected version: 1.185.013

    Replication:
    Run the script below in a programmable block.
    It shows time since last run in milliseconds in the console.
    1000ms per second / 60 ticks per second = 16. There should be 16ms between each run.

    Code:
    public Program()
    {
        Runtime.UpdateFrequency = UpdateFrequency.Update1;
    }
    public void Main()
    {
        Echo(Runtime.TimeSinceLastRun.TotalMilliseconds.ToString());
    }
    It shows 16 if the game is running correctly.

    Add the Programmable block to the actions of a Timer block with with "trigger now". See how the output changes to 0.

    That means that every tick it runs once, echoing 16ms since last run, then immediately run again, which results in 0ms.
     
  2. abrtn00101 Trainee Engineer

    Messages:
    59
    I think this is expected, since the timer is another update "source." They are treated separately, and I remember (which means I might be wrong) @rexxar saying it's up to you to figure out which one works best for your script.
     
  3. rexxar Senior Engineer

    Messages:
    1,532
    Don't do that.
     
    • Agree Agree x 2
    • Funny Funny x 2
    • Like Like x 1
  4. Blargmode Trainee Engineer

    Messages:
    21
    Yeah of course not. It's pretty pointless in most situations. The problem is when updating scripts from "Trigger now" to the built in timer. If the user doesn't turn off the timer and no checks are in place, it'll do that. Which the scripter might not realize.

    But I guess it might just be a problem for a short while as people are transitioning.
     
  5. rexxar Senior Engineer

    Messages:
    1,532
    There's quite a few ways to get a PB to run multiple times per tick, and I'm looking into a few options for dealing with that problem ;)
     
    • Like Like x 1
Thread Status:
This last post in this thread was made more than 31 days old.