Jump to content

MCM Tutorials?


Recommended Posts

Greetings fellow modders!

 

I've been dusting the web for a few hours reading what seems to be MCM tutorials, except they explain very little on how to get from point A to point, they usually start off somwhere inbetween and does not elaborate enough, leaving you there hanging.

 

Don't get me wrong, those tutorials got me far, but not far enough. I've made my MCM Menu, and as far as i know a scripted quest that should talk with the MCM script, but i already have a script in my mod that i also want this to talk with, but somehow I'm not able to figure out how and for that i need help.

 

The script is on a marker that fires after doing a time check, how can i get the MCM to read that quest and change it's values? It's not as simple as a "scripname blabla Extends blabla2" that much i figured out. There must be something I'm missing here.

 

There is also lacking a lot of papayrus tutorials out there, those simple tutorials with "hello world" just does'nt get me where i want unfortuantly.

 

Is there any "hidden" tutorials out there that goes more in depth so someone with just basic papayrus skills can understand?

 

 

 

Thank you very much in advance!

 

Necrocytosis.

Link to comment
Share on other sites

  • Replies 40
  • Created
  • Last Reply

Top Posters In This Topic

There are a ton of tutorials everywhere. My site, Skyrim MW, I'm about to publish a scripting guide, Cipscis, DarkFox127, etc.

 

The MCM QuickStart/page/examples can do everything you need. It's pretty simple.

 

That said, what values are you trying to change? On a script on a quest? Make property of type ScriptOnQuestName and then to change variables in it:

 

ScriptOnQuestNameProperty.someVariable = 8399

Link to comment
Share on other sites

Thanksfor the Reply! I've read some from Cipscis, I actually learned most of the beginner stuff from him after reading the creation kit official papayrus guides.

 

I have managed to make a Menu already, that is done. In the quickstart tutorial he also states that usually you make a quest that you bind those scripts to. But i have a master file with a script bound to it. The problem is that i have no clue how to get all those scripts working together.

 

Simply put:

 

I got one script that disables and enables objects at certaint times during day/night, this is based on Cipscis script actually.

 

You can see the script below.

 

 

 

Scriptname ImmersiveContentLightMasterParent extends ObjectReference  
{Controls a set of lights with a master enable parent marker with this
script attached to turn on and off at the times of the day specified
by the properties LightsOffTime and LightsOnTime}
 
float Property LightsOffTime = 6.0 auto
{The time at which lights should be turned off}
float Property LightsOnTime = 20.0 auto
{The time at which lights should be turned on}
 
float Function GetCurrentHourOfDay() global
{Returns the current time of day in hours since midnight}
 
	float Time = Utility.GetCurrentGameTime()
	Time -= Math.Floor(Time) ; Remove "previous in-game days passed" bit
	Time *= 24 ; Convert from fraction of a day to number of hours
	Return Time
 
EndFunction
 
Function RegisterForSingleUpdateGameTimeAt(float GameTime)
{Registers for a single UpdateGameTime event at the next occurrence
of the specified GameTime (in hours since midnight)}
 
	float CurrentTime = GetCurrentHourOfDay()
	If (GameTime < CurrentTime)
		GameTime += 24
	EndIf
 
	RegisterForSingleUpdateGameTime(GameTime - CurrentTime)
 
EndFunction
 
Event OnInit()
 
	If (GetCurrentHourOfDay() > LightsOffTime)
		GoToState("LightsOff")
	Else
		GoToState("LightsOn")
	EndIf
 
EndEvent
 
State LightsOff
 
	Event OnBeginState()
		Disable()
		RegisterForSingleUpdateGameTimeAt(LightsOnTime)
	EndEvent
 
	Event OnUpdateGameTime()
		GoToState("LightsOn")
	EndEvent
 
EndState
 
State LightsOn
 
	Event OnBeginState()
		Enable()
		RegisterForSingleUpdateGameTimeAt(LightsOffTime)
	EndEvent
 
	Event OnUpdateGameTime()
		GoToState("LightsOff")
	EndEvent
 
EndState

 

 

 

What am i trying to do or what do i want?

 

Well i want the time to be adjusted through the slider that i added to the MCM menu, so if you use the mod you can choose when the disable/enable event is supposed to happen.

 

also want the oppertunity to disable the script, so it's not running at at all if one wish to, but this is not the most important one, the one above is the main reason i want an MCM menu.

Scripting is the main reason why i suddenly loose all motivation and go dormant for a few months until i try again, i really need to sit down and learn everything so i can understand it all. ^^

 

Link to comment
Share on other sites

Like I said, you make a property in your MCM script:

 

ImmersiveContentLightMasterParent Property LightsScript Auto

 

Be sure you fill the property. Later on, to set the value:

 

LightsScript.LightsOffScript = someFloat

Link to comment
Share on other sites

Right, but i still don't understand how the MCM script actually talks with the lightson and lights off variables, do i name these variables in the mcm script? Sorry new to MCM and never really learned that much scripting, so there is a ton i don't understand unfortunatly.

Link to comment
Share on other sites

You should learn more scripting.

 

What I was showing is making a PROPERTY (http://www.creationkit.com/Variables_and_Properties) for the script holding the variables you want to access. You're saying "this property is holding the value of my script" - the same way a property or variable can hold a number, or an object reference. Then you say: "In this script (using the property you made for it), I want to access this function/property". The property is ALLOWING YOU TO ACCESS THE OTHER SCRIPT, because you have the reference of the script.

Link to comment
Share on other sites

One more time for good measure as Im seeing this constantly as I browse old and new threads. FILL. THE. PROPERTY.

 

edit: this is the only exception I can think of.

Scriptname SomeAliasScript extends ReferenceAlias

MyQuestScript Property Manager Hidden
	MyQuestScript Function Get()
		return (GetOwningQuest() as MyQuestScript)
	EndFunction
EndProperty

Event OnInit()
    string IAmStoringAValue = Manager.SomePropertyOnTheQuestScript
    Manager.SomePropertyOnTheQuestScript = "I am Setting a new value"
EndEvent
Link to comment
Share on other sites

 

One more time for good measure as Im seeing this constantly as I browse old and new threads. FILL. THE. PROPERTY.

 

edit: this is the only exception I can think of.

Scriptname SomeAliasScript extends ReferenceAlias

MyQuestScript Property Manager Hidden
	MyQuestScript Function Get()
		return (GetOwningQuest() as MyQuestScript)
	EndFunction
EndProperty

Event OnInit()
    string IAmStoringAValue = Manager.SomePropertyOnTheQuestScript
    Manager.SomePropertyOnTheQuestScript = "I am Setting a new value"
EndEvent

And the OP will not need to be using a full property in most cases.

 

 

But yes, like I said before. Ensure you're actually filling this property. There should only be one object in the dropdown to fill a property for you, so it shouldn't be a problem.

Link to comment
Share on other sites

Thank you for the help, i really appriciate it. I have made a few scripts earlier, but those were very simple, so I'm very familiar with the properties as i have to use them all the time.

 

What i do mean by connecting the scripts is how for example does the light script know how to change it's float value when you drag the sliders that is controlled by the MCM, my problem is actually seeing the logic, which again comes from lacking skills in this area as well of course, but usually in most scripts i see the logic behind it all even if I'm not good at doing this myself.

 

I'm linking the script from my MCM menu that i made using an editor:

 

 

 

ScriptName ICROL_MCM Extends SKI_ConfigBase

ImmersiveContentLightMasterParent Property LightsScript Auto

int Function GetVersion()
	Return 2 ; Last version
EndFunction

;------------  Private Variables
; OIDs (T:Text B:Toggle S:Slider M:Menu, C:Color, K:Key)
int ModEnabled_OID_B
int Keymap_OID_K
int LightOn_OID_S
int LightOff_OID_S

; States
int ModEnabled
int Keymap
int LightOn
int LightOff

; GlobalVariable States

Event OnConfigInit()
	{Called when this config menu is initialized}

	; Creating pages
	Pages = new string[1]
	Pages[0] = "General"
EndEvent

Event OnVersionUpdate(int version)
	{Called when a version update of this script has been detected}

EndEvent

Event OnPageReset(string page)
	{Called when a new page is selected, including the initial empty page}

	; Building General page...
	If ( page == "General" )
		If (CurrentVersion >= 2)
			ModEnabled_OID_B = AddEmptyOption()
			Keymap_OID_K = AddKeyMapOption("Keyboard Shortcut.", 0)
			LightOn_OID_S = AddSliderOption("LightsOn", 0)
			LightOff_OID_S = AddSliderOption("Lights Off", 0)
		EndIf
		Return
	EndIf

EndEvent

Event OnOptionHighlight(int option)
	{Called when highlighting an option}

	If (option == ModEnabled_OID_B )	
		SetInfoText("You can turn off the scripts controlling the lights if you want to.")
		Return
	EndIf
	If (option == Keymap_OID_K )	
		SetInfoText("You can add a keyboard shortcut to disable\enable tihs mod if you wish.")
		Return
	EndIf
	If (option == LightOn_OID_S )	
		SetInfoText("Set the Time you want lights to turn on.")
		Return
	EndIf
	If (option == LightOff_OID_S )	
		SetInfoText("Set the time you want Lights to turn off.")
		Return
	EndIf

EndEvent

Event OnOptionSelect(int option)
	{Called when a non-interactive option has been selected}

	If ( option == ModEnabled_OID_B )
		SetTextOptionValue(ModEnabled_OID_B, ModEnabled)
		Return
	EndIf

EndEvent

Event OnOptionDefault(int option)
	{Called when resetting an option to its default value}

EndEvent

Event OnOptionSliderOpen(int option)
	{Called when a slider option has been selected}

	If ( option == LightOn_OID_S )
		SetSliderDialogStartValue(0)
		SetSliderDialogDefaultValue(0)
		SetSliderDialogRange(15, 23)
		SetSliderDialogInterval(1)
		Return
	EndIf

	If ( option == LightOff_OID_S )
		SetSliderDialogStartValue(0)
		SetSliderDialogDefaultValue(0)
		SetSliderDialogRange(12, 4)
		SetSliderDialogInterval(1)
		Return
	EndIf

EndEvent

Event OnOptionSliderAccept(int option, float value)
	{Called when a new slider value has been accepted}

	If ( option == LightOn_OID_S )
		LightOn = value
		SetSliderOptionValue(LightOn_OID_S, LightOn, "Every {0}")
		Return
	EndIf

	If ( option == LightOff_OID_S )
		LightOff = value
		SetSliderOptionValue(LightOff_OID_S, LightOff, "Every {0}")
		Return
	EndIf

EndEvent

Event OnOptionMenuOpen(int option)
	{Called when a menu option has been selected}

EndEvent

Event OnOptionMenuAccept(int option, int index)
	{Called when a menu entry has been accepted}

EndEvent

Event OnOptionColorOpen(int option)
	{Called when a color option has been selected}

EndEvent

Event OnOptionColorAccept(int option, int color)
	{Called when a new color has been accepted}

EndEvent

Event OnOptionKeyMapChange(int option, int keyCode, string conflictControl, string conflictName)
	{Called when a key has been remapped}

	If (option == Keymap_OID_K)
		bool continue = true
		If (conflictControl != "")
			string msg
			If (conflictName != "")
				msg = "This key is already mapped to:\n\"" + conflictControl + "\"\n(" + conflictName + ")\n\nAre you sure you want to continue?"
			else
				msg = "This key is already mapped to:\n\"" + conflictControl + "\"\n\nAre you sure you want to continue?"
			EndIf

			continue = ShowMessage(msg, true, "$Yes", "$No")
		EndIf
		If (continue)
			Keymap = keyCode			
			SetKeymapOptionValue(Keymap_OID_K, keyCode)
		EndIf
		Return
	EndIf

EndEvent

 

 

 

I'm going through scripting tutorials as i write this, knowledge needs to be aquired.

the script above gets a ton of error message in the compiler though, so I'm looking over it in Notepad ++ atm as well.

Thanks again for all the help, i do really appriciate it. :)

Link to comment
Share on other sites

Say you have a float property in the Light Script that is called "LightSetting".

lets say the LightSetting property can be anywhere from 0.00 up to 1.00

 

Then something like this (I trimmed all the other stuff and only left the relevent to what you asked):

The below would be using the LightSetting property to report values in MCM

ScriptName ICROL_MCM Extends SKI_ConfigBase

ImmersiveContentLightMasterParent Property LightsScript Auto

Int oiSlider

Event OnConfigInit()
    Pages = new string[1]
    Pages[0] = "General"
EndEvent

Event OnPageReset(string page)
    If Page == Pages[0]
        AddHeaderOption("General Settings")
        oiSlider = AddSliderOption("Some Light Setting", LightsScript.LightSetting, "{2}")
        AddEmptyOption()
    EndIf
EndEvent

Event OnOptionSliderOpen(int option)
    If option == oiSlider
        SetSliderDialogStartValue(LightsScript.LightSetting)
        SetSliderDialogDefaultValue(LightsScript.LightSetting)
        SetSliderDialogRange(0.0, 1.0)
        SetSliderDialogInterval(0.01)
    EndIf
EndEvent

Event OnOptionSliderAccept(int option, float value)
    If option == oiSlider
        LightsScript.LightSetting = value
        SetSliderOptionValue(Option, LightsScript.LightSetting, "{2}")
    EndIf
EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...