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¶
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()¶
procedure TSettingsHandler.Setup();
Initializes the handler. Must be called before using any other methods, or is called automatically on first use.
Example:
SettingsHandler.Setup();
SettingsHandler.GetProfilesPath()¶
function TSettingsHandler.GetProfilesPath(): String;
Returns the path to the RuneLite profiles2 directory.
SettingsHandler.FindActiveProfile()¶
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()¶
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()¶
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:
fixButton.SetOnClick(@SettingsHandler.ApplyFix);
SettingsHandler.Widest()¶
function TSettingsHandler.Widest(boxes: TBoxArray): TBox;
Returns the widest TBox from the given TBoxArray.
SettingsHandler.ShuffleStrings()¶
procedure TSettingsHandler.ShuffleStrings(var arr: TStringArray);
Shuffles the elements of the given TStringArray in place.
SettingsHandler.ChangeXPBarDropDown()¶
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()¶
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()¶
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()¶
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()¶
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()¶
procedure TSettingsHandler.ClearBitmaps();
Clears and frees the back buffer and remote input image bitmaps. Should be called on script termination.
SettingsHandler.CheckRegularSettings()¶
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()¶
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()¶
procedure TSettingsHandler.CheckXPBarSettings();
Verifies and corrects XP bar dropdown settings and ensures the XP bar is visible.
SettingsHandler.CheckMagicSettings()¶
procedure TSettingsHandler.CheckMagicSettings();
Opens the magic tab and disables any active spell filters.
SettingsHandler.CheckDisplaySettings()¶
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()¶
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:
SettingsHandler.CheckGPUPlugin();
SettingsHandler.CheckGameSettings()¶
procedure TSettingsHandler.CheckGameSettings();
Runs all in-game settings checks including regular toggles, XP bar setup, magic spell filters, and display settings.
Example:
SettingsHandler.CheckGameSettings();
var SettingsHandler¶
Global TSettingsHandler variable.