Jump to content

MCM Toggle Script Help?


Recommended Posts

Posted

Tired to do this myself, but I'm at my wits end,  Probably (hopefully) something simple I'm missing too. O_o

 

Here's the deal; I'm working on the MCM Menu for my Dawnguard Sentries mod that I've mentioned in previous posts.  I've gotten the shell quest to hold the MCM menu set up and I had (have) a blank MCM Menu in-game at this point too.

 

I've been working on my first toggle option, which I thought I had figured out.  Apparently not, lol.  This toggle is the main reason for the MCM also.  The toggle is to make the Sentries essential.  I set up a separate quest to do that & used quest aliases to flag them as essential while the quest is running.  I've tested THAT quest out via console commands & it works flawlessly.  So far so good.

 

I can't seem to get the coding right for the toggle to trigger / stop the quest, or even get the toggle option to show in the MCM since the script won't compile.   I'm trying to reference a few different sources to do this but they all leave things half explained or contradict each other.  And people wonder why some of us complain on the Nexus forums about the difficulty of learning scripting beyond the very basics. :\

 

Enough whining though.  Here's my script and the compile error message I'm getting:

 

 

Scriptname DawnSentryMCM extends SKI_ConfigBase 
{Creates Dawnguard Sentries MCM Menu}

 

bool EssentialSentry = false

Event OnPageReset(String a_page)

 

     SetCursorFillMode(TOP_TO_BOTTOM)

 

     AddHeaderOption("Dawnguard Sentries")

 

     SetCursorPosition(3)
     AddToggleOptionST("MakeEssential","$Essential Sentries", EssentialSentry)

 

EndEvent

State MakeEssential

 

Event OnHighlightST()
     SetInfoText("$Makes all unique Sentries Essential")
EndEvent

 

Event OnSelectST()
     EssentialSentry = !EssentialSentry
       if (EssentialSentry == True)
             DawnSentryEssentialToggleQuest.Start()
       else (EssentialSentry == False)
             DawnSentryEssentialToggleQuest.Stop()
      EndIf
      SetToggleOptionValueST(EssentialSentry)
EndEvent

 

Event OnDefaultST()
      EssentialSentry = False
      SetToggleOptionValueST(False)
EndEvent

 

EndState

 

 

 

Compiling "DawnSentryMCM"...
C:\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\DawnSentryMCM.psc(29,7): required (...)+ loop did not match anything at input '('
No output generated for DawnSentryMCM, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on DawnSentryMCM
      

 

 

 

I tried to use states becuase it's supposed to be better organized / like using structured programming.  *shrug*   I figure one of two things happened here; I either FUBAR'ed this so bad I'm up for noob of the year, or I'm pretty dang close and just missing a property assignment or something. 

Posted

try this

 

Scriptname DawnSentryMCM extends SKI_ConfigBase 

int EssentialOID

bool Property MakeEssential = false auto

event OnPageReset(string page)
SetCursorFillMode(TOP_TO_BOTTOM)
EssentialOID = AddToggleOption("$Make_Essential" , MakeEssential)
endEvent 

event OnOptionHighlight(int option)
if (option == EssentialOID)
SetInfoText("$ToggleEssential")
endIf
EndEvent

event OnOptionSelect(int option)
if (option == EssentialOID)
if MakeEssential == false
EssentialQuest.Start()
MakeEssential != MakeEssential
elseif MakeEssential == true
EssentialQuest.Stop()
MakeEssential != MakeEssential
endif
endif
SetToggleOptionValue(option, MakeEssential)
endevent

Quest Property EssentialQuest Auto

 

Posted

In regards compilation errors, the error message is your friend.

 

DawnSentryMCM.psc(29,7) refers to line and character position.

"not match anything at input '('" means the compiler didn't expect that '('

 

  else (EssentialSentry == False)
elsif
Posted

A sincere and hearty thanks to both of you.  Papyrus drives me nuts.  I look at it as an OLD school programmer who hasn't done any coding in decades and all I see ON THE SURFACE is something that looks like a stripped down version of BASIC, reduced to if then statements, gosub routines, and call routines.  The trouble is, there's a hundred different ways to do each of those things and you have to use the right option(s) for each specific case.  Bethesda says they made a simple scripting language, but I see a Gordian Knot made out of infinite square knots, lol.  I guess it'll get easier as I continue to study.  :\

 

 

B3llsario, I understand the importance of the error message also, as well as the character position thing (VERY handy).  About half the time, I can figure out an error message when I read it, but I'm still trying to piece together the exact issue the other half of the time.   With time, I'm sure I'll get as good as you and some of the other modders here.  I hope so anyway.  Even with weeks of studying tutorials and sites (which sometimes contradict each other), I'm still only a few steps above script kiddie at this point though. :(

 

Going back and looking at the CK wiki after your assistance, I can see now that apparently "IF" and "ElseIf" require their condition to be in parenthesis but "Else" requires an parenthesis free condition statement.   That's kind of counter-intuitive (at least to me).  Next time I'll know.

 

ANYHOO, thanks again to both of you.  You've saved what little sanity I have left, lol.

Posted

Aqqh's version of the script worked after I carrected a couple of small things.  Using that now, with thanks added on the mod home page, AND using that to further define what's being "explained" on the MCM Quick Start page, I'm pretty sure I can set up the other few toggles I want to add.

Archived

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

  • Recently Browsing   0 members

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