Jump to content

Papyrus Scripting - Passing Values Between Scripts


Skewered

Recommended Posts

Posted

I'm trying to use SkyUI MCM for a script-based mod, and I'm having difficulty with retrieving values from the MCM script.

 

To isolate the issue, the below is my only code in this test mod.  SKSE and SkyUI are the only other things going on in an otherwise vanilla Skyrim install.

 

Here is the code in the MCM quest script (I did set the player ref in the Quest Alias for this quest, if that helps)

Scriptname MyConfigMenu extends SKI_ConfigBase  
Int Property intMyTest  Auto  


event OnConfigInit()
   debug.notification("MyConfigMenu.OnConfigInit Called")
   intMyTest  = 1
endEvent


Function CustomFunction()
   debug.notification("MyConfigMenu.CustomFunction Called")
   intMyTest = 2
endFunction

This is my test script in a quest set up to kick off from the SM Event Node for Increase Level

Scriptname MyQuestScript001 extends Quest  


MyConfigMenu Property MCMMenu Auto
Quest Property myQuest  Auto  


Event OnStoryIncreaseLevel(Int AiNewLevel)
   Debug.Notification("MyQuestScript001.OnStoryIncreaseLevel Called")
   MCMMenu.CustomFunction()
   Debug.Notification("MCMMenu.intMyTest: "+ MCMMenu.intMyTest)
   myQuest.CompleteQuest()
endEvent

Results:

  • The scripts compile
  • The OnStoryIncreaseLevel event fires on player level up
  • The message "MyQuestScript001.OnStoryIncreaseLevel Called" DOES come up on-screen
  • However, when the function MCMMenu.CustomFunction() is called on the next line, the debug message in that function is NOT displayed
  • The value output on the next line for MCMMenu.intMyTest is 0, rather than 2
 
I've seen sample code from other people demoing this, but I am clearly missing something.
I've been stuck on this one for a while.  Please help!
 
 
P.S. - For the real mod, I plan on using arrays of values, so the idea of creating a ton of variables in the "Global" section in the Creation Kit is not very appealing.

Archived

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

  • Recently Browsing   0 members

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