New MWSE functions (called on a long/reference):
-
entity->xGetLocalScript returns scriptid (long/string) of entity's local script or 0 if entity has no local script attached. Possibly returns -1 or similar if it's outright impossible for the entity to have a script attached (invalid reference or reference of a type which can't have a script). Renders adding an xIsScripted function obsolete as it includes it.
-
entity->xGetLocalVar varname (long/string) (returns long - separate function for floats?) : retrieves the value of the local var varname in entity's local script.
Possibility to support varname as both MWSE string (long) and hardcoded string literal?
This will probably require a complementary entity->xGetIsLocalVarDefined varname function (or a 2nd return value from xGetLocalVar) to differentiate the case when the local script of reference doesn't actually have varname defined (the status itself of the local var being defined or not can be important to get with special local shorts such as companion, nolore, nohello)