PDA

View Full Version : Calling a function in a different extension



darrenan
May 24th, 2018, 05:32
Is it possible for extension B, which loads after extension A, to call functions defined in extension A? For context, what I'm trying to do is create an extension that will automatically deal with Mirror Images in the PF/3.5 ruleset assuming those Mirror Images were added using the STACK: syntax defined in the Effect Removal Extension. I would like to be able to invoke ExpandedEffectTags.newAddEffect from ActionManager.onAttack. I'm sure there are other ways to accomplish this, but this seems like the most straightforward approach. Please advise.

darrenan
May 24th, 2018, 05:37
Alternatively, and with the blessing of the extension author(s), I could just include the modified manager_action_attack.lua directly into the Effect Removal Extension.

Ken L
May 24th, 2018, 12:32
If you have a global script, you can simply invoke it ie: MyOtherScript.thatfunction if MyOtherScript is a global script loaded by another function, and exists prior to the invocaton.

If you're taking about Two scripts that both override the same file, the most recently loaded script will be invoked with no way to access the other extension's script.

Andraax
May 24th, 2018, 12:34
If the extension developer has "named" his extension, then you should be able to call functions in the extension directly. You might also want to have the extension author put in a "load order" tag to force your to load after his if you need to call his extension from an onInit function; or alternately, setup a onDesktopInit function which doesn't run until after all extensions are loaded and the desktop is ready to start.