Jump to content

How Do You Set a Global Variable?


David Brasher

Recommended Posts

The computer does not like these lines:

 

AAMyGlobalVariable.SetValueInt(1)

 

AAMyGlobalVariable.SetValue(1)

 

AAMyGlobalVariable = 1

 

It always moans and whines about my global variable being undefined. It is a freaking global variable! I would think that it would by definition have to be defined.

 

 

Starting 1 compile threads for 1 files...

Compiling "TIF__01001D9C"...

c:\games\skyrim\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__01001D9C.psc(10,0): variable AAMyGlobalVariable is undefined

c:\games\skyrim\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__01001D9C.psc(10,0): type mismatch while assigning to a none (cast missing or types unrelated)

No output generated for TIF__01001D9C, compilation failed.

 

Batch compile of 1 files finished. 0 succeeded, 1 failed.

Failed on TIF__01001D9C

 

Is there some sneaky trick I don't know?

Link to comment
Share on other sites

add this to your script right after your ScriptName:

 

GlobalVariable Property AAMyGlobalVariable Auto

 

then go to your item the script is attached and go to the script properties and select the respective global.

 

Every item like that should be defined that way, items, spells, imagespacemodifiers etc... Hope I was helpful

Edited by omega2008
Link to comment
Share on other sites

  • 4 years later...

As omega2008 already said - yes, they might be "global" variables, but still - to access them (basically, to access any kind of reference from within a script) you'll have to map them to a property respectively.

Edited by ThraxxMedia
Link to comment
Share on other sites

  • Recently Browsing   0 members

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