LarryG on 2/12/2014 at 18:35
I know of two methods to enable/disable scripts on demand:
1. Put the scripts on a metaprop and then add/remove the metaprop dynamically to/from the object (by your favorite method)
2. Have the scripts on a Fnord>PropertySet (or equivalent) and add/remove the property dynamically from the object (by your favorite method)
Are there any other approaches? I know that some of the OM scripts respect the Locked property, and won't execute if the object is locked. But not all do so, and I don't think any more recent scripts do. Any other choices that work for all scripts?
Is one of the approaches far and away the preferred approach? If so, why?
Yandros on 2/12/2014 at 19:35
I can't think of any other methods, although there are probably some. I don't really prefer either of those two over the other, although it should be pointed out that one advantage to #2 is that, since it adds/replaces the concrete property itself, it will always have highest precedence, whereas a script in a metaproperty will get trumped by the explicit Scripts property on the concrete object, if present. In fact, understanding that in general helps make using FrobInert less frustrating.
R Soul on 2/12/2014 at 20:00
The best method is whatever is easiest, but with metaprops you have more flexibility. You can have one where 'don't inherit' is true, add that to the object and you don't have to worry about restoring the previous script behaviour later on; you just remove the metaprop.
LarryG on 2/12/2014 at 20:52
Pity that NV's scripts (and other script sets) don't all have an Activate/Deactivate message functionality implemented.
Nameless Voice on 3/12/2014 at 02:19
For a lot of my trap scripts, you could change the design on/off messages to "null" to disable them; you could put that part of the design note into a metaproperty.
No idea if that's better or worse, just an alternate way of doing it.
It does have the advantage that the script won't get reinitialised on that object, since the scripts themselves did not change.
LarryG on 3/12/2014 at 04:02
I wondered to myself about reinitialization when adding/removing scripts and whether that was a concern. And I also wondered about just removing/reinstating the entire design note, but thought the script might misbehave if it was absent. I hadn't thought about replacing the trapped messages with "Null" and leaving the rest of the Design Note alone. Is the initialization a sufficient concern to take this route in preference to the other two choices? For OM scripts we are still left with removal of the script for those that don't honor Locking.