Amaterasu is a ChatTriggers library designed to make creating and using a settings GUI simple and efficient.
- cool gui
- fully customizable color scheme
- search bar + working search tags
- custom sorting
- no memory leak (sad vigilance noises)
- markdown support
- support for many different property types (e.g. Keybind, TextParagraph, MultiCheckbox, etc)
- flexible "config dependencies"
- no red squiggly lines
Add "Amaterasu" into your requires array in metadata.json
For more information on porting Vigilance settings into Amaterasu settings, see How to migrate vigilance settings
If you are coming from Vigilance and would prefer a table of equilavent properties, they can be found here.
intellisense will carry, jsdocs should be fine (read through code if you need to do anything not covered in Usage)
if you do not create the DefaultConfig correctly, your typings will NOT WORK
// GOOD CODE
const defaultConf = new DefaultConfig("example", "data/settings.json")
.addButton({})
// more things
.addToggle({})
// BAD CODE
const defaultConf = new DefaultConfig("example", "data/settings.json")
defaultConf
.addButton({})
// more things
.addToggle({})See Installation.
use intellisense or be blind your choice
DefaultConfig and Settings are the main 2 things.
DefaultConfig is for the "structure" of your config (i.e. defining your properties and such)
Settings is for all the gui things: color scheme, sorting, etc.
how to use:
- create file for your config stuff
- import things
- create your
DefaultConfig - populate your
DefaultConfigusing.add_____(e.g..addButton) - using your
DefaultConfig, create aSettings - do things you need to do with your
Settings export default mySettings.settings- (in another file) import your settings e.g.
import settings from "./myConfig" - profit
settings.myProperty
[Settings].
setSize(width, height)
.setPosition(x, y)
.apply()The #apply method needs to be called so it can reload the GUI with the given values
apply using .setScheme(/**/).apply() or Settings constructor
schema can be found here
The Custom AmaterasuSchemes Repo can also be used:
// Import setter method for scheme
import { setCustomScheme } from "../Amaterasu/core/RepoSchemes"
[Settings]
.addButton({
configName: "apply",
title: "Apply Changes",
description: "Applies the new scheme",
onClick(setting) {
// Pass in the settings instance and the current input value
setCustomScheme(setting, setting.settings.customScheme)
}
})
.addTextInput({
configName: "customScheme",
title: "Custom Scheme",
description: "Input the custom scheme name from the github repo here",
placeHolder: "Amaterasu"
})// How to disable wrap so you can have dynamic description height
const textWrap = config.AmaterasuGui.descriptionElement.textWrap
textWrap.enabled = false // Set to false so the description does not get wrapped
textWrap.linesLimit = 2 // Set the limit of vertical lines (`2` is set by default so you can avoid setting it)
textWrap.removeLines = 1 // Set the amount of lines to remove when calculating the new height (`1` is set by default this is mostly for padding issues)
textWrap.wrapHeight = 7 // Set the amount of "text height" this is the value that will be used to calculate the new height (`7` is set by default)
// Now we call apply so our changes work
config.AmaterasuGui.apply()Vigilance
@TextProperty({
name: "text",
description: "Example of text input that does not wrap the text",
category: "General",
subcategory: "Category",
placeholder: "Empty... :("
})
textInput = ""Amaterasu
.addTextInput({
configName: "textInput",
title: "text",
description: "Example of text input that does not wrap the text",
category: "General",
subcategory: "Category",
value: "",
placeHolder: "Empty... :("
})Vigilance
@ParagraphProperty({
name: "paragraph",
description: "Example of text input that does wrap the text",
category: "General",
subcategory: "Category",
placeholder: "Empty... :("
})
paraInput = ""Amaterasu
// doesn't exist :(Vigilance
@ColorProperty({
name: "Color Picker",
description: "Pick a color! (hopefully...)",
category: "General",
subcategory: "Category"
})
myColor = Color.BLUEAmaterasu
.addColorPicker({
configName: "myColor",
title: "Color Picker",
description: "Pick a color! (hopefully...)",
category: "General",
subcategory: "Category",
value: [0, 0, 255, 255]
})Vigilance
@SwitchProperty({
name: "Do action!!!",
description: "toggle the checkbox in Not general! tab!",
category: "General",
subcategory: "Category",
placeholder: "Activate"
})
switch = falseAmaterasu
.addSwitch({
configName: "switch",
title: "Do action!!!",
description: "toggle the checkbox in Not general! tab!",
category: "General",
subcategory: "Category"
})Vigilance
@CheckboxProperty({
name: "Checkbox",
description: "Check this box",
category: "Not general!"
})
myCheckbox = falseAmaterasu
.addToggle({
configName: "myCheckbox",
title: "Checkbox",
description: "Check this box",
category: "Not general!",
subcategory: null
})Vigilance
@SelectorProperty({
name: "Selector",
description: "Select an option",
category: "General",
subcategory: "eeeeee",
options: ["one", "two", "three"]
})
myOptions = 0Amaterasu
.addDropDown({
configName: "myOptions",
title: "Selector",
description: "Select an option",
category: "General",
subcategory: "eeeeee",
options: ["one", "two", "three"],
value: 0
})Vigilance
@SliderProperty({
name: "Slider",
description: "Select a value",
category: "General",
subcategory: "eeeeee",
min: 0,
max: 100
})
slider = 0Amaterasu
.addSlider({
configName: "slider",
title: "Slider",
description: "Select a value",
category: "General",
subcategory: "eeeeee",
options: [0, 100],
value: 0
})Vigilance
@DecimalSliderProperty({
name: "Decimal Slider",
description: "Select a value",
category: "General",
subcategory: "eeeeee",
minF: 0,
maxF: 100
})
dSlider = 0Amaterasu
.addSlider({
configName: "dSlider",
title: "Decimal Slider",
description: "Select a value",
category: "General",
subcategory: "eeeeee",
options: [0.01, 100],
value: 0
})Yeah sadly for the normal developer decimal slider isn't very straight forward (thanks past docilelm). you'd need to pass in the minimum (first value) with a decimal point in order for this to go into the "Decimal Slider" mode.
Vigilance
@ButtonProperty({
name: "Click me!",
description: "yay",
category: "General",
subcategory: "ooo"
})
activateSomething() {
}Amaterasu
.addButton({
configName: "activateSomething",
title: "Click me!",
description: "yay",
category: "General",
subcategory: "ooo",
onClick() {
}
})Vigilance
.registerListener("text", newText => {
console.log(`Text changed to ${newText}`)
})Amaterasu
.add____({
configName: "text",
/*
*/
registerListener(oldText, newText) {
console.log(`Text changed to ${newText}`)
}
})
// or
[Settings].registerListener("text", (oldText, newText) => {
console.log(`Text changed to ${newText}`)
})Vigilance
.addDependency("Checkbox", "Do action!!!")Amaterasu
.add____({
title: "Do action!!!",
/*
*/
shouldShow: data => data.myCheckbox,
// Or for more beginner friendlyness
shouldShow(data) {
return data.myCheckBox
}
})Vigilance
@Vigilant("Vigilance", "My Settings Title Example", /**/),Amaterasu
// Fill in the blank spots!
new Settings("Amaterasu", /**/, /**/, "My Settings Title Example")Vigilance
getCategoryComparator: () => (a, b) => {},
getPropertyComparator: () => (a, b) => {}Amaterasu
[Settings].setElementSort((a, b) => {})
[Settings].setCategorySort((a, b) => {})You need to call the #apply method afterwards for these to actually be taken into consideration by the GUI.
If you're still confused what the [Settings] part of this guide is referring to here's an example
const setting = new Settings("Amaterasu", config, "data/ColorScheme.json")setting.setCategorySort((a, b) => {}).apply()For example if you have this
export default setting.settingsYou can then get the [Settings] instance by doing
settings.getConfig()- Password/Protected Text Inputs
- Percent Sliders
- Increment on sliders
- Number Input
- Category/Subcategory Descriptions
- Subcategory Sorting
credits can be found here