User talk:Tgspy
GetSelf[edit source]
I think your addition to the GetSelf article is based on experience with Papyrus or other modern scripting languages, like Java and Python? One of the reason that Bethesda created Papyrus is because it supports chaining of function calls, automatically building temporary variable references and breaking down the chain of function calls as needed into separate statements.
However, the script engines that Bethesda has been using long prior had no such feature, so to use something like
set myhealth to GetSelf.GetActorValue "Health"
will definitely throw errors because it is attempting to daisy-chain the return value of the GetSelf function as if it were a variable, which it then attempts to dereference into a function call on a reference -- something that the older scripting engine isn't capable of.
FOSE/NVSE made the language smarter by being able to handle multiple function calls per line (in, e.g., "let" statements), but creating Java-style function chains will never work in this language. =)
Your choices are, in the above example:
set refvar to GetSelf set myhealth to refvar.GetActorValue "Health"
or just to use the implicit
set myhealth to GetActorValue "Health"
as it will usually work properly all on its own.
--JT (talk) 20:03, 14 January 2017 (EST)
- I've never used Papyrus, nor any of the other scripting languages you mentioned. The only change I made to that page was to add a note that using GetSelf instead of this will result in GeckPU spititng out messages if you have debug enbabled. I have no idea what you're trying to say but that's all I changed.