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 - true if 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:

ParameterTypeRequiredDescription
enabledanyYes- true to enable, false to disable

Returns:

  • boolean - true if 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 - true if 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:

ParameterTypeRequiredDescription
enabledanyYes- true to enable, false to disable

Returns:

  • boolean - true if 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), or nil if 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:

ParameterTypeRequiredDescription
optionanyYes- Attack option value (0-3, see AttackOption constants)

Returns:

  • boolean - true if 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), or nil if 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:

ParameterTypeRequiredDescription
optionanyYes- Attack option value (0-3, see AttackOption constants)

Returns:

  • boolean - true if successful

Example:

-- Set players to hidden (PvP safety)
game_settings:set_player_attack_option(game_settings.AttackOption.HIDDEN)

Audio Tab Settings

is_master_muted

game_settings:is_master_muted() -> boolean

Check if master audio is muted.

Returns:

  • boolean - true if muted

set_master_mute

game_settings:set_master_mute(muted: boolean) -> boolean

Mute or unmute master audio.

Parameters:

ParameterTypeRequiredDescription
mutedanyYes- true to mute, false to unmute

Returns:

  • boolean - true if 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 - true if muted

set_music_mute

game_settings:set_music_mute(muted: boolean) -> boolean

Mute or unmute music.

Parameters:

ParameterTypeRequiredDescription
mutedanyYes- true to mute, false to unmute

Returns:

  • boolean - true if successful

is_effects_muted

game_settings:is_effects_muted() -> boolean

Check if sound effects are muted.

Returns:

  • boolean - true if muted

set_effects_mute

game_settings:set_effects_mute(muted: boolean) -> boolean

Mute or unmute sound effects.

Parameters:

ParameterTypeRequiredDescription
mutedanyYes- true to mute, false to unmute

Returns:

  • boolean - true if successful

is_area_sounds_muted

game_settings:is_area_sounds_muted() -> boolean

Check if area sounds are muted.

Returns:

  • boolean - true if muted

set_area_sounds_mute

game_settings:set_area_sounds_mute(muted: boolean) -> boolean

Mute or unmute area sounds.

Parameters:

ParameterTypeRequiredDescription
mutedanyYes- true to mute, false to unmute

Returns:

  • boolean - true if 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 - true if 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:

ParameterTypeRequiredDescription
hiddenanyYes- true to hide roofs, false to show roofs

Returns:

  • boolean - true if 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 - true if 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:

ParameterTypeRequiredDescription
enabledanyYes- true to enable shift-click drop, false to disable

Returns:

  • boolean - true if 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)