Jump to content

Mod Tool/Scripting: Difference between revisions

global vars
mNo edit summary
(global vars)
Line 9: Line 9:
  ' INFO : Mod Tool
  ' INFO : Mod Tool
  ' INFO : 7.5.203.0
  ' INFO : 7.5.203.0
====Global variables====
In Softimage a variable can be global inside a script but not between multiple scripts.
So, to pass one value from one script to another one would need either
:  a) a command (containing a function with at least one argument),
:  b) user data blob, preferably attached to the scene root,
:  c) or a Softimage environment item.
Both b and c serve as storage that can be accessed from any script function.
Commands need most writing. User Data Blob need less but annoying checks if they already exist.
Theoretically it should be possible to place all code on one script file but that screws the overview.
The best choice is probably setting a var in Softimage itself though I just learned about it and don't if their are any drawback. So far it looks just fine.
' set value
XSIUtils.Environment.Setitem "MyVar", "true"
' caution: it can't contain boolean values no matter if true and false were set in quotes or not
' get value
logmessage XSIUtils.Environment("MyVar")




8,319

edits