Skip to content

Lighting Multiple Timed Shots at the Same Time

Related Config File Sections:

In this mode you can active shots for 3s by hitting a target. We assume that those shots post timerx_start. The mode succeeds when all three shots are active at the same time. Every shot starts a timer and checks if the other two are running.

This is a basic example:

##! mode: my_mode
mode:
  start_events: start_my_mode
  stop_events: my_mode_succeeded
timers:
  t1:
    start_value: 3
    end_value: 0
    direction: down
    control_events:
      - action: restart
        event: timer1_start
  t2:
    start_value: 3
    end_value: 0
    direction: down
    control_events:
      - action: restart
        event: timer2_start
  t3:
    start_value: 3
    end_value: 0
    direction: down
    control_events:
      - action: restart
        event: timer3_start
event_player:
  timer_t1_started{device.timers.t2.running and device.timers.t3.running}: my_mode_succeeded
  timer_t2_started{device.timers.t1.running and device.timers.t3.running}: my_mode_succeeded
  timer_t3_started{device.timers.t1.running and device.timers.t2.running}: my_mode_succeeded
##! test
#! start_game
#! mock_event my_mode_succeeded
#! post start_my_mode
#! post timer1_start
#! assert_mode_running my_mode
#! assert_bool_condition True device.timers.t1.running
#! advance_time_and_run 4
#! assert_bool_condition False device.timers.t1.running
#! post timer2_start
#! post timer3_start
#! advance_time_and_run 1
#! assert_mode_running my_mode
#! assert_bool_condition False device.timers.t1.running
#! assert_bool_condition True device.timers.t2.running
#! assert_bool_condition True device.timers.t3.running
#! post timer1_start
#! assert_mode_not_running my_mode
#! assert_event_called my_mode_succeeded

Something missing or wrong? You can fix it!

This website is edited by people like you! Is something wrong or missing? Is something out of date, or can you explain it better?

Please help us! You can fix it yourself and be an official "open source" contributor!

It's easy! See our Beginner's guide to editing the docs.

Page navigation via the keyboard: < >

You can navigate this site via the keyboard. There are two modes:

General navigation, when search is not focused:

  • F , S , / : open search dialog
  • P , , : go to previous page
  • N , . : go to next page

While using the search function:

  • Down , Up : select next / previous result
  • Esc , Tab : close search
  • Enter : go to highlighted page in the results