Property not readable from event

Post » Mon Jun 18, 2012 9:31 am

I'm really at a loss here. I have a quest with an OnUpdateGameTime event, and in that event I try to read a global variables value. No idea why it doesn't work, the global is just read as None during runtime.

The code:
Scriptname nyczSBSQuestScript extends Quest  GlobalVariable Property nyczSBSAccount AutoEvent OnUpdateGameTime()  Debug.Trace("OnUpdateGameTime runs")  int curval = nyczSBSAccount.GetValueInt()  int newval = (curval * 1.05) as int  if curval != newval	nyczSBSAccount.SetValueInt(newval)	UpdateCurrentInstanceGlobal(nyczSBSAccount)  endIfendEvent


The error log:
[02/13/2012 - 04:01:02PM] OnUpdateGameTime runs[02/13/2012 - 04:01:02PM] error: Cannot call GetValueInt() on a None object, aborting function callstack:	[nyczSBS (0D000D92)].nyczSBSQuestScript.OnUpdateGameTime() - "nyczSBSQuestScript.psc" Line 7[02/13/2012 - 04:01:02PM] warning: Assigning None to a non-object variable named "::temp0"stack:	[nyczSBS (0D000D92)].nyczSBSQuestScript.OnUpdateGameTime() - "nyczSBSQuestScript.psc" Line 7

Am I missing something really obvious here, or what? I initialize the global as a property (actually copypasted that line from another - working - script I use) and yet it behaves like http://www.gamesas.com/topic/1346752-using-properties-in-custom-functions/, like it completely ignore the declaration. I've looked att stock scripts, they look like mine... I think. Gah.

EDIT: Oh never mind. I had to initialize the property outside of the code as well (the property dialog, auto-fill etc). It works like it should now.
User avatar
Skivs
 
Posts: 3550
Joined: Sat Dec 01, 2007 10:06 pm

Return to V - Skyrim