# SettingsHandler SettingsHandler is responsible for detecting and remediating an enabled GPU plugin in the active RuneLite profile. An active GPU plugin can cause instability and other issues with Simba scripts and should be disabled before running. It also provides methods for verifying and correcting common in-game settings including display options, XP bar configuration, magic spell filters, and general gameplay toggles. - - - Big thanks to CanadianJames (CJ) for the Settings Searcher script which is now the heart and soul of this handler. - - - ## type TSettingsHandler ```pascal TSettingsHandler = record(TSRLBaseRecord) ActiveProfile: String; ActiveProfileFile: String; GPUPluginActive: Boolean; end; ``` Record responsible for checking the active RuneLite profile for an enabled GPU plugin and optionally applying an automated fix. Also provides methods for verifying and correcting common in-game settings including display options, XP bar configuration, magic spell filters, and general gameplay toggles such as shift drop, roof hiding, and escape to close. - - - ## SettingsHandler.Setup() ```pascal procedure TSettingsHandler.Setup(); ``` Initializes the handler. Must be called before using any other methods, or is called automatically on first use. Example: ```pascal SettingsHandler.Setup(); ``` - - - ## SettingsHandler.GetProfilesPath() ```pascal function TSettingsHandler.GetProfilesPath(): String; ``` Returns the path to the RuneLite profiles2 directory. - - - ## SettingsHandler.FindActiveProfile() ```pascal function TSettingsHandler.FindActiveProfile(path: String): Boolean; ``` Reads profiles.json to identify the active profile name and constructs its associated config filename from the profile id. Populates TSettingsHandler.ActiveProfile and TSettingsHandler.ActiveProfileFile. Returns True if a matching active profile config file was found. - - - ## SettingsHandler.CloseWarningForm() ```pascal procedure TSettingsHandler.CloseWarningForm(Sender: TObject); ``` Event handler for the "CONTINUE ANYWAY" button on the GPU warning form. Closes the modal form without applying any fix. - - - ## SettingsHandler.ApplyFix() ```pascal procedure TSettingsHandler.ApplyFix(Sender: TObject); ``` Event handler for the "APPLY FIX" button on the GPU warning form. Disables the GPU plugin in the active RuneLite profile config file, terminates RuneLite, and stops the script. Example: ```pascal fixButton.SetOnClick(@SettingsHandler.ApplyFix); ``` - - - ## SettingsHandler.Widest() ```pascal function TSettingsHandler.Widest(boxes: TBoxArray): TBox; ``` Returns the widest TBox from the given TBoxArray. - - - ## SettingsHandler.ShuffleStrings() ```pascal procedure TSettingsHandler.ShuffleStrings(var arr: TStringArray); ``` Shuffles the elements of the given TStringArray in place. - - - ## SettingsHandler.ChangeXPBarDropDown() ```pascal function TSettingsHandler.ChangeXPBarDropDown(dropDown: ERSXPBarSetupDropDown; text: String): Boolean; ``` Sets the given XP bar setup dropdown to the specified text if it differs from the current selection. Handles the Colour dropdown as a special case by selecting the first option. Returns True if the setting was changed or already correct. - - - ## SettingsHandler.OpenSettings() ```pascal function TSettingsHandler.OpenSettings(): Boolean; ``` Opens the RuneScape settings interface if it is not already open. Returns True if the settings interface is open. - - - ## SettingsHandler.ToggleSetting() ```pascal function TSettingsHandler.ToggleSetting(textToFind: String; enable: Boolean): Boolean; ``` Searches the in-game settings interface for the given text and enables or disables the associated checkbox. Returns True if the setting was found and actioned. - - - ## SettingsHandler.DisableMagicFilters() ```pascal function TSettingsHandler.DisableMagicFilters(out actionsTaken: Int32): Boolean; ``` Opens the magic spell filter panel, disables all active filters, and closes the panel. Returns True if the filter panel was successfully closed. Outputs the number of filters disabled. - - - ## SettingsHandler.FixScreenPostResolutionChange() ```pascal procedure TSettingsHandler.FixScreenPostResolutionChange(); ``` Redraws the debug back buffer for a period after a resolution or client mode change. Used to stabilize the display following a switch to fixed mode. - - - ## SettingsHandler.ClearBitmaps() ```pascal procedure TSettingsHandler.ClearBitmaps(); ``` Clears and frees the back buffer and remote input image bitmaps. Should be called on script termination. - - - ## SettingsHandler.CheckRegularSettings() ```pascal procedure TSettingsHandler.CheckRegularSettings(); ``` Verifies and applies common in-game toggle settings such as shift drop, escape to close, roof removal, and others. Opens the settings interface and closes it when done. - - - ## SettingsHandler.SetDropDownText() ```pascal function TSettingsHandler.SetDropDownText(dropdown: TRSDropDown; text: String): Boolean; ``` Sets the given dropdown to the specified text if it differs from the current selection. Returns True if the setting was changed. - - - ## SettingsHandler.CheckXPBarSettings() ```pascal procedure TSettingsHandler.CheckXPBarSettings(); ``` Verifies and corrects XP bar dropdown settings and ensures the XP bar is visible. - - - ## SettingsHandler.CheckMagicSettings() ```pascal procedure TSettingsHandler.CheckMagicSettings(); ``` Opens the magic tab and disables any active spell filters. - - - ## SettingsHandler.CheckDisplaySettings() ```pascal procedure TSettingsHandler.CheckDisplaySettings(); ``` Verifies display settings including brightness and client mode. If the client is not in fixed mode it will switch it and wait until the mode change is confirmed before continuing. - - - ## SettingsHandler.CheckGPUPlugin() ```pascal procedure TSettingsHandler.CheckGPUPlugin(); ``` Checks the active RuneLite profile for an enabled GPU plugin. If detected, displays a modal warning form giving the user the option to auto-fix the setting or continue regardless. Automatically synchronizes to the main thread. Example: ```pascal SettingsHandler.CheckGPUPlugin(); ``` - - - ## SettingsHandler.CheckGameSettings() ```pascal procedure TSettingsHandler.CheckGameSettings(); ``` Runs all in-game settings checks including regular toggles, XP bar setup, magic spell filters, and display settings. Example: ```pascal SettingsHandler.CheckGameSettings(); ``` - - - (SettingsHandler)= ## var SettingsHandler Global `TSettingsHandler` variable.