gill.nu

  • start
  • content
  • about
  • clock_mpf

    Mission Pinball Framework doesn’t have any native way to use time and dates.
    To get around the lack of it I did my own code so I could use time and date for high scores and status screen in game.

    It works great and I share the code I wrote on my github at clock_mpf.

    clock_mpf runs as it’s own mode. I run it with game_mode: false so it can be run when my machine starts.
    Just copy the files or code from GitHub and create a clock folder inside your modes folder where you put the folders/files and then add/activate the mode in your config.yaml (or whatever file you use).

    #example of modes: in config.yaml
    modes:
      - clock #Dont forget to add me! 

    The GitHub code has some example how to use it in clock.yaml.
    Here is how it’s built…

    1. When event mode_clock_started happens it first sets the time.
    2. Event mode_clock_started starts a timer that loops and every time it completes with event timer_set_clock_time_complete it writes the time to the machine variable named time_variable.
    3. Machine variable set_date is written to every time time_variable is saved using the event time_variable_saved.
    4. You can always trigger set_date or set_clock with your own events.
      Just use event_player (or some other player) and set_date or set_clock.
    #from clock.yaml
    
    event_player:
        time_variable_saved: set_date #Set the date when time_variable is written.
        timer_set_clock_time_complete: set_clock #write time to set_clock when timer is complete.
        mode_clock_started: set_clock #At start of mode so it doesn't take 10 seconds (timers time) to set clock and date.

    set_date and set_clock writes date and time to machine variables named time_variable and date_variable. Use it in any way you want.

    #from: clock.yaml
    machine_vars:
        time_variable:
            value_type: str
            initial_value: banan
            persist: true      
        date_variable:
            value_type: str
            initial_value: banan
            persist: true     

    Questions? Make a comment.

    Johan Gill

    10 September 2025
    Pinball
    No comments on clock_mpf
    clock_mpf, English content, GitHub, Homebrew Pinball, Instruction, Mission Pinball Framework, Pinball
  • How to hide mouse cursor in Godot Media Controller

    This is a repost of my instruction that originally were posted in July 2024 and hosted at GillPinball Atlassian Confluence.
    Instruction is written for GMC/Godot Media Controller and MPF/Mission Pinball Framework (https://missionpinball.org/) but shouldn’t differ much if programing anything else in Godot.

    1. Load your MPFWindow scene in Godot.
    2. Add any Child Node, I suggest you add a label.
    3. Make the label hidden so it don’t show up in all your scenes.
    4. Right click on your Label and choose Attach script. Create the gd-script.
    5. Go to Script at the top or double click the script in the FileSystem (inside Godot).
    6. Add a function like below…. if you have another node than Label the extends differs.
    GDScript
    extends Label
    
    func _ready():
          Input.mouse_mode = Input.MOUSE_MODE_HIDDEN

    Johan Gill

    9 September 2025
    Pinball
    No comments on How to hide mouse cursor in Godot Media Controller
    English content, Godot, Homebrew Pinball, Instruction, Mission Pinball Framework, Pinball

(c) Johan Gill