Jump to content

Creating a simple MCM menu?


ErraticFox

Recommended Posts

Could someone point me in the direction of just creating a simple MCM menu from scratch? It's really hard to find a tutorial involving creation of a MCM menu. The SkyUI git page is somewhat confusing to a beginner. I want to make a mod, but the mod is basically a MCM menu with a couple toggles for stuff. Could someone please get me rolling? i.e. How to create some simple toggles, and implement the menu into SkyUI inside the game.

Link to comment
Share on other sites

Very simple.

 

If you have any particular questions about that, feel free to ask me.

That's exactly what I was following. Coming from a person that's never created a scripted mod, this a horrible start in my honest opinion (that may be rather a harsh way to put it, sorry).

 

Firstly, it doesn't tell you what file extension you should be using/what you should be saving the file as.

Secondly, it does not tell you how to get it ready to implement it in to SkyUI MCM.

Thirdly, also coming from a guy whom again, has never done a scripted mod, let alone load this into Creation Kit.

 

I sound like an ass, I know. I'm just trying to be straight to the point so I can figure this stuff out so I can help in the modding community. I really want to know this stuff more for the reason of I want to go back and fix broken mods that have been abandoned by their creators and never to return. I want to give back to the community and I want to do it this way any help is very helpful to me and I'd be very gracious of it.

Edited by ErraticFox
Link to comment
Share on other sites

 

Very simple.

 

If you have any particular questions about that, feel free to ask me.

That's exactly what I was following. Coming from a person that's never created a scripted mod, this a horrible start in my honest opinion (that may be rather a harsh way to put it, sorry).

 

Firstly, it doesn't tell you what file extension you should be using/what you should be saving the file as.

Secondly, it does not tell you how to get it ready to implement it in to SkyUI MCM.

 

If you don't know what file extension you should save it as, you shouldn't be creating an MCM yet. It's a normal Papyrus script.

 

Start here. Once you're done you should retry the MCM and probably understand. It's not meant to be for very beginning people. It's meant for people who have scripted Papyrus scripts before.

Link to comment
Share on other sites

And that tutorial is showing people how to build things the old way which is much harder than the new state system. It really should be updated. The first part about setting up the quest script and player alias with its script is still good, but the details of how to set up options in the quest script are really bad.

 

 

The MCM script I added for my newest mod is pretty simple, it has 4 toggle options (one of which is disabled based on the state of one of the others) and a "button" to immediately reset Serana's spells.

 

I find using working examples to be the easiest way to learn so here's a version of that script with extra comments to explain why I've included the various parts.

 

ScriptName CDCSeranaSpellSelectorMCM extends SKI_ConfigBase
; This is my script for my SeranaLearnsSoulCairnSpells mod so I named the script 
; with my initials and something descriptive about its purpose.


DLC1SeranaLevelingScript Property DLC1SeranaRef Auto
; Values being configured here are actually in the script attached to Serana.
; Alternately you could have the values stored in global variables and use a set
; of properties here pointing to each of those variables. All of my values are
; going to be the bool type and linked to toggle controls to enable or disable
; features of my mod.


; Any properties here and another one called "ModName" have to be filled in the CK.
; ModName is what will show in the left column of the MCM.
; My ModName is filled with "$Serana's Spells" and the $ in front of that and many of the
; other strings below are to allow for easier mod translation. When reading this script
; it also lets you easily see which parts are actually going to show up on screen.

Int Function ConjureFlag()
; Used so that the Prefer Conjuring option can be disabled when Allow Conjuring is set to false.
; This is a slightly more advanced idea, but not that uncommon so I have left it for this example.

	if DLC1SeranaRef.AllowConjuring
		return OPTION_FLAG_NONE
	else
		return OPTION_FLAG_DISABLED
	endif
EndFunction


Event OnPageReset(String a_page)
	; The event is what determines the layout of the MCM page for the mod. It is possible to have
	; more than one page, but since I only have one I do not need to worry about the a_page variable.

	SetCursorFillMode(TOP_TO_BOTTOM)
	; Puts everything in the left column instead of alternating columns.

	AddToggleOptionST("AllowRaiseDead", "$Allow Raise Dead", DLC1SeranaRef.AllowRaiseDead)
	; The first string matches a state name below, the second is what will show on-screen, and the
	; third is a bool property in the Serana leveling script.

	AddToggleOptionST("AllowConjuring", "$Allow Conjuring", DLC1SeranaRef.AllowConjuring)
	; Adds a second toggle control tied to another bool variable.

	AddToggleOptionST("PreferConjuring", "$Prefer Conjuring", DLC1SeranaRef.PreferConjuring, ConjureFlag())
	; The third toggle control gets a fourth parameter that will disable this control if the AllowConjuring
	; option is false.

	AddToggleOptionST("AllowAreaSpells", "$Allow Area Spells", DLC1SeranaRef.AllowAreaSpells)
	; Nothing new here, just another toggle control linked to a variable in the Serana leveling script.

	AddEmptyOption()
	; This leaves a blank space between the toggles and the next control.

	AddTextOptionST("UpdateNow", "$Update Spells Now", "")
	; This text option will act like a button. It is not linked to a variable but it does have a
	; matching state below.
EndEvent


State AllowRaiseDead
	; The three events related to the option for Allow Raise Dead are handled here.

	Event OnHighlightST()
		SetInfoText("$Serana starts with her default Raise Dead spells.")
		; this changes the text at the bottom of the MCM page when the player focuses on this control.
	EndEvent

	Event OnSelectST()
		; This gets called when the user clicks on the toggle control to change it.

		DLC1SeranaRef.AllowRaiseDead = !DLC1SeranaRef.AllowRaiseDead
		; Since it is a toggle control, the value of the bool variable just needs to be swapped.

		SetToggleOptionValueST(DLC1SeranaRef.AllowRaiseDead)
		; This updates the display to show the new value of the variable.
	EndEvent

	Event OnDefaultST()
		; This is called when the user uses the reset to default option for the control.
		; The default for this one is true and the variable and display have to be updated.

		DLC1SeranaRef.AllowRaiseDead = true
		SetToggleOptionValueST(true)
	EndEvent

EndState


State AllowConjuring

	Event OnHighlightST()
		SetInfoText("$Serana learns the Soul Cairn spells with the player.")
	EndEvent

	Event OnSelectST()
		DLC1SeranaRef.AllowConjuring = !DLC1SeranaRef.AllowConjuring

		SetOptionFlagsST(ConjureFlag(), true, "PreferConjuring")
		; The SetOptionFlagsST function is used so that the Prefer Conjuring control is enabled
		; or disabled based on how the Allow Conjuring option is set.

		SetToggleOptionValueST(DLC1SeranaRef.AllowConjuring)
	EndEvent

	Event OnDefaultST()
		DLC1SeranaRef.AllowConjuring = true
		SetOptionFlagsST(OPTION_FLAG_NONE, true, "PreferConjuring")
		SetToggleOptionValueST(true)
	EndEvent

EndState



State PreferConjuring

	Event OnHighlightST()
		SetInfoText("$Serana will stop raising dead after learning the Soul Cairn spells.")
	EndEvent

	Event OnSelectST()
		DLC1SeranaRef.PreferConjuring = !DLC1SeranaRef.PreferConjuring
		SetToggleOptionValueST(DLC1SeranaRef.PreferConjuring)
	EndEvent

	Event OnDefaultST()
		DLC1SeranaRef.PreferConjuring = true
		SetToggleOptionValueST(true)
	EndEvent

EndState


State AllowAreaSpells

	Event OnHighlightST()
		SetInfoText("$Serana can learn the Chain Lightning and Ice Storm spells.")
	EndEvent

	Event OnSelectST()
		DLC1SeranaRef.AllowAreaSpells = !DLC1SeranaRef.AllowAreaSpells
		SetToggleOptionValueST(DLC1SeranaRef.AllowAreaSpells)
	EndEvent

	Event OnDefaultST()
		DLC1SeranaRef.AllowAreaSpells = false
		SetToggleOptionValueST(false)
		; This option is the only one that defaults to false in my mod.
	EndEvent

EndState


State UpdateNow
	; This is the text control that is being used as a simple button.

	Event OnHighlightST()
		SetInfoText("$Update her spell list immediately.")
	EndEvent

	Event OnSelectST()
		DLC1SeranaRef.OnLockStateChanged()
		; This a call to an event in the Serana leveling script which reassigns spells.
		; The leveling script is using OnLockStageChanged instead of a more descriptive
		; function name so that users can also reset her spells from the console if they
		; are not using the MCM. (Unlock from the console will trigger that event and
		; are not very many other ways to get a Papyrus function to run from the console.)
	EndEvent

	Event OnDefaultST()
		DLC1SeranaRef.OnLockStateChanged()
	EndEvent
EndState
I wish the forum's code highlighter knew how to parse out the comments better, that's a little hard to read and looks a lots longer and more complex than it really is with all of those comments in it.
Link to comment
Share on other sites

 

 

Very simple.

 

If you have any particular questions about that, feel free to ask me.

That's exactly what I was following. Coming from a person that's never created a scripted mod, this a horrible start in my honest opinion (that may be rather a harsh way to put it, sorry).

 

Firstly, it doesn't tell you what file extension you should be using/what you should be saving the file as.

Secondly, it does not tell you how to get it ready to implement it in to SkyUI MCM.

 

If you don't know what file extension you should save it as, you shouldn't be creating an MCM yet. It's a normal Papyrus script.

 

Start here. Once you're done you should retry the MCM and probably understand. It's not meant to be for very beginning people. It's meant for people who have scripted Papyrus scripts before.

 

The Hello World tutorial is useless and ends abruptly. The main thing that pissed me off with papyrus when I started out was that it seriously felt like it was intended for seasoned coders. Beginners have no chance in hell, and pretty much have to rely on existing code to learn from. Also, experienced coders(no offense but this is something that is well known) have a tendency to assume everyone knows everything that they know, completely forgetting that there is such people as beginners. They will not go in-depth about hardly anything code related, leaving a beginner lost and frustrated.

Link to comment
Share on other sites

 

 

 

 

 

 

Very simple.

 

If you have any particular questions about that, feel free to ask me.

That's exactly what I was following. Coming from a person that's never created a scripted mod, this a horrible start in my honest opinion (that may be rather a harsh way to put it, sorry).

 

Firstly, it doesn't tell you what file extension you should be using/what you should be saving the file as.

Secondly, it does not tell you how to get it ready to implement it in to SkyUI MCM.

If you don't know what file extension you should save it as, you shouldn't be creating an MCM yet. It's a normal Papyrus script.

 

Start here. Once you're done you should retry the MCM and probably understand. It's not meant to be for very beginning people. It's meant for people who have scripted Papyrus scripts before.

The Hello World tutorial is useless and ends abruptly. The main thing that pissed me off with papyrus when I started out was that it seriously felt like it was intended for seasoned coders. Beginners have no chance in hell, and pretty much have to rely on existing code to learn from. Also, experienced coders(no offense but this is something that is well known) have a tendency to assume everyone knows everything that they know, completely forgetting that there is such people as beginners. They will not go in-depth about hardly anything code related, leaving a beginner lost and frustrated.

I'd never coded before in my life before I started that tutorial. Worked out fine for me. If that doesn't help, there are plenty all over the Internet.

Link to comment
Share on other sites

There is a visual tool that generates the code for you. You just choose which controls you wish to add. You can then of course tweak the code afterwards should you want to: http://www.nexusmods.com/skyrim/mods/29821/? I haven't had chance to properly test it yet but it looks promising.

Link to comment
Share on other sites

The Hello World tutorial tells you exactly everything you need to add a script to the game, which should answer several of your questions. Maybe you should consider the possibility that you're going to have to learn some scripting basics before you start making MCM menus. For example you should probably know:

 

What an event is and how they are called

What a property is and how they are filled

What the different types of variable are

What a function is and how it is called

 

You can research these on the CK wiki.

Link to comment
Share on other sites

There is a visual tool that generates the code for you.

The problem with tools is that you still need to understand how things fit together or they aren't going to help.

 

And that specific tool is generating the old original style of code which is much harder to work with than the new style.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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