[MOD] Mods Options - BG EE/SOD and BG2 EE/TOB
As I began thinking about how I would implement a promised graphical UI to configure the various "Progress Bar Tweaks" options, I determined there were 3 things that were important:
- I wanted to integrate with the existing Options menus/mechanisms
- I wanted a flexible, extensible system. In the future, I'll develop other mods with options. Writing essentially the same code twice is once too often
- I wanted to be able to add options for other mods with as little ui.menu hacking as possible.
This mod, labeled "Mods Options" for lack of imagination on my part, inserts additional buttons on both the start up and in game 'Options' displays as shown below:
Upon clicking the MODS button, a screen is displayed that lists all of the registered mod options sets (implemented as UI menus), along with a Change button (enabled when a mod option set is selected) and the obligatory Cancel button:
As part of the testing/verification of this mod I created 2 simple options menus. One, which is just an extension of the Mods Options mod allows disabling the start up, the in game, or both MODS buttons. Select the 'Mods' entry on the main Mods screen, followed by the Change button and you'll see one of the following:
Of course, if you disable both, the only way to get either back is by manually editing Baldur.lua, setting 'ModOptions','Disable Ingame Menu' or 'Disable Start Menu' to 0.
The second options menu, entitled 'Hidden Game', doesn't apply to a mod, but rather, provides a method of changing some of the otherwise 'hidden' Program/Game options in Baldur.lua. The menu appears as below and is pretty obvious:
To install Mods Options, grab the relevant attached zip(s), and follow the instructions in the 'Installation.txt' file ModsOptions folder within the zip. For more information, check out the announcement post below.
The remaining part of this post is basically talking about how Mods Options works and how it can be 'modded' or used in/for other mods. So if that kind of stuff doesn't interest you (meaning you're a normal, healthy human being ), have a great day!
First off, all of the code in the attached zips is free to be used, abused, renamed, re-painted, or incorporated into other code. In other words - I relinquish all exclusive rights (that should satisfy my lawyer son ). On to the important stuff. The Options setting mechanism for a particular mod is, as mentioned earlier, a menu defined in ui.menu. In particular, it must be a modal menu that is able to be safely invoked via 'Infinity_PushMenu ' and returns/exits via 'Infinity_PopMenu'. To facilitate the discussion, below is an implementation of the ubiquitous 'Hello World' written as a mod option:
` if(modOptionsRegisterMenu) then modOptionsRegisterMenu('Hello World', 'OPTIONS_HELLO', "The famous Hello World", 0) end ` menu { name 'OPTIONS_HELLO' modal align center center button { area 0 0 300 100 fill 43 0 90 255 text style title text lua 't("Hello, World!")' action "Infinity_PopMenu()" } }
The menu itself is obvious - a purple button displaying "Hello, World!" that closes when you click it. In fact, you can paste this code to the end of ui.menu, and assuming you've installed Mods Options, it will show up in the main Mods screen, and when you select it and 'Change' - will display a fairly ugly and totally useless button on top of everything. And wait for you to click it. The interesting part is what precedes the menu declaration - the Lua code. After ensuring that the function 'modOptionsRegisterMenu' exists (to prevent errors/crashes if not present for some reason), it invokes the function with 4 arguments.
The first argument is required and is the mod name - that is, the name you want to appear in the main Mods Options screen list of mods. It can be a literal value (as above) or it can be the key to a string registered in uiStrings.
The second argument, also required, is the string that appears in the 'name' field of the menu definition. It will be the argument supplied to 'Infinity_PushMenu'.
The third argument is optional. It is the string which appears in the 'Help/Info' text area in the main Mods Options screen.
The fourth argument, also optional (defaults to 0), is a number that indicates whether the menu entry should available from the start menus (1 or "1"), the in game menu (2 or "2") or both (0 or actually anything that isn't 1, "1", 2, or "2).
Notice that the menu, which does the actual option setting, knows nothing and receives nothing from Mods Options. Similarly, Mods Options knows nothing about the menu other than what is passed via modOptionsRegisterMenu. Thus, the menu is free within the context of 'Infinity_PushMenu/Infinity_PopMenu' to do whatever it likes - so long as the environment is in the same state on exit as on entry. Similarly, any UI that implements modOptionsRegisterMenu and that can call 'Infinity_PushMenu' passing the registered menu name will be compatible with Mods Options menus.
Have fun - and let me know what you think and if you encounter problems.
Comments
The one issue seems to be the UI Edit mode on the Hidden Game Options. When I turn it on, I show 4 of each option (Hidden Game, Mod Option, and Progress Bar tweaks) in the menu while F5 and F11 don't do anything. However, that could be an issue with my game because I haven't been able to make Edit Mode work the normal way either.
- The obvious, but I have to ask - have you mapped F5/F11 to something else in the game?
- If you're using virtual machines, are the keys being trapped by your VM implementation?
- If you're using a virtual console, is it trapping the keycodes?
- Do you have drivers/managers/emulators running for gamepads, joysticks, special mouse/keyboard behaviors? If so, it/they may be the problem.
- Although not likely, could another BG mod be grabbing the keystrokes?
Anyway, those are the areas I'd check out - at one time or another I've had all but the last cause issues. Good luck!The lack isn't really an issue for me, but I thought I'd mention it since it seems odd that trying to use the UI Menu creates 4 copies of each hidden game option in the menu and someone else might have the same problem.
Enjoy!
I've attached updated versions of Mods Options zips to the original posting. The new versions feature 2 changes.
First and most visible is that the installation is now via WeiDU. It patches - not replaces - UI.MENU. As WeiDU v. 239 (the current non-beta version) does not support extracting UI.MENU from the game files, it will be necessary to use NearInfinity or F11 prior to running setup-ModsOptions.exe. If you've manually installed the prior version of Mods Options, you can still update your installation with setup-ModsOptions.exe with no ill effect.
The other change is to fix various F5 issues - the fix I supplied above for @Ratatoskr589, and some additional visual issues. If you don't use F11/F5 editing and have previously installed Mods Options, there is no reason to update
As noted in the Installation.txt file (within the ModsOptions folder), if you have any issues with the patching, please zip/rar/whatever the DEBUG file and you UI.MENU and message me with them.
Thanks - and Enjoy!
I've posted above new versions of both the BGEE/SoD and BG2EE/ToB mods. The main features are:
The installation for the 'BG2EE GUI To BGEE' environment is visually identical to the BG2EE/ToB installation.
The 'Dragonspear UI++' installation is different. Because one of the goals behind developing Mods Options was to avoid having multiple paths/methods to interactively configure mods, and because I did not want to conflict with @Pecca's vision of how options should be set, buttons are not added to the start-up and in-game options displays. Rather, I overlap the UI SETTINGS button on the Gameplay options panel with a MOD OPTIONS button (both with conditional enables), and then add the UI Settings menu as one of the items in the Mod Options main panel. I also removed Cheats as an option in the Hidden Options panel as it already appears in UI Settings.
Here's what it looks like:
If you're familiar with installing WeiDU mods, you'll find nothing surprising in the installation. If not, within the ModOptions directory/folder you'll find a file named 'Installation.txt' that will walk you through the process. As before, you'll need to have a copy of UI.MENU in your override directory.
Enjoy - and give me a shout if you have any difficulties.
P.S. For the few who may be interested - this version uses a much cleaner, simpler version of the WeiDU 'ACuimenulib.tph' library. While not where I ultimately want it to be, it is much closer than the earlier (admittedly experimental) version.
Version 2.4 of EEUITweaks features support for Mods Options and Hidden Options on Planescape:Torment Enhanced Edition; and a greatly extended set of Hidden Options across all platforms.
Due to the circular layout of the options menu in PST:EE, I couldn't just add a generic 'Mods Options' button to the options panels without it looking bad. So instead I created a small 'Mods' button, styled identically to, and positioned on the bottom of the screen symetrically with the 'Version' label - as shown below:
For the Hidden Options, the following list indicates the options that are now supported, and where applicable, restrictions on the games (Baldur's gate series or Planescape:Torment) for which the option is meaningful and available.
Enjoy!
I can access to the hidden game options menu and i can select or unselect all of the options.
But it seems to have no effect on the game. If a quit and start the game (for the effects to be effective) it appears that the hidden game options didn't recorded my choices.