Jump to content

[LE] MCM and shrine-menu problems


Recommended Posts

For my mod Vampire Coffin i try to add a MCM menu to give the player some more options.

This is what i want, (don't know if it is possible to do something like this):

 

In the mcm you choose the options you want to see when you activate the shrine in my coffin.

The script for the shrine should check witch options are selected (toggled on) and add those to an array.

At the same time i add numbers to the new array, together with the correct text labels.

Then i add the correct functions so the menu is more then just text.

 

I run into a lot of problems and i need help to fix this mess.

This is my MCM script:

  Reveal hidden contents

 

And this is the script for the shrine:

  Reveal hidden contents

 

I added some notes inside the code to explain what i try to do.

Both scripts compile just fine, there are no errors.

 

Some of my problems:

When i exit the mcm and activate the shrine as a vampire it looks like the options are passed correctly from mcm to the shrine, but when i open the mcm again, all options are set to default again. It is supposed to remember what i selected before.

When i activate the shrine as vampire i see all the test notifications just fine, but i always see all of them. not just the ones corrosponding with the options selected in the mcm.

At the same time all the functions are started. The If/Else to select the correct functions is being ignored.

 

All this mess is just my attempt to make a new array with only the selected mcm options. I still need a way to display the new array as a menu, but i don't know how to do that.

It would not surprise me if i do this all the wrong way. For some reason i always over-complicate things while there is an easier way to do what i want.

Edited by ZombieNL
Link to comment
Share on other sites

So even after 2 days, still 0 reactions?

Do i need to explain better what i try to do?
Is it even possible what i want?
If it is possible, am i on the right path, or do i need to rebuild my script with totaly different functions/code to make it work?

I am completely stuck on this project with no idea what to try next, so any help or info is welcome.

Link to comment
Share on other sites

script as follow is not tested, not compiled yet

 

You are missing the initialization of second temp array, and for sure good luck with "Now I need to convert the array to a visible menu."

No idea how you wish to manage this. Splitting code in functions is really nice, but overview should be given too.

 

VC_Script_Shrine_MolagBal

  Reveal hidden contents

 

Edited by ReDragon2013
Link to comment
Share on other sites

Your new version compiles just fine, but i have some questions:

Do i realy need to check if the shrine is activated by the player?
The shrine is located in my pocket dimension. The only NPC in there is my thrall, but she is behind a locked door. Followers should not follow you inside the coffin, but i guess it is not 100% impossible that it can happen. But even if a NPC activates the shrine, what is the harm in that?

I never used states before, what does it do?

Creating a new function to call the individual functions is a nice idea, but still they all get activated. not just the ones i select in the mcm menu.

Here is the new version. I did not just copy/paste your script, but merged it into my own.

 

 

  Reveal hidden contents

 

string[] VampireMenu = new String[128]

Did fix the array, but then you give the array 128 rows by default?
I left that out, because you can't know in advance how many rows the array will get.

The first debug while loop works fine, displaying the correct bool values.
When you open the mcm menu again, you no longer see wich options you selected earlier, but all options are set to default again.

The next while loop is still a problem.
If i select all 6 options
the new menu is build, but at the same time all functions are activated as well.
The last debug while loop works as intended.
If i select 0,1,2,3,4 or 5 options
The menu acts like all options are set to default

I still have no idea how to convert the array to a menu. I was hoping someone on this forum can help me with this.
What do you mean with this?:

  Quote
"Splitting code in functions is really nice, but overview should be given too."

 

 

Link to comment
Share on other sites

No idea if your situation has been resolved or not. At any rate, the reason your initial MCM was reverting the choices was due to the following:

 

                If VampireVal1 == True
                    VampireVal[1] = True
                    VampireVal1 = False
                Else
                    VampireVal[1] = False
                    VampireVal1 = True
                EndIf

The nature of the options are that you make a selection and the bool changes to true or false depending upon the selection made. This bool value is what tells the MCM to display the correct option status. By changing the value inside the option selection, you are effectively telling the MCM that the choice was not made.

 

It should have been as follows:

 

                If VampireVal1 == True
                    VampireVal[1] = True
                Else
                    VampireVal[1] = False
                EndIf
Link to comment
Share on other sites

  On 4/5/2019 at 2:15 AM, IsharaMeradin said:

 

No idea if your situation has been resolved or not. At any rate, the reason your initial MCM was reverting the choices was due to the following:

                If VampireVal1 == True
                    VampireVal[1] = True
                    VampireVal1 = False
                Else
                    VampireVal[1] = False
                    VampireVal1 = True
                EndIf

The nature of the options are that you make a selection and the bool changes to true or false depending upon the selection made. This bool value is what tells the MCM to display the correct option status. By changing the value inside the option selection, you are effectively telling the MCM that the choice was not made.

 

It should have been as follows:

                If VampireVal1 == True
                    VampireVal[1] = True
                Else
                    VampireVal[1] = False
                EndIf

The problem was not solved yet, you gave the solution. Thnx!

 

 

  On 4/5/2019 at 2:50 AM, foamyesque said:

 

I'm not totally sure why there's the independent boolean variables at all. Why not the single array? Maybe another for reset-to-default information. Then you could just do

VampireVal[n] = !VampireVal[n]

The initial bools are there for when you load the mcm for the first time. The mcm should have some initial values to build the menu. I chose to make the initial values the same as the default values because i think that makes sense.

 

I don't know how to implement your suggestion into my script. I don't understand your comment enough.

 

Here is my new MCM code:

 

  Reveal hidden contents

 

 

 

I also noticed another problem. When i move my cursor over one of the options in the mcm, i see the correct InfoText, but when my cursor is not on one of the options it should activate this bit of code:

    Else    
            SetInfoText("This MCM menu can be used to choose which options you want to see when you activate the Molag Bal Shrine.")
    EndIf

But it never shows the text at all. I know it's only a minor thing, but still i would like it to work.

Link to comment
Share on other sites

That is not how OnOptionHighlight works. It will only display text when an option is highlighted. If you put the mouse over any non-option area, no text will display. Unfortunately, it is working as intended.

 

You could devise a message box that pops up when the MCM is opened for the first time (not every time) which will inform the user of what you wish.

My Aesthetic Bolt Quiver mod has a working example of this. Relevant code snippet is as follows:

 

bool DisplayMessage = false
 
event OnPageReset(string a_page)
    {Called when a new page is selected, including the initial empty page}
    If DisplayMessage == false
        ShowMessage("$Notice",false)
        DisplayMessage = true
    EndIf
;etc...
Link to comment
Share on other sites

  On 4/5/2019 at 1:45 PM, IsharaMeradin said:

 

That is not how OnOptionHighlight works. It will only display text when an option is highlighted. If you put the mouse over any non-option area, no text will display. Unfortunately, it is working as intended.

Thnx for explaining this, but in that case i just leave it as it is now.

My mcm is easy enough to understand as it is. The InfoText was just a litle extra.

 

If the code you showed is producing the message in screenshot 7/9 from your mod-page, then i don't understand why you made it. Isn't this the way all mcm menu's work?

First you need to exit all menu's before you can notice any changes.

 

I think i prefere to explain my mcm menu in the description of my mod page. That should be enough.

Link to comment
Share on other sites

I have doubt that next is changing the option text inside the MCM menu you like. Why?

If you end the function VampireMenu() each temp array is thrown away.

 

 

  Reveal hidden contents

 

 

everything you made with

string[] VampireText
string[] VampireMenu

keeps in this function and will never get transfer to MCM script

Edited by ReDragon2013
Link to comment
Share on other sites

  • Recently Browsing   0 members

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