Jump to content

MCM: Is there a plain text option


darkling3100

Recommended Posts

Your running this on a save that has not had your menu run on it yet?

OnConfigInt() only runs once initially on the menu initialization.
So for example if you've been working on your menu and you hadn't added the array at that point, then load a save and you saved and exited the game..
Then you edit your mcm script and add the Array in the OnConfigInit() and then go and load that prior save the array wouldn't be initialized.

That's the only thing that comes to mind.


Side note:
Also unless it's changed since SkyUI 5, that 0 index with an empty string wouldn't show an empty entry in the Select Menu when opened.
(Pretty sure that null strings in the array are omitted being added to the selection menu, well they were the last time I wrote a MCM menu script, might want to check that though as I'm not 100% sure)

If your wanting so nothing is selected in the menu when it's opened or a way the user can select nothing after they have clicked something in the Menu then set:
SetMenuDialogStartIndex(-1);
SetMenuDialogDefaultIndex(-1);

This makes it so say the user selects something in the Menu then they decide they want to select nothing, then the Select Menu Default button will make it so nothing is selected.

Basically when nothing in the menu is selected and they close the selection menu it returns -1

So in your menu close event you can check the index for -1 and bail out instead of passing -1 as an array index (which causes errors).
-1 = nothing selected

 

Other Menu Option notes:

You can add more then 128 to a selection menu by using SKSE Utility.Create/ResizeStringArray() function

(Tried with 500+ Array fed to the MenuOption and works fine in the brief i tested of it))

 

Other Pages Notes:

You can add more then 128 Pages to you mod menu by using the same SKSE Utility.Create/ResizeStringArray() function.

(I tried 5000+ pages and it works fine in brief testing, but takes for ever to scroll to the page you want)

 

You can't add any more then 128 controls on a page though :sad:

 

 

General chat:

I've done similar in a follower mod I've written for myself.

Basically covers quite a few of the Actor Values in 1 page with sliders.

Last count i had 86/163 actor values (a lot of the others are redundant or just stat read only) or you could adjust on anyone, eg: target someone and hit a key or read an actor ref from the console or select one of the followers from already added in my mod.

 

After you have a target you can adjust any actor value on them in MCM.

I sort of put it aside as the min and max of each slider setting per actor value was doing my head in.

That and a lack of information on what min and max of some of those actor values can be.

Means the good old fashioned load game and see what values do and their effective limits..lol

Edited by sLoPpYdOtBiGhOlE
Link to comment
Share on other sites

What I've been doing is using COC MolagBalVoiceCell (just because it's the cell you edit on the CK tut) so I believe it should take it as a new initialization every time.

 

And yeah I wasn't aware of the discrepancy with MCM and blank strings although I would think I could replace the null strings with a single space and try that. I've basically created the first index (0) for just a no selection option so that I don't have to change the display Options depending on if the user has made a choice or not.

 

With the notes I luckily don't think I'll need to create that many options.

 

But yes this is basically the idea of my mod. More to be a replacement for the console window. I'm startign with the player (AVs and items) and will expand to NPCs, saves, and things like teleportation(COC). Shouldn't be too much work once I get the hang of the data structures of the CK and the quirks of Papyrus. Anyway thank you again. I'll try editing my script tommorow as it's been a very hectic work week and will report back.

Link to comment
Share on other sites

I'm glad the SkyUI team fixed the SetOptionFlag(), 4.1 it just didn't work (for me anyway) and I ended up always having to call ForcePageReset() anytime I wanted a control state changed.

5 it works like a dream :)

 

Been writing an MCM for a crappy little mod released not long ago.

And it's coming along nicely.

Was hoping to use the text input control, but really have no need for it in this mod...doh.

 

What I meant with the OnConfigInit() was if your game save already has loaded your menu and you have saved.

Then consecutive loading of that save then OnCofigInit() won't be fired again.

So if you change or add something and your expecting OnCofigInit() to be called again, it won't be.

Makes no dif if you COC to another cell or not,.

If the save has already called OnConfigInit() then it won't be called again (unless you manually call it yourself).

Basically the same as the standard OnInit() event that you use in any other script.

 

Myself when I'm working on a MCM menu I use a save that hasn't run my menu and I don't save.

Each time I load my edited MCM menu I load the save that has not run my MCM menu.

Link to comment
Share on other sites

:P Isn't that how it always goes when there's a new feature you want to try.

 

The problem with them not displaying turned out to be the null strings but it seems they work now. Unfortunately I have to do a forced page reset any time a value is changed but I guess it doesn't seem to hurt anything.

 

And I'm sorry, I didn't explain that correctly. I mean I COC directly from the main menu where you continue, new game, load game, and such. It creates a new player in the specified cell which is great for testing something like a MCM menu.

 

Unfortunately the lack of string manipulation is a problem now. I have a description for the actor values and if the string runs past the half way column mark it cuts it off. I was thinking if I needed to I could create another text field but I can't find a way to find how long the string is. I guess I may have to attach a number to each description index to denote how many lines to use unfortunately.

 

All part of the game I guess. What is the mod you are working on though?

Edited by darkling3100
Link to comment
Share on other sites

Other work around ways to display text for a control...
Use your control as a key note and use OnOptionHighlight(Int Option) event to display more info with the SetInfoText() in the the bottom of the MCM menu.

So for example you have the Opening Page with a few separate text or any other controls ...
Aggression
Enchanting
Smithing

When you point at the control more info displays in the Info text box at the bottom of MCM.
Info text box fits around 4 lines of text and supports new line \n
Not the greatest solution, but it's just another way to handle getting brief info to the user.

Edited by sLoPpYdOtBiGhOlE
Link to comment
Share on other sites

For string manipulation SKSE StringUtil functions offers limited support for it.

StringUtil :

 

Scriptname StringUtil Hidden

; Note about the internal Skyrim implementation of the string classes used for scripting:
; the strings are case-insensitive.  Each BSFixedString is managed in a cache and reused
; everywhere it is needed.  This means that strings like "O" and "o" are technically equivalent;
; Which string is used depends greatly on which version is found first.  We are investigating
; how to manage this, but for the time being be aware that the distinction between uppercase
; and lowercase may not exist.  It also means that functions below returning an integer
; for the character may not correspond exactly.  Also GetNthChar("Hello Skyrim!", 4) will
; return a string with either "O" or "o" depnding on which might be registered first.  All
; my tests so far have it return the uppercase, eventhough in the string it is lowercase.
; We may solve this problem by switching back to returning an integer rather than a string
; for GetNthChar, but this will still have problems.

; return the length of the string
int Function GetLength(string s) global native

; returns a single character string with the character at index
string Function GetNthChar(string s, int index) global native

; Functions to work on Chars
; returns information about a specific character
; assumes a single character string.  If a multicharacter string is passed
; the information about the first character is returned
bool Function IsLetter(string c) global native
bool Function IsDigit(string c) global native
bool Function IsPunctuation(string c) global native
bool Function IsPrintable(string c) global native

; returns the index of the first character of toFind inside string s
; returns -1 if toFind is not part of the string or if startIndex is invalid
int Function Find(string s, string toFind, int startIndex = 0) global native

; returns a substring of the specified string starting at startIndex and going for len characters
; or until the end of the string.  Default len of 0 means for the entire string
string Function Substring(string s, int startIndex, int len = 0) global native

; returns the numeric value of the first character as an int
int Function AsOrd(string c) global native

; returns a single character string interpreting c as a character
string Function AsChar(int c) global native

; returns array of strings separated by the specified delimiter
string[] Function Split(string s, string delim) global native

 

 

 

I use the string split function a fair bit when I do MCM stuff.

Mainly due to no array in array or mixed data types, so I do the ultimate sin and create a delimited string with my values.

I stick the string of delimited values in an array element and when I process a set of controls I find my index based on a set of controls and then split the returned element and loop through the split casting as I go (which I despise doing).

 

Doing this crap mainly due to there are no Getter functions for controls (eg: Get value, Get State) in MCM and it's up to the user to store states and values.

Edited by sLoPpYdOtBiGhOlE
Link to comment
Share on other sites

A note, unrelated to menu options:

 

Putting a semi-colon at the end of your lines of code is not necessary in Papyrus. I understand if you have the habit from other languages, but it's really needless.

Link to comment
Share on other sites

Wow... I looked all around for something like that and decided to not even look through the SKSE sources. I've started to move to the OnOptionHighlight method though and will probably just hard code all of the line breaks where this would have fit in.

 

And damn man, I guess that's probably one of the easiest ways to do it though. Moving away from objects is a severe pain in the ass and even a tiny bit of object code could easily get rid of all that. Unfortunately not knowing how many controls you have before hand really limits how you can track two values to an object.

 

And I know Mattie. Coming from C type languages to Papyrus it just comes naturally but it's also helped me get through noting and commenting faster also. Just add a space and throw the note on the end of the line and come back to it later. I guess I may go back through on release and remove all of the unnecessary semi-colons just to reduce file size a bit but they don't really hurt anything or cause confusion.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...