Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Comments in gmc.cfg

55 views
Skip to first unread message

Needlebat

unread,
Jan 21, 2025, 2:46:31 AMJan 21
to MPF Users
I attempted to make comments in gmc.cfg using the "#" character. I discovered this causes the [section] to cease being parsed past the point of the #. No error is produced.

Is there an appropriate way to comment this file?

Thank you

Johan Gill

unread,
Jan 21, 2025, 2:55:49 AMJan 21
to mpf-...@googlegroups.com
I do use # in several places to make comments in my gmc.cfg without any issues.
Can you try open and save with another text editor?

/JG


--
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/569f956b-8e24-4282-a52c-8245ef762dd9n%40googlegroups.com.
Message has been deleted

Needlebat

unread,
Jan 21, 2025, 4:45:13 PMJan 21
to MPF Users
This section of gmc.cfg with my testing of [keyboard] with 3 comment options:

# comment 1
[keyboard]
# comment 2
comma=["switch", "s_flipper_left"]
# comment 3
period=["switch", "s_flipper_right"]

Without any comment both comma, and period work as expected.
With only comment 1 in place, neither comma, not period work.
With only comment 2 in place, comma does not work, period does work.
With only comment 3 in place, comma works, period does not work.
Adding blank lines between comment and next line has no effect.
Writing out as LF / CRLF . CR has no effect.
Saving with notepad.eve has no effect
Saving as DOS from Gvim has no effect
Saving from notepad++ with EOL set to lf has no effect
Saving from notepad++ with EOL set to crlf has no effect

I'm testing in windows environment.
Message has been deleted

Anthony van Winkle

unread,
Jan 21, 2025, 6:03:11 PMJan 21
to MPF Users
Ah, this is a tricky one.

According to the Godot documentation (https://docs.godotengine.org/en/stable/classes/class_configfile.html#description) a ConfigFile supports comments using a semicolon rather than a hash, but unfortunately if the file is modified and saved by the engine all those comments disappear. I've also noticed that it will change the formatting and ordering of elements according to its preferences.

Modifying the file is of concern because the GMC and MPF panels in the editor save to the config file as well, so that the config file can designate preferences as part of the version control but the user can easily toggle things during development.

I think for most settings the autoformatting is fine, but I see where a user would want to organize the keyboard interface based on their playfield and key choices, including comments that persist. I pondered a couple of ideas, including an under-the-hood system file that keeps a copy of the config (problem: persisting values removed from the main config) or separating editor panel settings from others (problem: inconsistent source of truth), but I think the best approach would be to support an optional, external keyboard.cfg file that would be appended to the gmc.cfg settings. In this scenario, the engine would only ever write to gmc.cfg so any comments and ordering in keyboard.cfg would persist. To avoid possible confusion, the presence of keyboard.cfg would trigger any [keyboard] section in gmc.cfg to be deleted.

It shouldn't take too long to implement that kind of override file, let me know if you think that'll do it!

Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages