<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Help with setting visibility]]></title><description><![CDATA[<p dir="auto">Hello. I'm currently trying to learn how to use nextgen's scriptAPI. I've created a simple module just to mess around and to learn it. Here is part of the code related to what I'm trying to do:</p>
<pre><code>script.registerModule({
  name: "TestFly",
  category: "Movement",
  description: "Fly module, made for learning purposes.",
  settings: {
    mode: Setting.choose({
      name: "Mode",
      choices: ["Vanilla", "Hard", "Airwalk"], 
      default: "Vanilla"
    }),
    speed: Setting.float({
      name: "Speed",
      default: 1.0,
      range: [0.1, 5.0],
    })
  }
}, (mod) =&gt; {
</code></pre>
<p dir="auto">I'm trying to make the "Speed" setting only visible when the vanilla mode is selected. Or I'm trying to make the Speed setting be within the mode setting only when Vanilla option is selected. In the default fly module the relevant settings are inside the mode setting and they change depending on which mode of fly is selected. Is this possible to do in nextgen's scriptapi? I couldn't find out how to do it in the documentation.<br />
In short I'm asking how make settings within settings in the scriptapi.</p>
<p dir="auto">I also want to know if is it possible to add the "Toggle/ hold" setting in the scriptapi? This is the setting next to the bind button on some modules that makes the module only active when holding down the keybind.</p>
]]></description><link>https://forum.liquidbounce.net/topic/8445/help-with-setting-visibility</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Jul 2026 07:14:54 GMT</lastBuildDate><atom:link href="https://forum.liquidbounce.net/topic/8445.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 18 Mar 2025 05:14:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Help with setting visibility on Fri, 21 Mar 2025 00:48:18 GMT]]></title><description><![CDATA[<p dir="auto">By reading your post again I think I need to use ChoiceConfigurable. And I think that's definitely possible.</p>
]]></description><link>https://forum.liquidbounce.net/post/40062</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/40062</guid><dc:creator><![CDATA[commandblock2]]></dc:creator><pubDate>Fri, 21 Mar 2025 00:48:18 GMT</pubDate></item><item><title><![CDATA[Reply to Help with setting visibility on Thu, 20 Mar 2025 17:11:33 GMT]]></title><description><![CDATA[<p dir="auto">Also I am not sure about if we have to pass a object that implements all those functions to <code>Java.extend()</code>. But I think that's it for graaljs's type gymnastics, if you think this is necessary please open a issue at github. Ah just found that I forgot to use the <code>ReflectionUtils</code> xD.</p>
]]></description><link>https://forum.liquidbounce.net/post/40056</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/40056</guid><dc:creator><![CDATA[commandblock2]]></dc:creator><pubDate>Thu, 20 Mar 2025 17:11:33 GMT</pubDate></item><item><title><![CDATA[Reply to Help with setting visibility on Thu, 20 Mar 2025 17:06:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/soulplexis" aria-label="Profile: Soulplexis">@<bdi>Soulplexis</bdi></a> It's done. Although not supposed to be implemented this way but it can be.</p>
<p dir="auto"><img src="/assets/uploads/files/1742490357800-dffd7ece-e8cf-4928-bfcc-7b3dc791a6a4-image.png" alt="image.png" class=" img-fluid img-markdown" /></p>
<pre><code class="language-js">

function __require(path) {
    if (path.startsWith("@embedded")) {
        return globalThis
    }

    if (path.startsWith("@minecraft-yarn-definitions/types/")) {
        return {
            [path.substring(path.lastIndexOf("/") + 1)]: Java.type(path
                .replaceAll("@minecraft-yarn-definitions/types/", "")
                .replaceAll("/", ".")
            )
        }
    }
    return require(path);
}
var exports = {}

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// imports
/* eslint-disable unused-imports/no-unused-imports */
const _embedded_1 = __require("@embedded");
const ToggleableConfigurable_1 = __require("@minecraft-yarn-definitions/types/net/ccbluex/liquidbounce/config/types/ToggleableConfigurable");
/* eslint-enable unused-imports/no-unused-imports */
// DO NOT TOUCH ANYTHING ABOVE THIS LINE, also not sure why it didn't work
const script = _embedded_1.registerScript.apply({
    name: "example-script-api-hacking",
    version: "1.0.0",
    authors: ["commandblock2"]
});
script.registerModule({
    name: "example-typescript-module-script-api-hacking",
    description: "Ths is an minimal example module generated in ts but with a setting that's not supposed to be here",
    category: "Client",
}, (mod) =&gt; {
    // Assuming you're in a JavaScript environment that supports Java.extend (like Nashorn or GraalVM)
    // @ts-expect-error
    const MyToggleableConfig = Java.extend(ToggleableConfigurable_1.ToggleableConfigurable, {
        // Implement abstract methods from ToggleableConfigurable and its parent classes
        // Required method implementations from EventListener interface
        parent: function () {
            return this.parent; // Return the parent passed in constructor
        },
        children: function () {
            return []; // Return an array of child event listeners if any
        },
        unregister: function () {
            // Implementation for unregistering this event listener
        },
        // You can also override other methods like:
        enable: function () {
            // Custom enable logic
            // @ts-expect-error
            Java.super(this).enable(); // Call the parent method if needed
        },
        disable: function () {
            // Custom disable logic
            // @ts-expect-error
            Java.super(this).disable(); // Call the parent method if needed
        }
    });
    // Create an instance with required constructor parameters
    // constructor(parent: EventListener | null, name: string, enabled: boolean, aliases: string[])
    const myConfig = new MyToggleableConfig(mod, "MyConfig", true, ["alias1", "alias2"]);
    const testBoolean = myConfig.boolean("testBoolean", false);
    _embedded_1.Client.displayChatMessage(testBoolean.toString());
    // @ts-expect-error
    const field = mod.class.getDeclaredField("_values");
    field.setAccessible(true);
    const valuesMap = field.get(mod);
    // @ts-expect-error
    valuesMap.put("MyConfig", mod.value(myConfig));
    mod.on("enable", () =&gt; {
        _embedded_1.Client.displayChatMessage(`Hi, ${_embedded_1.mc.player}`);
    });
});
</code></pre>
<hr />
<pre><code class="language-ts">// imports
/* eslint-disable unused-imports/no-unused-imports */
import {
    Setting,
    Vec3i,
    Vec3d,
    MathHelper,
    BlockPos,
    Hand,
    RotationAxis,
    mc,
    Client,
    RotationUtil,
    ItemUtil,
    NetworkUtil,
    InteractionUtil,
    BlockUtil,
    MovementUtil,
    ReflectionUtil,
    ParameterValidator,
    UnsafeThread,
    registerScript
} from "@embedded";
import { Class } from "@minecraft-yarn-definitions/types/java/lang/Class";
import { ToggleableConfigurable } from "@minecraft-yarn-definitions/types/net/ccbluex/liquidbounce/config/types/ToggleableConfigurable";
import { ScriptModule } from "@minecraft-yarn-definitions/types/net/ccbluex/liquidbounce/script/bindings/features/ScriptModule";
/* eslint-enable unused-imports/no-unused-imports */
// DO NOT TOUCH ANYTHING ABOVE THIS LINE, also not sure why it didn't work


const script = registerScript.apply({
    name: "example-script-api-hacking",
    version: "1.0.0",
    authors: ["commandblock2"]
});

script.registerModule({
    name: "example-typescript-module-script-api-hacking",
    description: "Ths is an minimal example module generated in ts but with a setting that's not supposed to be here",
    category: "Client",

}, (mod) =&gt; {

    // Assuming you're in a JavaScript environment that supports Java.extend (like Nashorn or GraalVM)
    // @ts-expect-error
    const MyToggleableConfig = Java.extend(ToggleableConfigurable, {
        // Implement abstract methods from ToggleableConfigurable and its parent classes

        // Required method implementations from EventListener interface
        parent: function () {
            return this.parent; // Return the parent passed in constructor
        },

        children: function () {
            return []; // Return an array of child event listeners if any
        },

        unregister: function () {
            // Implementation for unregistering this event listener
        },

        // You can also override other methods like:
        enable: function () {
            // Custom enable logic
            // @ts-expect-error
            Java.super(this).enable(); // Call the parent method if needed
        },

        disable: function () {
            // Custom disable logic
            // @ts-expect-error
            Java.super(this).disable(); // Call the parent method if needed
        }
    });

    // Create an instance with required constructor parameters
    // constructor(parent: EventListener | null, name: string, enabled: boolean, aliases: string[])
    const myConfig = new MyToggleableConfig(mod, "MyConfig", true, ["alias1", "alias2"]);
    const testBoolean = myConfig.boolean("testBoolean", false);
    Client.displayChatMessage(testBoolean.toString());

    // @ts-expect-error
    const field = (mod.class as unknown as Class&lt;ScriptModule&gt;).getDeclaredField("_values");
    field.setAccessible(true);
    const valuesMap = field.get(mod);
    // @ts-expect-error
    valuesMap.put("MyConfig", mod.value(myConfig));

    mod.on("enable", () =&gt; {
        Client.displayChatMessage(`Hi, ${mc.player}`)
    })
})
</code></pre>
]]></description><link>https://forum.liquidbounce.net/post/40055</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/40055</guid><dc:creator><![CDATA[commandblock2]]></dc:creator><pubDate>Thu, 20 Mar 2025 17:06:52 GMT</pubDate></item><item><title><![CDATA[Reply to Help with setting visibility on Thu, 20 Mar 2025 13:34:13 GMT]]></title><description><![CDATA[<p dir="auto">This might be possible actually I think, if you put it in the lambda near mod.on that might even work, will try later</p>
]]></description><link>https://forum.liquidbounce.net/post/40054</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/40054</guid><dc:creator><![CDATA[commandblock2]]></dc:creator><pubDate>Thu, 20 Mar 2025 13:34:13 GMT</pubDate></item><item><title><![CDATA[Reply to Help with setting visibility on Wed, 19 Mar 2025 15:57:30 GMT]]></title><description><![CDATA[<p dir="auto">But on another thought, we could extend the value our self maybe and make the <code>ScriptToggleableConfigurable</code> our self within script? Maybe we could think about that.</p>
<p dir="auto">Also a bit of shameless self advertising, maybe try <a href="https://github.com/commandblock2/minecraft-LBNG-types" target="_blank" rel="noopener noreferrer nofollow ugc">this typescript definition generator</a>, could be a bit hard to setup and generate the definition yet.</p>
]]></description><link>https://forum.liquidbounce.net/post/40053</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/40053</guid><dc:creator><![CDATA[commandblock2]]></dc:creator><pubDate>Wed, 19 Mar 2025 15:57:30 GMT</pubDate></item><item><title><![CDATA[Reply to Help with setting visibility on Wed, 19 Mar 2025 15:43:05 GMT]]></title><description><![CDATA[<p dir="auto">Afaik, it is not possible without significant change. <code>ScriptSetting</code> for now does not provide the togglableConfigurable value function yet. That's all they have right now.</p>
<pre><code class="language-typescript">export class ScriptSetting extends Object {
    static INSTANCE: ScriptSetting;
    boolean(value: BooleanValue): Value&lt;boolean&gt;;
    choose(value: ChooseValue): ChooseListValue&lt;NamedChoice&gt;;
    float(value: FloatValue): RangedValue&lt;number&gt;;
    floatRange(value: FloatRangeValue): RangedValue&lt;ClosedFloatingPointRange&lt;number&gt;&gt;;
    int(value: IntValue): RangedValue&lt;number&gt;;
    intRange(value: IntRangeValue): RangedValue&lt;number[]&gt;;
    key(value: KeyValue): Value&lt;InputUtil$Key&gt;;    text(value: TextView): Value&lt;string&gt;;
    textArray(value: TextArrayValue): Value&lt;string[]&gt;;
}
</code></pre>
<p dir="auto">even if you would construct a <code>ToggleableConfigurable</code> instance with the graal anonymous class/object syntax, the <code>constructor(parent: EventListener | null, name: string, enabled: boolean, aliases: string[])</code> would require a <code>EventListener</code>, which is supplied by <code>this</code> in normal kotlin non-script modules. And the <code>this</code> in your script api corresponds to the <code>mod</code> in <code>}, (mod) =&gt; {</code> in your last line given, which by design, is not possible to acquire.<br />
However I do believe we could make a pr to the script api to make this possible, but I am not sure if a script is supposed to have such complex configuration.</p>
]]></description><link>https://forum.liquidbounce.net/post/40052</link><guid isPermaLink="true">https://forum.liquidbounce.net/post/40052</guid><dc:creator><![CDATA[commandblock2]]></dc:creator><pubDate>Wed, 19 Mar 2025 15:43:05 GMT</pubDate></item></channel></rss>