Patch 4


The options system has been completely reworked.  Functions are now provided to allow better control over what gets sent to this mod and how it is displayed.

(help how do I do code blocks on here)

  • option_set(mod_type, mod_name, mod_var, option_name, value)
    • A shorter way to write lq_set(mod_variable_get(mod_type, mod_name, mod_var), option_name, value).
  • option_get(mod_type, mod_name, mod_var, option_name)
    • A shorter way to write lq_get(mod_variable_get(mod_type, mod_name, mod_var), option_name).
  • option_defget(mod_type, mod_name, mod_var, option_name, def_value)
    • A shorter way to write lq_defget(mod_variable_get(mod_type, mod_name, mod_var), option_name, def_value).
  • option_add(mod_type, mod_name, mod_var, mod_display_name, page_name, option_name, json_args)
    • Adds an option to this mod for displaying and manipulating.
    • json_args is either a JSON string or a lightweight object containing details on the option in a similar format to the old version.
    • (Note that the game will give errors if the target mod is missing mod_var or mod_var is missing the field option_name.)
  • option_add_page(mod_type, mod_name, mod_var, mod_display_name, page_name, json_args)
    • Like option_add, but allows for adding an entire page.
    • Functionally identical to option_add if the page only has one option.
    • (json_args is formatted differently than the old version, see example options.mod.gml for details.)
  • option_remove(category_name, page_name, option_name)
    • Removes an option matching option_name from the category's page.
    • (Kept for legacy configuration support.)
  • option_remove_ext(mod_type, mod_name, page_name, option_name)
    • Assumes the category name is mod_name.mod_type.  When true, it's identical to option_remove.
  • option_remove_page(category_name, page_name)
    • Removes an entire page from the category.
    • (Kept for legacy configuration support.)
  • option_remove_page_ext(mod_type, mod_name, page_name)
    • Functions similarly to option_remove_ext, but for pages.
  • option_remove_category(category_name)
    • Removes an entire category from the options controller.
    • Intended for cleaning up when your mod is unloaded.
  • legacy_options_convert(category_name)
    • Converts old configurations to the new structure.
    • (If I did everything correctly nothing will break, and you'll never have to use this yourself.)

NEW STUFF:

  • added a new type of option: keys
    • Has one argument: "style".  Controls whether the game displays the button sprites or the buttons' names.
    • After selected, pressing any mapped buttons will store them in a string.  The keys are separated by "+", so use string_split to make use of more than one button at a time.
    • Must press ENTER/whatever your okay button is to save the option and allow selecting others.
  • nonsync options are now possible by providing the "nonsync" field with it set to true (BE CAREFUL OF DESYNCS)
  • page arrows are now actual arrows instead of "previous" and "next"
  • pages can now have names that will display between the arrows
  • scr_slider, scr_bool, scr_int, and scr_cycle now take lightweight objects/JSON strings for their functionality details
  • added scr_text (only for display purposes, the magic happens in #define chat_message)

FIXES

  • fixed a drawing depth issue that allowed options to overlap
  • made desyncs less likely (where they an issue in the public version?)
  • some other things I forgot

If you find any errors or anything broken please let me know.

Files

custom options.zip (April 2020) 13 kB
Apr 09, 2020
old custom options.zip (December 2019?) 7 kB
Apr 09, 2020

Get Custom Options

Leave a comment

Log in with itch.io to leave a comment.