## Rules The way that the bot gets setting values is by looping thru all widgets in the configuration UI and saves the value of all widgets that are named `Settings_`. You can create your UI however you want it and then name all of the widgets you'd like to use for user-input like `Settings_nameOfSetting` eg. `Settings_AttackOutOfCombat` Currently these widgets are supported as setting inputs: ``` QLineEdit - String QCheckBox - Integer (0 = unchecked, 1 = partially checked, 2 = checked) QComboBox - String, current text only QTextEdit - String QSlider - Integer QSpinBox - Integer QProgressBar - Integer ``` ## Step-by-step 1. Download QtDesigner [here](https://manners.nu/releases/QtDesigner.zip) 2. Open QtDesigner, you will get a dialog asking to create a new form. Choose "Widget" in this step. 3. Design the script configuration window how you want it. 4. Save the UI to anywhere inside your scripts folder, eg. `scripts/Default/Settings/Warrior.ui` 5. Open up your script json file, eg. `scripts/Default/default.json` 6. Add `UIFile` to the class, this is a path relative to the current script directory so if you placed it in the location in step 4 it would look like this: ```json ... "MainFile": "Warrior/main.lua", "UIFile": "Settings/Warrior.ui" ``` 7. Restart the bot (this is step is only required when you add `UIFile` not when you make changes to the UI file itself). 8. Select the script you designed a UI for and press the wrench at the top or double-click the script, this will open a new window with your design where you can edit and save. ## Using the settings in LUA Once you're happy with your design its time to make use of it in LUA. ```lua Settings:Get('setting_name', 'default value') ``` Settings name is what you named your widgets. Say you named the widget `Settings_AoETargets` you would use it like this: ```lua Settings:Get('AoETargets', 3) ``` This will get the setting `AoETargets`, if it doesn't exist (user haven't configured the script yet) it will return a default value of `3` ## Scope You can only access settings from the current running script, they are not shared across scripts.