Why I can't use commandManager or moduleManager in my script
-
-
@isnotpuppy Probably because of the kotlin ports, however this wasn't expected since:
I will look into this.
-
since everything is in kotlin now, you most likely have to do moduleManager.INSTANCE.getModule()
commandManager.INSTANCE....however this may be subject to change in the future because the documentation doesn't show this and it's not good
-
So I've been looking into this and I noticed following:
try { Chat.print(typeof(scriptManager)); // object Chat.print(JSON.stringify(scriptManager)); // undefined scriptManager.unloadScripts(); Chat.print("done"); // works }catch (e) { Chat.print(e); } try { Chat.print(typeof(commandManager)); // [object] Chat.print(JSON.stringify(commandManager)); // {} commandManager.registerCommands(); // not working -> TypeError: commandManager.registerCommands is not a function commandManager.executeCommands('killaura range 3.4'); // not working, stopped above }catch (e) { Chat.print(e); } try { Chat.print(typeof(moduleManager)); // [object] Chat.print(JSON.stringify(moduleManager)); // {} moduleManager.registerModules(); // not working -> TypeError: moduleManager.registerModules is not a function moduleManager.getModule('KillAura').setState(false); // not working, stopped above }catch (e) { Chat.print(e); }
After changing the variable name of
commandManager
andmoduleManager
topickaxe
andstone
it suddenly worked!scriptEngine.put("stone", moduleManager) scriptEngine.put("pickaxe", commandManager) scriptEngine.put("scriptManager", scriptManager)
So it seems to be conflicting with something else.
Oh my god... I realized. It was caused by the ScriptAPI v1 legacy support script. >(
this.moduleManager = Java.type("net.ccbluex.liquidbounce.LiquidBounce").moduleManager; this.Module = Java.type("net.ccbluex.liquidbounce.features.module.Module"); this.ArrayList = Java.type("java.util.ArrayList");
-
@isnotpuppy Put this tag on the top of your script:
/// api_version=2 ... code
This will fix the issue.
See: https://liquidbounce.net/docs/ScriptAPI/Getting StartedAlso fixed in future versions by removing support for ScriptAPI v1:
https://github.com/CCBlueX/LiquidBounce/commit/3e92903f1372e1c96225bca057f0f136928d3bd5 -