Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Neverwinter Nights: Enhanced Edition has been released! Visit nwn.beamdog.com to make an order. NWN:EE FAQ is available.
Soundtracks for BG:EE, SoD, BG2:EE, IWD:EE, PST:EE are now available in the Beamdog store.
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

[MOD] Mods Options - BG EE/SOD and BG2 EE/TOB

AncientCowboyAncientCowboy Member Posts: 199
edited July 2016 in UI Modding

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:

  1. I wanted to integrate with the existing Options menus/mechanisms
  2. 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
  3. I wanted to be able to add options for other mods with as little ui.menu hacking as possible.
It became quickly evident that I was faced with 2 development tasks: First, create a generalized Mods Options interface and API for handling arbitrary collections of mod specific options. Second, create a specific collection of options for the "Progress Bar Tweaks" mod. This mod is the first component. The second with be posted shortly as part of an enhancement to the "Progress Bar Tweaks" mod.

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 :smile:), 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 :smile:). 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.

Post edited by AncientCowboy on
mf2112FlashburnJuliusBorisovGrammarsaladbob_vengRaduziel

Comments

  • RatatoskrRatatoskr Member Posts: 286
    It's unlikely I'll be making any mods with this, but I wanted to let you know that your instructions work, even for someone who doesn't really know what they're doing :smile:

    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.

  • AncientCowboyAncientCowboy Member Posts: 199
    @Ratatoskr589 Assuming your keyboard isn't broken :smile: , I'd suggest taking a look at the following:
    • 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!

  • RatatoskrRatatoskr Member Posts: 286
    @AncientCowboy I think it's an issue with my laptop since the default keys seem to override the game ones. I can't use F4 because of that even in full screen mode and I haven't used VM or really modded this game.

    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.

  • AncientCowboyAncientCowboy Member Posts: 199
    @Ratatoskr589 I'm sorry - I didn't understand the issue before. However, now that I do I was able to reproduce it and figure out the problem. The F5 key is the issue. It causes UI.MENU to be re-loaded - thus causing all the Lua code blocks (delimited by `) to be re-run. Thus, the options menus are re-registering themselves and the registration code isn't smart enough (now) to check that the menu has already been registered. The fix will be included in my next update. However, if you want to fix it now, just drop the attached zip in your override directory, delete the existing 'M_ModsOp.lua', and unzip the zip'ed file.
    Enjoy!

    mf2112
  • RatatoskrRatatoskr Member Posts: 286
    @AncientCowboy Glad I could help and thanks for the fix. Even if my F5 is still whacked out, not having the multiple menus will be nice.

  • AncientCowboyAncientCowboy Member Posts: 199

    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!

    mf2112
  • AncientCowboyAncientCowboy Member Posts: 199

    I've posted above new versions of both the BGEE/SoD and BG2EE/ToB mods. The main features are:

    1. The BGEE/SoD version now installs and works correctly in both @Pecca's 'Dragonspear UI++' and @Kerozevok's 'BG2EE GUI To BGEE' environments
    2. The Cancel(left) and Change(right) buttons on the Mods Options main panel (which, in retrospect, never made a lot of sense) have been changed to Change (left) and Done (right).
    3. Fixed a bug in sorting the entries in the Mods Options main panel.

    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.

    mf2112
  • AncientCowboyAncientCowboy Member Posts: 199

    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.

    • UI Edit Mode
    • Debug Mode
    • Extra Combat Information
    • Show Fog
    • Show Date/Time On Pause
    • Disable Area Map Zoom - PST:EE Only
    • Show Triggers On Tab
    • Wild Surge Key
    • Cheats
    • Disable Movies
    • Reverse Mouse Wheel Zoom
    • Strref On
    • Critical Hit Screen Shake
    • HP Over Head
    • Cleric Ranger Spells - BG Only
    • No Difficulty Based XP Bonus
    • Nightmare Bonus XP
    • Nightmare Bonus Gold
    • Extra Feedback
    • Show Learnable Spells
    • Hotkeys On Tooltips
    • Duplicate Floating Text
    • Pausing Map
    • All Learn Spell Info
    • 3E Thief Sneak Attack
    • Brightness Correction - BG Only. Same INI value is available in 'Graphics' option screen for PST:EE but has different effect.
    • Bored Timeout
    • Tiles Precache Percent

    Enjoy!

    elminster
  • MordekaieMordekaie Member Posts: 65
    I have a problem while using the Hidden Game Options from UI tweaks 2.8 on a BGEE+SoD 2.3.67.3B with Modmerge.exe and Lefreut UI.

    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.

  • lefreutlefreut Member Posts: 1,047
    @Mordekaie It seems that it depends on how you exit the game, one of the way is broken. It should be fixed here.

  • MordekaieMordekaie Member Posts: 65
    I will try with the new version of the mod and check the different ways to exit the game (i am probably just using the broken one). Thanks

Sign In or Register to comment.