-
Notifications
You must be signed in to change notification settings - Fork 1
Docs
kiwidotzip edited this page Jun 3, 2025
·
4 revisions
Add sin to the "requires" array in your metadata.json
import Base from "<the file path to the sin/main/base.js file here>const sin = new Base("moduleName", "colorScheme path", "moduleName - for the gui title", "config path - optional")const sin = /*...*/
.addButton({
/*...*/
})
.addSwitch({
/*...*/
})- Button
.addButton({
category: "string",
configName: "string",
title: "string", // optional
description: "string", // optional
subcategory: "string",
onClick: () => print("string"),
shouldShow: data => data.confName // optional
})- Switch/Toggle
.addSwitch({
category: "string",
configName: "string",
title: "string", // optional
description: "string", // optional
subcategory: "string",
value: Num|String|Bool, // optional
shouldShow: data => data.confName, // optional
registerListener: (oldV, newV) => print(oldV + " -> " + newV) // optional
})- Text input
.addTextInput({
category: "string",
configName: "string",
title: "string", // optional
description: "string", // optional
value: Num|String|Bool, // optional
placeHolder: "string", // optional
subcategory: "string",
shouldShow: data => data.confName, // optional
registerListener: (oldV, newV) => print(oldV + " -> " + newV) // optional
})- Slider
.addSlider({
category: "string",
configName: "string",
title: "string", // optional
description: "string", // optional
options: [Num, Num],
value: Num|String|Bool, // optional
subcategory: "string",
shouldShow: data => data.confName, // optional
registerListener: (oldV, newV) => print(oldV + " -> " + newV) // optional
})- ColorPicker
.addColorPicker({
category: "string",
configName: "string",
title: "string", // optional
subcategory: "string",
value: Array, // optional
shouldShow: data => data.confName, // optional
registerListener: (oldV, newV) => print(oldV + " -> " + newV) // optional
})- Dropdown
.addDropDown({
category: "string",
configName: "string",
title: "string", // optional
description: "string", // optional
subcategory: "string",
options: Array,
value: Num, // optional
shouldShow: data => data.confName, // optional
registerListener: (oldV, newV) => print(oldV + " -> " + newV) // optional
})- Text paragraph
.addTextParagraph({
category: "string",
configName: "string",
title: "string", // optional
description: "string",
subcategory: "string",
centered: Boolean, // optional
shouldShow: data => data.confName, // optional
})- Keybind
.addKeybind({
category: "string",
configName: "string",
title: "string", // optional
description: "string", // optional
subcategory: "string",
value: Num|String, // optional
shouldShow: data => data.confName, // optional
registerListener: (oldV, newV) => print(oldV + " -> " + newV) // optional
})- getGui - Returns the custom GUI instance
- getHandler - Returns the handler instance
- openGui - Opens the GUI
- closeGui - Closes the GUI
- onOpenGui - Runs the given func on GUI open
- onCloseGui - Runs the given func on GUI close
- setSize - Sets the GUI size
- setRatio - Sets the GUI ratio
- setValue - Sets a SinGUI setting value
- setConfigValue - Sets a config value
.addXYZ({
/* ... */
})
.setSize(width, height) // optional
/* ... Other methods ... */
export default () => sin.settings
// OR
export default sin.settingsimport Config from "config.js file path"
// Use Config() if you did `export default () => sin.settings`, or Config if you did `export default sin.settings`
// We'll continue to use Config() in this example code
register("command", () => {
Config().getConfig().openGui() // Opens the Config GUI
}).setName("openGui")
register("worldLoad", () => {
ChatLib.chat(Config().exampleValue) // Sends the exampleValue's value in chat
})
Config().getConfig()
.onOpenGui(() => ChatLib.chat("GUI opened.")) // Sends a message on GUI open
.onCloseGui(() => ChatLib.chat("GUI closed.")) // Sends a message on GUI close
.registerListener("exampleValue", (oldV, newV) => ChatLib.chat(`${oldV} -> ${newV}`)) // Sends a message when exampleValue changesimport Config from "../config"
import { FeatureManager } from "../../tska/event/FeatureManager"
const FeatManager = new FeatureManager(Config().getConfig())
const example = FeatManager.createFeature("exampleConfigVal")
example
.onRegister(() => ChatLib.chat(`registered`))
.register("stepFps", () => ChatLib.chat(`meow`), 1)
.onUnregister(() => ChatLib.chat(`unregistered`))