how to change settings of modules via chat which are made using scripts
-
@somedudeyouveneverheardof https://liquidbounce.net/docs/ScriptAPI/
-
@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 -
@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
-
@somedudeyouveneverheardof
moduleManager.getModule("Spammer").getValue("Message").set(your message)
pretty sure something like that -
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
-
@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
-
@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
-
This post is deleted!
-
@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()) }); });
-
@somedudeyouveneverheardof well it is probably a script issue, the setting changer works with other scripts
-
@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
-
@somedudeyouveneverheardof i just gave you an example you don't need to change that much do it yourself
-
@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. -
@somedudeyouveneverheardof
ok sorry, this should work then
commandManager.executeCommands(".scriptapimodule setting "+module.settings.text.get())
-
@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 -
@somedudeyouveneverheardof
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
-
@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