OSP Kit Optimisation ModMerger framework 0.2.5

Users who are viewing this thread


Grandmaster Knight
"Keep your hands off my source (files)!"


Caba`drin said:
I never have quite understood why sphere's creations didn't get a bit more attention when they came out, but in any case, I have found his ModMerger framework to be extraordinarily useful...so useful that I added a few functions and patched a few bugs I noted in the current wrappers, and I figured I might as well release it aside from any of my mods that get packaged with it in case others might find it useful.

ModMerger additions (to the 0.2.5 hotix'd version)

Two files are changed from the standard ModMerger download
and a new file

The changes include:
Two New Wrappers
Three New Wrapper Functions
One new general function

One new utility function set

A few small bugfixes to wrappers and their functions

  • Added jrider's New Presentations
  • Added XGM: Mod Options
  • Fixed some vanilla version issues.  It should work with pre-warband versions again, though there might still be undiscovered bugs.  please help me by feeding back. thanks!

ModMerger framework is just a glorified name for a bunch of python scripts/file arrangement that aims to provide an example for modders on how to keep their modded contents out of each others and also out of the original source files, so that 0-config porting to newer game versions or mixing non-conflicting mods can be possible. (even where not, probably less effort to do actual port, once set up that is)

In plain english, it just means that when done properly, people can be lazy when installing mini-mods coz they don't have to following long-winded instructions to do lots of manual edits.

This is the link to the original ramblings (only for those with nothing else better to do):

Note: Before anything, backup your existing files!!!
Make sure your current build has no prob (build_module.bat can build the module successfully)

1)  download, extract and place all the files in the module system directory
2)  execute "modmerger_installer.py".  If you have .py files properly associated with python, you just have to double click it in file explorer
3)  there is a simple menu, read and respond.

Immediately after "installation", run your build_module.bat to see if anything is broken.  If not, you should be good.

To add a ModMerger-wrapped mod, just place the mod files (should not overwrite any original source) and add the mod-id to modmerger_options.py (more instructions in readmes)

Current "MM-modpacks" using ModMerger:

Problems, suggestions, feedback welcome.  If any python gurus have any ideas to make this even simpler, (enter auditorium mode, increase reverb)
It is time for an Alliance, a Revolution, to Chase the Dream that the Chore of manually Porting/Merging Mods will be a Thing of the Past
(insert auditorium echoes: Past past past past....). 
and of course, we could also fail miserably at the end  :roll:

Change log
+ Fixed bug with mission_templates's variable list for vanilla versions (thanks to motomataru).
+ Fixed error with vanilla for missing info_pages and postfx modules.
+ Fixed use of map without assignment in header file (may cause prob with earlier python?).

+ Added GameMenuWrapper to util_wrappers.
+ Added MissionTemplateWrapper to util_wrappers.
+ Fixed bug with PresentationWrapper.FindTrigger always returning first trigger.

+ First release.


Grandmaster Knight
MM-Modpack: rubik's Battle Minimap (from Custom Commander)

Expose mod options via "camp" if xgm_mod_options is also active.

version 1.1 - http://www.filedropper.com/mmccminimap110
version 1.0 - http://www.filedropper.com/mmccminimap100




Grandmaster Knight

This is not a "content" mod.  This is a framework for users to define and add powers to items, or item-sets without scripting.


Item powers:

Item Sets


Grandmaster Knight

What is this?
Allows modders to expose their mod's options/parameters via a generic presentation "MOD option" accessible from "Camp" menu.
The basic presentation is adapted from rubik's Custom Commander which is a toy-store of excellent features.

Turn this:
mod_options = [   
    # sample checkbox to switch the in-game cheat mode.  Comment out this if you don't want it.
    ( "op_cheatmode", xgm_ov_checkbox ,  [],
        "Enable cheat mode:", 0,        
        "This sets the in-game cheat mode", 0,
        [  # initialization block (set value in reg1)
            (assign, reg1, "$cheat_mode"),
        [  # update block (value is in reg1)
            (assign, "$cheat_mode", reg1),            
    ( "op_line_cc_battle_minimap", xgm_ov_line ),
    # checkbox for minimap
    ( "op_cc_show_battle_minimap", xgm_ov_checkbox ,  [],
        "Show battle minimap:", 0,        
        "This sets whether the minimap will always be shown during battle.", 0,
        [  # initialization block (set value in reg1)
                (gt, "$g_show_minimap", 1),
                (assign, "$g_show_minimap", 1),
                (ge, 0, "$g_show_minimap"),
                (assign, "$g_show_minimap", 0),
            (assign, reg1, "$g_show_minimap"),
        [  # update block (value is in reg1)
            (assign, "$g_show_minimap", reg1),                        
        "cc", # custom commander page

    # number box for minimap size
    ( "op_cc_battle_minimap_size", xgm_ov_numberbox ,  [cc_minimap_min_ratio, cc_minimap_max_ratio + 1],
        "Size of battle minimap (%):", 0,        
        "This percentage modifies the size of battle minimap", 0,
        [  # initialization block (set value in reg1)
                (gt, "$g_minimap_ratio", cc_minimap_max_ratio),
                (assign, "$g_minimap_ratio", cc_minimap_max_ratio ),
                (gt, cc_minimap_min_ratio, "$g_minimap_ratio"),
                (assign, "$g_minimap_ratio", cc_minimap_min_ratio),
            (assign, reg1, "$g_minimap_ratio"),
        [  # update block (value is in reg1)
            (assign, "$g_minimap_ratio", reg1),            
        "cc", # custom commander page
] # mod_options


without any further scripting

  • Define mod options via an abstracted structure (similar to other data in module system)
  • XGM autogenerates presentation
  • Includes a demo entry to toggle in-game cheat-mode
  • Should be compatible with most existing mods (via ModMerger)

The width of the pane/size of controls etc can be adjusted via xgm_mod_options_header.py for advanced users.
The space on the right is intended for selecting option pages in the future (categorize options into pages)


Grandmaster Knight
Lumos said:
This should work for other presentations except module options, right?

The "xgm mod options" part only contains the bare framework to expose the global options.  It does not contain jrider's presentations, which is in another package that is almost finished, but not released yet due to a possible bug which I'm waiting for jrider''s confirmation.  After we figure out and fix the problem (over in jrider's thread), I'll put up the package which includes all 4 of jrider's new presentations.


I don't want jrider's presentations (for now... :smile:), I want o make my own presentations using your controls! And they will be for 1.011. So, can I make other presentations with this or what?


Grandmaster Knight
Lumos said:
I don't want jrider's presentations (for now... :smile:), I want o make my own presentations using your controls! And they will be for 1.011. So, can I make other presentations with this or what?

hmm I think I think I totally misunderstood what you want :smile:  Let's try to clarify.

The current version only supports adding user options to a fixed presentation.  So if you want to use this for your own presentations (to display your own mod options for example), you will have to copy and modify on your own. (the coding is almost the same, you just need to create a new "empty" presentation and change the generation scripts to add to your new presentation.  But just as a sneak preview, I plan to extend the current mod options to support "pages" of options, so that mods who define options can also declare which page it is supposed to belong to.  The final presentation will have switches between pages so that when a page is active, only the options belonging to the page will be shown (e.g. if your mod has a lot of options, it will be advisable that they are classified under the a specialized "page").  Not sure if this is what you want though.

But if you just want a means of generating generic presentations for your own use, it could be better if you just hand-place/design it?  Due to the fact that "mod options" was meant to collect all the options defined by different mods, it doesn't have a lot of freedom in the overlay layout.

Or what you may really want is something like be able to specify a presentation layout using arrays and make and let some framework generate the presentation for you?  Though it IS possible to move into that direction, it is not so simple if you want to be able to handle all the triggers properly.  the current "mod options" is simple coz it only handles 2 triggers (on load and on state change).  But in the end, if it needs to be so general, it may just become ..... the current presentation structure in module_presentations...

EDIT: btw, I have not verified whether ms 1.011 has all the same overlay operations as the current warband.  If some overlays are missing or behavior different, I will need to add in workarounds to make it version-sensitive


Grandmaster Knight
Can be done, but not current framework not exposed to that extent yet. 

In that case, I think you don't need to "install" the mod options kit, but rather, can make use of the python functions directly.  I could give you the steps, but I need to know what you really plan to do.  It will involve some manual changes to the python functions in there to make use of the generation functions in "xgm_mod_options_presentations.py" to generate the scripts so that they can be inserted into your own presentation.

If you have some knowledge of python, you should concentrate on "xgm_mod_options_presentations.py" to try to adapt it for your own use (e.g. you could easily change the target presentation or the list of "mod_options" used for the generator functions "generate_presentations", "generate_presentation_load_script" and "generate_presentation_event_state_change_script").  I can give more detail instructions, but kindoff tired atm, so would rather do it if you are sure you want to go ahead.

If that is too troublesome, I can only say sorry as it cannot be easily done now until I generalized some of the functions to allow creation of more generic "mod_option" like presentations.  I can't promise "asap" here as it is of lower priority than some other stuff.  But it will probably be after "mod_options" 2.0, where some of the stuff required in 2.0 can probably be retrofitted for a more general option presentation generator.


Grandmaster Knight
Fearelement said:
Stupid question.... What am I supposed to do if my files appear as Notepad, no matter how I do it?

Either you have not installed python, like Lumos have said, or you messed up your python installation's association of .py files with python.exe.

Easy way is to uninstall python (if you have previously installed) and reinstall it again.


Actually, if you've changed the default open with settings for .py files by accident, or intentionally like myself, you should just be able to right click on the file in question and under the "Open with" sub-menu choose python.exe.

That is of course assuming you've installed python...


holy **** this is awesome  :razz: when I'm not lazy I'll try to do something amazing too

Damn, this is some really advanced stuff. I give you a deep bow for this.  :razz:


A number of files are no longer hosted at the posted links. Can someone please re-upload them? I am specifically looking for the MM mini map files.
Top Bottom