When is a timer's start value initialized?

10 views
Skip to first unread message

Ryan McQuaid

unread,
Feb 27, 2020, 2:06:07 PM2/27/20
to MPF Users
I'm trying to make a timer who's duration is variable depending on some other conditions:


timers:
  speed_breakthrough_timeout
:
    start_value
: (current_player.speed_breakthrough_time)
    end_value
: 0
    direction
: down
    tick_interval
: 1s
    start_running
: false
    restart_on_complete
: false
    control_events
:
     
- event: speed_breakthrough
        action
: restart

I have confirmed that my speed_breakthrough_time variable is working and contains the expected values, however when this timer is started it always uses the variables initial value. Are timers initialized (and therefore the variable read) before they are started? Can you use a variable for start time? If not I suppose I could find another way to do this. Maybe a counter that has a 1s decay timer...

jabdoa

unread,
Feb 27, 2020, 4:44:53 PM2/27/20
to MPF Users
Timers are initialized during mode start I think. It will evaluate placeholders at that time. I think you can use control_events to set the value based on a variable. That is kind of undocumented though.

Jan

Reply all
Reply to author
Forward
0 new messages