DrZombi
Content Creator
- Joined
- Jul 10, 2016
Hi community,
I'm trying to create my own Mod to add some triggers to DialogueActions but after building the file, I can't load it through the $INIT$ folder. I can load the Mod through the GUI and it works, but if I put it in the $INIT$ folder, even at the end of the file, I'll always end up with a "Mod Loading Failed" Error...
I suspected a delay needed between the loading of DA and my mod but I tried the same loading sequence with Coli's Mod CustomAutomation (from which my mod is derivated), and there is no problem to load his mod just after DA through the $INIT$ folder.
So I'm very frustrated because the mod does work when loaded through the GUI but I can't figure out why it won't load at startup. I'm posting here in hope that experienced modders with a good knowledge of the SDT/Loader Architecture will know what could be the problem.
In case you need it, here is the code of my mod. I removed the specific functions I created to keep it short because I think that this is not relevant to troubleshoot this problem but if you need my complete code, no problem, just ask:
I'm trying to create my own Mod to add some triggers to DialogueActions but after building the file, I can't load it through the $INIT$ folder. I can load the Mod through the GUI and it works, but if I put it in the $INIT$ folder, even at the end of the file, I'll always end up with a "Mod Loading Failed" Error...
I suspected a delay needed between the loading of DA and my mod but I tried the same loading sequence with Coli's Mod CustomAutomation (from which my mod is derivated), and there is no problem to load his mod just after DA through the $INIT$ folder.
So I'm very frustrated because the mod does work when loaded through the GUI but I can't figure out why it won't load at startup. I'm posting here in hope that experienced modders with a good knowledge of the SDT/Loader Architecture will know what could be the problem.
In case you need it, here is the code of my mod. I removed the specific functions I created to keep it short because I think that this is not relevant to troubleshoot this problem but if you need my complete code, no problem, just ask:
Code:
package
{
import flash.display.MovieClip;
import flash.utils.Dictionary;
public dynamic class MoreTriggers extends MovieClip
{
private const API_DA:String = "DialogueActions";
public var register:Function;
private var _apiDict:Dictionary = new Dictionary();
public var dialogueAPI:Dictionary;
private var DAFound:Boolean = false;
public var main;
public var g;
public function initl(l) : void
{
main = l;
g = l.g;
_apiDict["apiRegister"] = detectAPI;
l.registerAPI("DA_Extension", _apiDict, true);
main.unloadMod();
}
private function detectAPI(apiName:String, apiDict:Dictionary) : void
{
if(apiName == API_DA)
doStuff();
}
public function apiNotify() : void
{
doStuff();
}
private function doStuff() : void{
dialogueAPI = main.getAPI(API_DA);
if (!DAFound){
if (dialogueAPI == null){
main.updateStatusCol("DialogueActions API not found!","#FF0000");
return;
} else {
DAFound = true;
if (!addTriggers()){
main.updateStatusCol("Dictionary Load Failed","#FF0000");
main.unloadMod();
} else {
main.updateStatusCol("MoreTriggers loaded successfully","#00FF00");
}
}
}
}
private function addTriggers():Boolean{
register = dialogueAPI["registerTrigger"].getFunction();
register("TONGUE_ADD", 0, tongueAdd, this, []);
register("TONGUE_REMOVE", 0, tongueRemove, this, []);
register("UPDATE_RESISTANCE", 1, UpdateRes, this, []);
register("HIDE_HIS_LEFT_ARM", 0, hideHisLeftArm, this, []);
register("SHOW_HIS_LEFT_ARM", 0, showHisLeftArm, this, []);
register("TOGGLE_LOADER_ARM", 1, toggleLoaderArm, this, []);
register("TOGGLE_NIPPLES", 1, toggleNipples, this, []);
return true;
}
...