CCBlueX Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Solved how to change settings of modules via chat which are made using scripts

    ScriptAPI
    6
    19
    447
    Loading More Posts
    • 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.
    • kaduvert
      kaduvert last edited by kaduvert

      If the title is a bit confusing, look at this example:

      In the LiquidBounce native Spammer module the message setting can be changed like this via chat:
      ".spammer message asdasd"

      But if i create a module via script and want to do the same thing with a string setting:
      ".scriptmodule message asdasd"
      I get a syntax usage in the chat instead of changing the value.

      Can this issue be fixed by me or is it caused by LiquidBounce?

      example script:

      /// api_version=2
      
      var script = registerScript({
      	name: 'example',
      	version: '1',
      	authors: ['example']
      })
      
      script.registerModule({
      	name: 'Example',
      	category: 'Misc',
      	description: 'example',
          settings: {
              text: Setting.text({
                  name: "text",
                  default: 'sssss'
              }),
              int: Setting.integer({
                  name: "int",
                  default: 1000,
                  min: 50,
            	    max: 5000
              })
          }
      }, function() {})
      
      The_Shadow_Emp 1 Reply Last reply Reply Quote 0
      • kaduvert
        kaduvert @FaaatPotato last edited by

        @FaaatPotato
        yeah, your example works on b73, previously played with b72. sorry about that
        seems to be fixed in b73, sorry to bother you all

        1 Reply Last reply Reply Quote 1
        • The_Shadow_Emp
          The_Shadow_Emp @kaduvert last edited by

          @somedudeyouveneverheardof https://liquidbounce.net/docs/ScriptAPI/

          kaduvert 1 Reply Last reply Reply Quote 0
          • kaduvert
            kaduvert @The_Shadow_Emp last edited by kaduvert

            @the_shadow_emp can you more clearly describe what i did wrong?
            or can you do it right with the help of your enlightning ressource

            M 1 Reply Last reply Reply Quote 0
            • M
              mems Moderator @kaduvert last edited by

              @somedudeyouveneverheardof https://liquidbounce.net/docs/ScriptAPI/Global Instances

              kaduvert 1 Reply Last reply Reply Quote 0
              • kaduvert
                kaduvert @mems last edited by kaduvert

                @mems can you give more details? i don't really get what that page should tell me
                do i need to register the module to the commandManager?
                and if how to do that?

                commandManager.registerCommand(moduleManager.getModule('Example'))
                

                that is what i tried but it doesn't seem to work

                The_Shadow_Emp 1 Reply Last reply Reply Quote 0
                • The_Shadow_Emp
                  The_Shadow_Emp @kaduvert last edited by

                  @somedudeyouveneverheardof moduleManager.getModule("Spammer").getValue("Message").set(your message) pretty sure something like that

                  kaduvert FaaatPotato 2 Replies Last reply Reply Quote 1
                  • kaduvert
                    kaduvert @The_Shadow_Emp last edited by

                    moduleManager.getModule("Spammer").getValue('message').set('123')
                    Chat.print(moduleManager.getModule("Spammer").getValue('message').get()) // prints "123"
                    

                    yeah, this works, but if swapping this out with a script-created module it doesn't work anymore

                    1 Reply Last reply Reply Quote 1
                    • FaaatPotato
                      FaaatPotato @The_Shadow_Emp last edited by

                      @the_shadow_emp ye i guess

                      var Spammer = moduleManager.getModule("Spammer");
                      
                      moduleManager.getModule("Spammer").getValue("Message").set(module.settings.text.get())
                      

                      not sure if he wants to use the setting in the module but yeah

                      kaduvert 1 Reply Last reply Reply Quote 0
                      • kaduvert
                        kaduvert @FaaatPotato last edited by

                        @faaatpotato i want to set the setting of a script-created module via a chat command, like this: ".examplemodule text asd"

                        this works fine with native modules but doesn't with script-created ones and i wonder how to fix this or another way to change a string setting ingame

                        ? FaaatPotato 3 Replies Last reply Reply Quote 0
                        • ?
                          A Former User @kaduvert last edited by

                          This post is deleted!
                          1 Reply Last reply Reply Quote 0
                          • FaaatPotato
                            FaaatPotato @kaduvert last edited by FaaatPotato

                            @somedudeyouveneverheardof still not sure what u want but this script changes the spammer message if you type ingame

                            .ssssd text (message you want)
                            
                            /// api_version=2
                            var script = registerScript({
                                name: "ss",
                                version: "1.0",
                                authors: ["No Author ok"]
                            });
                            
                            var Spammer = moduleManager.getModule("Spammer");
                            
                            script.registerModule({
                                name: "ssssd",
                                description: "Nutting in cats is illegal",
                                category: "Fun",
                                tag: "s",
                                settings: {
                                    text: Setting.text({
                                        name: "text",
                                        default: ""
                                    }),
                                }
                            
                            }, function (module) {
                                module.on("enable", function () {
                            
                                });
                                module.on("disable", function () {
                            
                                });
                                module.on("update", function () {
                                	moduleManager.getModule("Spammer").getValue("Message").set(module.settings.text.get())
                                });
                            });
                            
                            kaduvert 1 Reply Last reply Reply Quote 0
                            • ?
                              A Former User @kaduvert last edited by A Former User

                              @somedudeyouveneverheardof well it is probably a script issue, the setting changer works with other scripts

                              1 Reply Last reply Reply Quote 0
                              • kaduvert
                                kaduvert @FaaatPotato last edited by

                                @faaatpotato Spammer was just an example module to demonstrate where it would work, now make a module with a script and try to do the same

                                FaaatPotato 1 Reply Last reply Reply Quote 0
                                • FaaatPotato
                                  FaaatPotato @kaduvert last edited by

                                  @somedudeyouveneverheardof i just gave you an example you don't need to change that much do it yourself

                                  kaduvert 1 Reply Last reply Reply Quote 0
                                  • kaduvert
                                    kaduvert @FaaatPotato last edited by kaduvert

                                    @faaatpotato it wasn't meant as a challange or something but as a way to get you to understand my problem, it doesn't work if you would replace spammer with a module created with the ScriptAPI and that's my problem, nor can you change these values via ingame chat.
                                    I want to know how to fix this.

                                    FaaatPotato 1 Reply Last reply Reply Quote 0
                                    • FaaatPotato
                                      FaaatPotato @kaduvert last edited by

                                      @somedudeyouveneverheardof

                                      ok sorry, this should work then

                                      commandManager.executeCommands(".scriptapimodule setting "+module.settings.text.get())
                                      
                                      kaduvert 1 Reply Last reply Reply Quote 0
                                      • kaduvert
                                        kaduvert @FaaatPotato last edited by

                                        @faaatpotato gives me the same error as if i would type it in the chat manually.

                                        ".scriptapimodule setting 123"
                                        gives
                                        "[LiquidBounce] Syntax: .scriptapimodule <setting>"
                                        but doesn't change anything

                                        FaaatPotato 1 Reply Last reply Reply Quote 0
                                        • FaaatPotato
                                          FaaatPotato @kaduvert last edited by FaaatPotato

                                          @somedudeyouveneverheardof
                                          2dc3af29-7bf4-40bd-b552-fa2915a11da8-image.png
                                          works for me

                                          /// api_version=2
                                          var script = registerScript({
                                              name: "ss",
                                              version: "1.0",
                                              authors: ["No Author ok"]
                                          });
                                          
                                          script.registerModule({
                                              name: "ssssd",
                                              description: "Nutting in cats is illegal",
                                              category: "Fun",
                                              tag: "s",
                                              settings: {
                                                  text: Setting.text({
                                                      name: "text",
                                                      default: ""
                                                  }),
                                              }
                                          
                                          }, function (module) {
                                              module.on("enable", function () {
                                              	commandManager.executeCommands(".JartexL LMode "+module.settings.text.get());
                                              });
                                              module.on("disable", function () {
                                          
                                              });
                                              module.on("update", function () {
                                              });
                                          });
                                          

                                          example with a script I made

                                          kaduvert 1 Reply Last reply Reply Quote 0
                                          • kaduvert
                                            kaduvert @FaaatPotato last edited by

                                            @FaaatPotato
                                            yeah, your example works on b73, previously played with b72. sorry about that
                                            seems to be fixed in b73, sorry to bother you all

                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post
                                            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