Jump to content

MCM script won't compile


randomtguy

Recommended Posts

I used this http://www.nexusmods.com/skyrim/mods/29821/to compile an MCM script, but I can't get the damn thing to compile. I tried studying the script against the MCM tutorial and it all seems fine, particularly the lines that are causing the errors. This is the script:

 

 

ScriptName SimplerSlaveryMCMScript Extends SKI_ConfigBase

int Function GetVersion()
	Return 1 ; Last version
EndFunction

;------------  Private Variables
; OIDs (T:Text B:Toggle S:Slider M:Menu, C:Color, K:Key)
int SRSModEnabled_OID_B
int SRSMinHealthToTrigger_OID_S
int SRSChanceofEnslavement_OID_S

; States
int SRSModEnabled
int SRSMinHealthToTrigger
int SRSChanceofEnslavement

; GlobalVariable States

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

	; Creating pages
	Pages = new string[1]
	Pages[0] = "Page"
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 Page page...
	If ( page == "Page" )
		If (CurrentVersion >= 1)
			SRSModEnabled_OID_B = AddEmptyOption()
			SRSMinHealthToTrigger_OID_S = AddSliderOption("Health threshold", 20)
			SRSChanceofEnslavement_OID_S = AddSliderOption("Chance of enslavement", 20)
		EndIf
		Return
	EndIf

EndEvent

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

	If (option == SRSModEnabled_OID_B )	
		SetInfoText("Activates Simpler Slavery")
		Return
	EndIf
	If (option == SRSMinHealthToTrigger_OID_S )	
		SetInfoText("Minimum health to trigger Simple Slavery. Set to just above the threshold of your defeat mod  ")
		Return
	EndIf
	If (option == SRSChanceofEnslavement_OID_S )	
		SetInfoText("The chance that a combat defeat will lead to enslavement")
		Return
	EndIf

EndEvent

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

	If ( option == SRSModEnabled_OID_B )
		SetTextOptionValue(SRSModEnabled_OID_B, SRSModEnabled)
		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 == SRSMinHealthToTrigger_OID_S )
		SetSliderDialogStartValue(20)
		SetSliderDialogDefaultValue(20)
		SetSliderDialogRange(0, 100)
		SetSliderDialogInterval(1)
		Return
	EndIf

	If ( option == SRSChanceofEnslavement_OID_S )
		SetSliderDialogStartValue(20)
		SetSliderDialogDefaultValue(20)
		SetSliderDialogRange(0, 100)
		SetSliderDialogInterval(1)
		Return
	EndIf

EndEvent

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

	If ( option == SRSMinHealthToTrigger_OID_S )
		SRSMinHealthToTrigger = value
		SetSliderOptionValue(SRSMinHealthToTrigger_OID_S, SRSMinHealthToTrigger, "Every {0}")
		Return
	EndIf

	If ( option == SRSChanceofEnslavement_OID_S )
		SRSChanceofEnslavement = value
		SetSliderOptionValue(SRSChanceofEnslavement_OID_S, SRSChanceofEnslavement, "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}

EndEvent

 

 

 

And these are the errors:
D:\Games\Steam\steamapps\common\skyrim\Data\Scripts\Source\SimplerSlaveryMCMScript.psc(106,2): type mismatch while assigning to a int (cast missing or types unrelated)
D:\Games\Steam\steamapps\common\skyrim\Data\Scripts\Source\SimplerSlaveryMCMScript.psc(112,2): type mismatch while assigning to a int (cast missing or types unrelated)

 

Which must be referencing "SRSMinHealthToTrigger = value" and "SRSChanceofEnslavement = value", which so far as I can tell should be fine.

 

There just seems to be something fundamentally wrong with my Creation Kit setup. The above errors are what happens if I try to compile the script using the script manager, if I try to do it while attaching it to a quest and using [new script] I get the error "Invalid doc string. Doc may not contain any { or } characters", which I know is wrong as there are { and } characters used in the MCM tutorial. I've tried installing SKSE and the SkyUI SDK about a million times, do I need to do anything else? Maybe extract the SkyUI BSA or something like that?
 

 

Link to comment

Your SRSMinHealthToTrigger and SRSChanceofEnslavement variables are integers, but you're trying to feed them a float. You'll want to cast 'value' into an integer before assigning it to your variables. Like this:

 

Line 106:

SRSMinHealthToTrigger = value As Int

Line 112:

SRSChanceofEnslavement = value As Int
Link to comment

 

Your SRSMinHealthToTrigger and SRSChanceofEnslavement variables are integers, but you're trying to feed them a float. You'll want to cast 'value' into an integer before assigning it to your variables. Like this:

 

Line 106:

SRSMinHealthToTrigger = value As Int

Line 112:

SRSChanceofEnslavement = value As Int

 

You're a legend, thanks a bunch.

 

Link to comment

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more information, see our Privacy Policy & Terms of Use