Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

A question on Godot Base slides

70 views
Skip to first unread message

uncivilengineer

unread,
Feb 6, 2025, 12:57:51 AMFeb 6
to MPF Users
I have been playing around with my base scoring slide in GODOT, and I have a question:

I would like to create a static Label that only appears when the number of players in a game is greater than 2.  I'd like to use a MPFConditional node to control turn this label on and off, but I noticed that the game variables are not linked to the MPFConditional variables.   I

How would I go about creating a static label that only appears when the number of players is greater than a certain amount?
thanks,
Alan

Anthony van Winkle

unread,
Feb 6, 2025, 10:54:44 AMFeb 6
to mpf-...@googlegroups.com
It’s true that conditionals don’t subscribe to event updates, but instead are manually updated. You would create a handler in your slide player triggered from the player_added event that calls action: update on the slide/widget holding the conditional.

We could look into having conditionals subscribe to events like variables do, it’s more overhead for the listeners but might be easier to use.

--
You received this message because you are subscribed to the Google Groups "MPF Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mpf-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mpf-users/5827606e-2456-431f-8e48-b6e1c3755d44n%40googlegroups.com.

uncivilengineer

unread,
Feb 7, 2025, 12:27:13 AMFeb 7
to MPF Users
Ok, I am really unclear on how MFPconditinal works in GODOT.
Below is a screen shot of what I am trying to do.Screenshot 2025-02-06 at 7.27.59 PM.png
Player 4 side score is the small score that is located in the lower right hand corner of the screen.  It should only appear when two conditions are meet:  1.  You have at least 4 players (min player is 4) and 2.  The current player number is not 4.  The Player 4 label and the p4 score are both child nodes to the player 4 side score node (a MPFconditional node).  I would expect then that in a 4 player game, this node would be visible when any player but 4 is up.  However what is happening is that the label nodes are still visible even if the min player requirements are not being met.  I am even pushing an manual update to the slide at every ball_started event.

(continued in next message)

uncivilengineer

unread,
Feb 7, 2025, 12:29:16 AMFeb 7
to MPF Users

So for example, in the image below, I  have started a 2 player game:

Screenshot 2025-02-06 at 8.39.34 PM.png

With the second player up, I should see the 1 player side score (which I do), and the 2nd player side score is hidden (like it should be), but I can still see the labels that are child nodes to the player 3 and player 4 side scores.  I know from experience that the player 3 and player 4 score won't appear anyway if there are no players in the game for those scores.  So it seems to me that the child nodes to the MPFconditional are not quite working how I expected them to.  What am i missing here?

If you want to see my code and files, they are at my github here:  https://github.com/UncivilEngineer/hauntedhouse


uncivilengineer

unread,
Feb 7, 2025, 12:37:36 AMFeb 7
to MPF Users
I just noticed in the background of my 2nd image you can see the output window from GODOT, and it sees the minimum player it not being met, and is hiding certain elements.  However they are still appearing in the game screen.

Anthony van Winkle

unread,
Feb 7, 2025, 1:41:01 PMFeb 7
to MPF Users
Thank you for the detailed investigation and repository link! I was able to clone your repo and investigate, and yes there definitely was a bug: MPFConditional would only evaluate the min/max players on initialization, so later on when the underlying condition (current player number) was re-evaluated, the min/max players was skipped and things started showing up when they shouldn't have.

I've just pushed an update to the MPF-GMC repository that includes a fix for this bug, and also includes an update so any MPFConditional with min/max players will automatically re-check itself when the player count changes. So you shouldn't need to use any action: update calls anymore (I removed them from your base.yaml and it still worked as expected).

Thanks for your patience and let me know how it goes!

FWIW I also added this block to your config.yaml to auto-fill a ball in the drain for faster starts during virtual mode :)


virtual_platform_start_active_switches
:
- s_main_outhole

uncivilengineer

unread,
Feb 7, 2025, 2:05:34 PMFeb 7
to MPF Users
Thank Anthony, you are really the life of MPF.
--Alan

Reply all
Reply to author
Forward
0 new messages