Game Settings API
Read and modify OSRS game settings programmatically.
Attack Options
The AttackOption table contains constants for NPC and Player attack options:
game_settings.AttackOption.DEPENDS_ON_COMBAT -- "DEPENDS_ON_COMBAT"
game_settings.AttackOption.ALWAYS_RIGHT_CLICK -- "ALWAYS_RIGHT_CLICK"
game_settings.AttackOption.LEFT_CLICK_WHERE_AVAILABLE -- "LEFT_CLICK_WHERE_AVAILABLE"
game_settings.AttackOption.HIDDEN -- "HIDDEN"
game_settings.AttackOption.RIGHT_CLICK_FOR_CLANMATES -- "RIGHT_CLICK_FOR_CLANMATES" (Player only)
Controls Tab Settings
accept_aid
game_settings:accept_aid() -> boolean
Check if Accept Aid is enabled.
Returns:
boolean-trueif Accept Aid is enabled
Example:
if game_settings:accept_aid() then
logger:info("Accept Aid is enabled")
end
set_accept_aid
game_settings:set_accept_aid(enabled: boolean) -> boolean
Enable or disable Accept Aid.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
enabled | any | Yes | - true to enable, false to disable |
Returns:
boolean-trueif successful
Example:
-- Enable Accept Aid
if game_settings:set_accept_aid(true) then
logger:info("Accept Aid enabled")
end
pk_skull_protection
game_settings:pk_skull_protection() -> boolean
Check if PK skull protection is enabled.
Returns:
boolean-trueif PK skull protection is enabled
Example:
if game_settings:pk_skull_protection() then
logger:info("PK skull protection is enabled")
end
set_pk_skull_protection
game_settings:set_pk_skull_protection(enabled: boolean) -> boolean
Enable or disable PK skull protection.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
enabled | any | Yes | - true to enable, false to disable |
Returns:
boolean-trueif successful
Example:
-- Enable PK skull protection
if game_settings:set_pk_skull_protection(true) then
logger:info("PK skull protection enabled")
end
npc_attack_option
game_settings:npc_attack_option() -> number?
Get current NPC attack option setting.
Returns:
number?- Attack option value (0-3), ornilif unavailable
Example:
local option = game_settings:npc_attack_option()
if option == game_settings.AttackOption.ALWAYS_RIGHT_CLICK then
logger:info("NPCs set to always right-click")
end
set_npc_attack_option
game_settings:set_npc_attack_option(option: number) -> boolean
Set NPC attack option.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
option | any | Yes | - Attack option value (0-3, see AttackOption constants) |
Returns:
boolean-trueif successful
Example:
-- Set NPCs to always right-click
game_settings:set_npc_attack_option(game_settings.AttackOption.ALWAYS_RIGHT_CLICK)
player_attack_option
game_settings:player_attack_option() -> number?
Get current player attack option setting.
Returns:
number?- Attack option value (0-3), ornilif unavailable
Example:
local option = game_settings:player_attack_option()
if option == game_settings.AttackOption.HIDDEN then
logger:info("Players set to hidden")
end
set_player_attack_option
game_settings:set_player_attack_option(option: number) -> boolean
Set player attack option.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
option | any | Yes | - Attack option value (0-3, see AttackOption constants) |
Returns:
boolean-trueif successful
Example:
-- Set players to hidden (PvP safety)
game_settings:set_player_attack_option(game_settings.AttackOption.HIDDEN)
tab_keybind
game_settings:tab_keybind(tab: string) -> integer
Get the keybinding currently assigned to a tab. Reads directly from game memory (instant). Returns a virtual key code integer — compare with tabs.Keybind constants.
Parameters:
tab- Tab name string (usetabs.Tabconstants, e.g.tabs.Tab.COMBAT,tabs.Tab.INVENTORY)
Returns:
integer- Virtual key code (tabs.Keybind.F1throughtabs.Keybind.F12,tabs.Keybind.ESCAPE, ortabs.Keybind.NONE)
Example:
local key = game_settings:tab_keybind(tabs.Tab.COMBAT)
if key == tabs.Keybind.F1 then
logger:info("Combat tab is bound to F1")
end
set_tab_keybind
game_settings:set_tab_keybind(tab: string, keybind: integer) -> boolean
Set the keybinding for a specific tab. Opens the All Settings window keybind dropdown to make the change. Pass a tabs.Keybind constant.
Parameters:
tab- Tab name string (usetabs.Tabconstants, e.g.tabs.Tab.COMBAT,tabs.Tab.INVENTORY)keybind- Virtual key code (tabs.Keybind.F1throughtabs.Keybind.F12,tabs.Keybind.ESCAPE, ortabs.Keybind.NONE)
Returns:
boolean-trueif successful
Example:
-- Bind inventory to F1
game_settings:set_tab_keybind(tabs.Tab.INVENTORY, tabs.Keybind.F1)
-- Unbind magic tab
game_settings:set_tab_keybind(tabs.Tab.MAGIC, tabs.Keybind.NONE)
-- Bind logout to ESC
game_settings:set_tab_keybind(tabs.Tab.LOGOUT, tabs.Keybind.ESCAPE)
set_tab_keybinds
game_settings:set_tab_keybinds(bindings: table) -> boolean
Set multiple tab keybindings in one batch. The settings window stays open for the entire operation instead of reopening for each tab. Returns true if all bindings were applied successfully.
Parameters:
bindings- A table mappingtabs.Tabconstants totabs.Keybindconstants
Returns:
boolean-trueif all bindings were applied successfully
Example:
-- Configure all keybinds at once
local ok = game_settings:set_tab_keybinds({
[tabs.Tab.COMBAT] = tabs.Keybind.F1,
[tabs.Tab.STATS] = tabs.Keybind.F2,
[tabs.Tab.QUESTS] = tabs.Keybind.F3,
[tabs.Tab.INVENTORY] = tabs.Keybind.F4,
[tabs.Tab.EQUIPMENT] = tabs.Keybind.F5,
[tabs.Tab.PRAYER] = tabs.Keybind.F6,
[tabs.Tab.MAGIC] = tabs.Keybind.F7,
[tabs.Tab.LOGOUT] = tabs.Keybind.ESCAPE,
})
logger:info("Keybinds configured: " .. tostring(ok))
restore_default_keybinds
game_settings:restore_default_keybinds() -> boolean
Restore all tab keybindings to the OSRS defaults (F1-F12 mapped to tabs, ESC to Logout).
Returns:
boolean-trueif successful
Example:
game_settings:restore_default_keybinds()
Audio Tab Settings
is_master_muted
game_settings:is_master_muted() -> boolean
Check if master audio is muted.
Returns:
boolean-trueif muted
set_master_mute
game_settings:set_master_mute(muted: boolean) -> boolean
Mute or unmute master audio.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
muted | any | Yes | - true to mute, false to unmute |
Returns:
boolean-trueif successful
Example:
-- Mute all audio
game_settings:set_master_mute(true)
is_music_muted
game_settings:is_music_muted() -> boolean
Check if music is muted.
Returns:
boolean-trueif muted
set_music_mute
game_settings:set_music_mute(muted: boolean) -> boolean
Mute or unmute music.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
muted | any | Yes | - true to mute, false to unmute |
Returns:
boolean-trueif successful
is_effects_muted
game_settings:is_effects_muted() -> boolean
Check if sound effects are muted.
Returns:
boolean-trueif muted
set_effects_mute
game_settings:set_effects_mute(muted: boolean) -> boolean
Mute or unmute sound effects.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
muted | any | Yes | - true to mute, false to unmute |
Returns:
boolean-trueif successful
is_area_sounds_muted
game_settings:is_area_sounds_muted() -> boolean
Check if area sounds are muted.
Returns:
boolean-trueif muted
set_area_sounds_mute
game_settings:set_area_sounds_mute(muted: boolean) -> boolean
Mute or unmute area sounds.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
muted | any | Yes | - true to mute, false to unmute |
Returns:
boolean-trueif successful
Common Patterns
Configure Audio for Botting
-- Mute all audio to reduce detection risk
game_settings:set_master_mute(true)
-- Or mute individual audio types
game_settings:set_music_mute(true)
game_settings:set_effects_mute(true)
game_settings:set_area_sounds_mute(true)
Configure Combat Settings
-- Set safe combat options
game_settings:set_npc_attack_option(game_settings.AttackOption.ALWAYS_RIGHT_CLICK)
game_settings:set_player_attack_option(game_settings.AttackOption.HIDDEN)
-- Disable Accept Aid for safety
game_settings:set_accept_aid(false)
Check Settings Before Starting
function script:on_start()
-- Verify settings before starting bot
if not game_settings:accept_aid() then
logger:warn("Accept Aid is disabled")
end
local npc_option = game_settings:npc_attack_option()
if npc_option ~= game_settings.AttackOption.ALWAYS_RIGHT_CLICK then
logger:warn("NPC attack option is not set to always right-click")
-- Optionally fix it
game_settings:set_npc_attack_option(game_settings.AttackOption.ALWAYS_RIGHT_CLICK)
end
end
All Settings (Advanced)
are_roofs_hidden
game_settings:are_roofs_hidden() -> boolean
Check if roofs are hidden.
Returns:
boolean-trueif roofs are hidden
Example:
if game_settings:are_roofs_hidden() then
logger:info("Roofs are hidden")
end
set_hide_roofs
game_settings:set_hide_roofs(hidden: boolean) -> boolean
Enable or disable Hide Roofs setting. This setting is accessed through the All Settings window.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
hidden | any | Yes | - true to hide roofs, false to show roofs |
Returns:
boolean-trueif successful
Example:
-- Hide roofs
if game_settings:set_hide_roofs(true) then
logger:info("Roofs are now hidden")
end
-- Show roofs
if game_settings:set_hide_roofs(false) then
logger:info("Roofs are now visible")
end
is_shift_click_drop_enabled
game_settings:is_shift_click_drop_enabled() -> boolean
Check if shift-click to drop is enabled.
Returns:
boolean-trueif shift-click to drop is enabled
Example:
if game_settings:is_shift_click_drop_enabled() then
logger:info("Shift-click to drop is enabled")
end
set_shift_click_drop
game_settings:set_shift_click_drop(enabled: boolean) -> boolean
Enable or disable shift-click to drop. This setting is accessed through the All Settings window.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
enabled | any | Yes | - true to enable shift-click drop, false to disable |
Returns:
boolean-trueif successful
Example:
-- Enable shift-click to drop
if game_settings:set_shift_click_drop(true) then
logger:info("Shift-click to drop enabled")
end
-- Disable shift-click to drop
if game_settings:set_shift_click_drop(false) then
logger:info("Shift-click to drop disabled")
end
Notes
- All setter methods automatically open the appropriate settings tab
- Settings changes are applied immediately in-game
- Getter methods read directly from game memory (instant)
- Setter methods interact with UI components (takes ~500-1000ms)
- Advanced settings (like Hide Roofs) use the All Settings window and may take slightly longer (~1-2 seconds)