Jump to content

Referencing a form as script, direct vs indirect


Fredas

Recommended Posts

Posted

Recently I decided to try tapping into a script as a property of my script, rather than my usual method of either using GetFormFromFile or the Quest.GetQuest that was recommended to me recently.  I wanted a single bool variable from said script.  The script and its quest were part of the same mod in progress.

 

 

PS_PMCK property PMCK auto

 

When things failed to work, a couple of hours later I'd determined that no matter how much I might have preferred otherwise, the variable was always coming up "false" (ie, it was not being read correctly).  Switching back to good old Quest.GetQuest fixed this quite nicely:

 

 

PS_PMCK PMCK
PMCK = Quest.GetQuest("_PScheck") as PS_PMCK

 

but it still bugs me that I was prevented from using the more "elegant" method.  I couldn't guess why CK was failing to pass the info along.  All the values were set up correctly.

 

Is there some common oversight that might have caused this?  Does it matter that PS_PMCK was a conditional script?

 

Posted

Strange, I always call my scripts using this method with no problems.

 

Since you're asking if there is a common oversight that could cause this, are you sure you have filled the script's PS_PMCK property in the CK? :lol:

 

Also, I am pretty sure variables cannot be shared between scripts... only properties can. Unless the variable is set as global.

Posted

Yeah, I didn't forget anything obvious as far as I know.  For things like this, I have sort of settled into the conclusion that I have to shrug and just use what works, because CK is flaky and sometimes just does unexpected things.  Just recently, for example, I could not get CK to show a property I had just added to its script.  I couldn't even get it to show up when adding the property via the "add property" button!  So yeah, CK could stand some bugfixing.

 

Posted

In that case, fortunately you know at least two backup methods to revert back to! :)

 

By the way, since you mentioned a property not appearing even after adding it with the CK buttons: are you perhaps modding and scripting on a CK run through Mod Organizer? Because scripts are a bit tricky to work this way; it's doable (I work this way) but needs some special considerations. One of the troubles I first encountered while scripting through MO was this issue with properties not appearing in the menus.

Archived

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

  • Recently Browsing   0 members

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