how would i go on about creating multiple uMCMPopScpt to avoid the max script size problem?
i know they can be added to the uMCMStartupScpt like this:
call xxxuMCMPopEWMain fVersion call xxxuMCMPopEWCompanions fVersion call xxxuMCMPopEWDefaultAll fVersion ;set all values to their defaults
but what about the beggining of xxxuMCMPopEWCompanions:
; let A0ZombieController.ar_main := ar_construct "map" let ar_main := A0ZombieController.ar_main
; creating only menumap, so key is 0 let ar_main[0] := ar_construct "map"
; creating submenu 1: examples of all types let ar_main[0][5] := ar_map "active"::1, "columns"::2, "enable"::1, "listtitle"::"Companion Options (1-30)", "pagetitle"::"Companion Options (1-30)" let ar_main[0][5]["options"] := ar_construct "map" let ar_options := ar_main[0][5]["options"]
and of xxxuMCMPopEWDefaultAll:
; let A0ZombieController.ar_main := ar_construct "map" let ar_main := A0ZombieController.ar_main
; creating only menumap, so key is 0 let ar_main[0] := ar_construct "map" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; if fMode == 0 ; first-time init, defaulting all vars foreach entry1 <- ar_main ; menu
when i try this i get a error in the log:
Error in script 76028C73 (xxxuMCMHandlingEWMain) in mod Endless Warfare MCM.esp Array does not contain key Operator [ failed to evaluate to a valid result Script line approximation: Let ar_options := ##ar_main[iMenu][iSubMenu]["options"]## (error wrapped in ##'s) Where ar_options=uninitialized array, ar_main=array keys [0], iMenu=0, iSubMenu=0 File: Endless Warfare MCM.esp Offset: 0x03DA Command: Let
For some unknown reason i'm getting this error after completing that quest for ranger ghost. Before that everything works fine with the menu:
Error in script 7500109F (uMCMHandlingScpt) in mod Endless Warfare MCM.esp Invalid array access - the array was not initialized. 0 Operator [ failed to evaluate to a valid result Script line approximation: Call ##ar_main[iMenu]## (error wrapped in ##'s) Where ar_main=uninitialized array, iMenu=0 File: Endless Warfare MCM.esp Offset: 0x026B Command: Call
can you please tell me what the "Invalid array access - the array was not initialized. 0" means?
I was wondering for 2 hours whats up then I realized "array_var ar_option" is not written on the standard script.
Then when I solved it the compiler caps out 23kb of source file when the older and common template caps at 27kb. Almost similar character length. I've come to the conclusion this template makes the compiler reach the max size way quicker.
Well, I'm not sure how to feel now. Like I thought this was one of the feature that it allows more size? Yes, I like how readable it is but I ended up searching for a way to double the script size limit (didn't know that was possible) and used that. Maybe add that as a requirement perhaps? The mod is Geck Extender.
uMCM itself obviously doesn't change the size limit of scripts, but it prevents the entire MCM script structure (simultaneously entering and handling the intel) from being spread out over multiple scripts using lots of elseifs, becoming unmanageable. Because MCM scripting of any kind involves functions with string parameters, size was always an issue, and ofc if you enter those string parameteters in an array structure instead, that can still happen. A simple solution would be to outsource some of the pop code to a secondary UDF. Also have a look at the folder about more one-lining.
Script size itself, however, was never the primary concern. Clarity and flexiblity was. For instance, uMCM allows for many more types of data storage than traditional quest vars, and due to everything being in arrays, and the ability to associate player input with the execution of a UDF, you can change any aspect of your MCM menu on the fly, using MCM as a UI for in-game programming. The latter requires a few extra steps though, those are methods I developed since this was first published;
The Geck Extender is not required, so I won't list it as a requirement.
I experienced this as well. I have a 44k character uMCMPopScpt and i get a max script size error on geck extender, while a 63k character script unrelated to uMCM compiles fine. btw i'm using notepad++ and it shows the character lenght at the bottom.
Could you help me out with an advanced use case? I'm trying to read and write variables from "SettingString" instead of "quest" and I go about it like this: First I remove "quest"::uMCMVARZ and then put in its place "SettingString"::fAVDCarryWeightsBase - but it results in the said item not appearing at all, in fact the whole submenu disappears with it (only tested with 1 item in 1 submenu)
I'm using the example scripts provided in "advanced use" folder and they are (or at least seem) to be all set up correctly.
EDIT: if anyone comes across this shame of mine and is in the similar predicament: just put the damn setting name in quotes!
It's the second mod I script using this. It left me a bit overwhelmed at start, I'm slow to change habits, but in the end it is objectively well done and I find it easier to work with it. If I'll find enough time, I'm going to migrate even the past MCMs I did.
17 comments
i know they can be added to the uMCMStartupScpt like this:
call xxxuMCMPopEWMain fVersion
call xxxuMCMPopEWCompanions fVersion
call xxxuMCMPopEWDefaultAll fVersion ;set all values to their defaults
but what about the beggining of xxxuMCMPopEWCompanions:
; let A0ZombieController.ar_main := ar_construct "map"
let ar_main := A0ZombieController.ar_main
; creating only menumap, so key is 0
let ar_main[0] := ar_construct "map"
; creating submenu 1: examples of all types
let ar_main[0][5] := ar_map "active"::1, "columns"::2, "enable"::1, "listtitle"::"Companion Options (1-30)", "pagetitle"::"Companion Options (1-30)"
let ar_main[0][5]["options"] := ar_construct "map"
let ar_options := ar_main[0][5]["options"]
and of xxxuMCMPopEWDefaultAll:
; let A0ZombieController.ar_main := ar_construct "map"
let ar_main := A0ZombieController.ar_main
; creating only menumap, so key is 0
let ar_main[0] := ar_construct "map"
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
if fMode == 0 ; first-time init, defaulting all vars
foreach entry1 <- ar_main ; menu
when i try this i get a error in the log:
Error in script 76028C73 (xxxuMCMHandlingEWMain) in mod Endless Warfare MCM.esp
Array does not contain key
Operator [ failed to evaluate to a valid result
Script line approximation: Let ar_options := ##ar_main[iMenu][iSubMenu]["options"]## (error wrapped in ##'s)
Where ar_options=uninitialized array, ar_main=array keys [0], iMenu=0, iSubMenu=0
File: Endless Warfare MCM.esp Offset: 0x03DA Command: Let
let ar_main := A0ZombieController.ar_main
fixed it.edit: found out that doing this make the game freeze after the first time opening the menu. So it's not a option.
Error in script 7500109F (uMCMHandlingScpt) in mod Endless Warfare MCM.esp
Invalid array access - the array was not initialized. 0
Operator [ failed to evaluate to a valid result
Script line approximation: Call ##ar_main[iMenu]## (error wrapped in ##'s)
Where ar_main=uninitialized array, iMenu=0
File: Endless Warfare MCM.esp Offset: 0x026B Command: Call
can you please tell me what the "Invalid array access - the array was not initialized. 0" means?
Then when I solved it the compiler caps out 23kb of source file when the older and common template caps at 27kb. Almost similar character length.
I've come to the conclusion this template makes the compiler reach the max size way quicker.
Well, I'm not sure how to feel now. Like I thought this was one of the feature that it allows more size?
Yes, I like how readable it is but I ended up searching for a way to double the script size limit (didn't know that was possible) and used that.
Maybe add that as a requirement perhaps? The mod is Geck Extender.
Thanks for the template though.
Script size itself, however, was never the primary concern. Clarity and flexiblity was. For instance, uMCM allows for many more types of data storage than traditional quest vars, and due to everything being in arrays, and the ability to associate player input with the execution of a UDF, you can change any aspect of your MCM menu on the fly, using MCM as a UI for in-game programming. The latter requires a few extra steps though, those are methods I developed since this was first published;
The Geck Extender is not required, so I won't list it as a requirement.
btw i'm using notepad++ and it shows the character lenght at the bottom.
Excellent templates!
Could you help me out with an advanced use case? I'm trying to read and write variables from "SettingString" instead of "quest" and I go about it like this: First I remove "quest"::uMCMVARZ and then put in its place "SettingString"::fAVDCarryWeightsBase - but it results in the said item not appearing at all, in fact the whole submenu disappears with it (only tested with 1 item in 1 submenu)
I'm using the example scripts provided in "advanced use" folder and they are (or at least seem) to be all set up correctly.
EDIT: if anyone comes across this shame of mine and is in the similar predicament: just put the damn setting name in quotes!
It left me a bit overwhelmed at start, I'm slow to change habits, but in the end it is objectively well done and I find it easier to work with it.
If I'll find enough time, I'm going to migrate even the past MCMs I did.