Counters and accessing variables of counter

58 views
Skip to first unread message

driskel

unread,
Jun 11, 2018, 9:38:05 AM6/11/18
to MPF Users
I have a counter in the base mode that is counting down hits until superjets starts. It is working as expecting but I am having a hard time accessing the countdown. I have read the documentation and thought that this approach would work.

Basically, I want to show number of hits left to superjets.

counters:  
    to_super_jets_1_counter
:
        count_events
: sw_pop_active
        direction
: down
        starting_count
: 10
        count_interval
: 1
        count_complete_value
: 0
        persist_state
: True
        events_when_complete
:
            super_jets_1_start
        events_when_hit
:
            countdown_to_superjets  

slides:
    countdown_to_superjets_slide
:
        widgets
:
           
- type: text
              text
: (to_super_jets_1_counter_state)
              anchor_y
: bottom
           
- type: text
              text
: SUPERJETS
              style
: banner
              anchor_y
: top
              color
: red  

slide_player:
    countdown_to_superjets
:
        countdown_to_superjets_slide
:
            target
: dmd
            expire
: 1s

Any suggestions?

Thank you

jabdoa

unread,
Jun 11, 2018, 10:26:48 AM6/11/18
to MPF Users
This is a known limitation at the moment. You cannot reference the counter in MC (where the slide is rendered) and the counter is not using a player variable anymore. There is a workaround here: http://docs.missionpinball.org/en/dev/install/migrate4to5.html#if-you-are-using-counters-in-your-slides-add-a-variable-player. We will change the slide rendering in the future to allow all placeholders on slides.


Jan

driskel

unread,
Jun 11, 2018, 10:34:59 AM6/11/18
to MPF Users
Thank you for the reference point. I will try it out.

Thank you for all help and MPF.

driskel

unread,
Jun 11, 2018, 11:36:16 AM6/11/18
to MPF Users
That worked for me.

Thank you.

driskel

unread,
Jun 11, 2018, 12:11:23 PM6/11/18
to MPF Users
Here is the simple solution, It may be a documentation point:

/config/config.yaml

#config_version=5
       
modes
:
   
- base
   
- super_jets_1

switches
:
    s_jet_lower_left
:
        number
: 26
        tags
: playfield_active, pop
    s_jet_upper_left
:
        number
: 27
        tags
: playfield_active, pop

/modes/base/config/base.yaml

slide_player:
    countdown_to_superjets
:
        countdown_to_superjets_slide
:
            target
: dmd
            expire
: 1s

    super_jets_1_start
:
        super_jets_1_start_slide
:
            expire
: 2s
            target
: dmd

counters
:  
    to_super_jets_1_counter
:

        count_events
: sw_pop_active
        direction
: down
        starting_count
: 10
        count_interval
: 1
        count_complete_value
: 0
        persist_state
: True
        events_when_complete
:
            super_jets_1_start
        events_when_hit
:
            countdown_to_superjets  

slides
:

    super_jets_1_start_slide
:
        widgets
:
           
- type: text
              text
: SUPERJETS
    countdown_to_superjets_slide
:
        widgets
:
           
- type: text
              text
: (player|SUPERJETS_countdown)

              anchor_y
: bottom
           
- type: text
              text
:
SUPERJETS
              anchor_y
: top  

variable_player
:
    logicblock_to_super_jets_1_counter_updated
:
       SUPERJETS_countdown
:
           
int: value
           action
: set
    shot_jet_lower_left_hit
:
        score
: 500
        jets
: 1
    shot_jet_upper_left_hit
:
        score
: 500
        jets
: 1

modes/super_jets_1/config/super_jets_1.yaml

mode:
    start_events
: super_jets_1_start
    priority
: 210
    restart_on_next_ball
: true
   
slide_player
:
    sw_pop_active
:
        super_jets_count_slide
:
            target
: dmd
            expire
: 2s
   
slides
:
    super_jets_count_slide
:
        widgets
:
           
- type: text
              text
: (player|superjets)

           
- type: text
              text
: SUPERJETS


variable_player
:
    shot_jet_lower_left_hit
:
        score
:
           
int: 10000
            block
: true
        superjets
: 1
       
    shot_jet_upper_left_hit
:
        score
:
           
int: 10000
            block
: true
        superjets
: 1


driskel

unread,
Jun 11, 2018, 12:16:30 PM6/11/18
to MPF Users
/modes/bonus/config/bonus.yaml

mode_settings:
  display_delay_ms
: 2000
  hurry_up_delay_ms
: 500
  hurry_up_event
: flipper_cancel
  bonus_entries
:    
     
- event: superjets_bonus
        score
: 1000 * current_player.superjets

slide_player
:
    superjets_bonus
:
        superjets_bonus_slide
:
            target
: dmd
           
slides
:
    superjets_bonus_slide
:
        widgets
:
           
- type: text
              text
: (score)

Greg Sealby

unread,
Apr 7, 2019, 7:27:13 AM4/7/19
to MPF Users
Thanks for posting this Driskel.  I was wondering why this wasn't working and was trying to avoid using a player variable.  Saved me heaps of time.

driskel

unread,
Apr 18, 2019, 10:35:03 PM4/18/19
to MPF Users
Your welcome,

Glad it helped.

jabdoa

unread,
Apr 21, 2019, 5:10:23 AM4/21/19
to MPF Users
Where would you guys like to see this in the documentation? Where would you search for it?

Jan
Reply all
Reply to author
Forward
0 new messages