Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

LiquidBounce Forum

  1. Home
  2. ScriptAPI
  3. Why I can't use commandManager or moduleManager in my script

Why I can't use commandManager or moduleManager in my script

Scheduled Pinned Locked Moved Unsolved ScriptAPI
6 Posts 3 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    isnotpuppy
    wrote on last edited by
    #1

    alt textalt textalt text

    CzechHekC kawaiinekololisK 3 Replies Last reply
    0
    • I isnotpuppy

      alt textalt textalt text

      CzechHekC Offline
      CzechHekC Offline
      CzechHek
      wrote on last edited by
      #2

      @isnotpuppy Probably because of the kotlin ports, however this wasn't expected since:

      https://github.com/CCBlueX/LiquidBounce/blob/legacy/src/main/java/net/ccbluex/liquidbounce/script/Script.kt#L59-L63

      I will look into this.

      I 1 Reply Last reply
      0
      • CzechHekC CzechHek

        @isnotpuppy Probably because of the kotlin ports, however this wasn't expected since:

        https://github.com/CCBlueX/LiquidBounce/blob/legacy/src/main/java/net/ccbluex/liquidbounce/script/Script.kt#L59-L63

        I will look into this.

        I Offline
        I Offline
        isnotpuppy
        wrote on last edited by
        #3

        @CzechHek ty

        1 Reply Last reply
        0
        • I isnotpuppy

          alt textalt textalt text

          CzechHekC Offline
          CzechHekC Offline
          CzechHek
          wrote on last edited by
          #4

          @isnotpuppy

          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

          kawaiinekololisK 1 Reply Last reply
          0
          • CzechHekC CzechHek

            @isnotpuppy

            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

            kawaiinekololisK Offline
            kawaiinekololisK Offline
            kawaiinekololis
            Admin
            wrote on last edited by kawaiinekololis
            #5

            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 and moduleManager to pickaxe and stone 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");
            
            1 Reply Last reply
            1
            • I isnotpuppy

              alt textalt textalt text

              kawaiinekololisK Offline
              kawaiinekololisK Offline
              kawaiinekololis
              Admin
              wrote on last edited by kawaiinekololis
              #6

              @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 Started

              Also fixed in future versions by removing support for ScriptAPI v1:
              https://github.com/CCBlueX/LiquidBounce/commit/3e92903f1372e1c96225bca057f0f136928d3bd5

              0 1zun4 committed to CCBlueX/LiquidBounce
              removed support for ScriptAPI v1
              
              Please update your script to ScriptAPI v2 to avoid issues in the future.
              See https://liquidbounce.net/docs/ScriptAPI/Getting%20Started for further information.
              
              This change fixes module and command manager not being defined correctly.
              See https://forums.ccbluex.net/topic/7671/why-i-can-t-use-commandmanager-or-modulemanager-in-my-script/
              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              About
              • Terms of Service
              • Privacy Policy
              • Status
              • Contact Us
              Downloads
              • Releases
              • Source code
              • License
              Docs
              • Tutorials
              • CustomHUD
              • AutoSettings
              • ScriptAPI
              Community
              • Forum
              • Guilded
              • YouTube
              • Twitter
              • D.Tube
              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups