Prayer API

Activate/deactivate prayers and manage quick prayers.

Functions

prayer_points

prayer:prayer_points() -> number

Get current prayer points.

Returns:

  • number - Current prayer points

max_prayer_points

prayer:max_prayer_points() -> number

Get maximum prayer points (Prayer level × 10).

Returns:

  • number - Maximum prayer points

prayer_percentage

prayer:prayer_percentage() -> number

Get prayer as percentage (0-100).

Returns:

  • number - Prayer percentage

is_low_prayer

prayer:is_low_prayer(threshold: number?) -> boolean

Check if prayer is below threshold.

Parameters:

ParameterTypeRequiredDescription
thresholdnumberNoThreshold (default: 10)

Returns:

  • boolean - True if low

has_prayer_points

prayer:has_prayer_points(amount: number?) -> boolean

Check if has enough prayer points.

Parameters:

ParameterTypeRequiredDescription
amountnumberNoRequired amount (default: 1)

Returns:

  • boolean - True if has enough

is_prayer_active

prayer:is_prayer_active(prayer_name: string) -> boolean

Check if a prayer is active.

Parameters:

ParameterTypeRequiredDescription
prayer_namestringYesPrayer name (see list below)

Returns:

  • boolean - True if active

Example:

if prayer:is_prayer_active(prayer.Effect.PROTECT_FROM_MELEE) then
    logger:info("Protected from melee")
end

activate_prayer

prayer:activate_prayer(prayer_name: string) -> boolean

Activate a prayer.

Parameters:

ParameterTypeRequiredDescription
prayer_namestringYesPrayer name

Returns:

  • boolean - True if successful

deactivate_prayer

prayer:deactivate_prayer(prayer_name: string) -> boolean

Deactivate a prayer.

Parameters:

ParameterTypeRequiredDescription
prayer_namestringYesPrayer name

Returns:

  • boolean - True if successful

toggle_prayer

prayer:toggle_prayer(prayer_name: string, enable: boolean) -> boolean

Toggle prayer on/off.

Parameters:

ParameterTypeRequiredDescription
prayer_namestringYesPrayer name
enablebooleanYesTrue to activate, false to deactivate

Returns:

  • boolean - True if successful

deactivate_all

prayer:deactivate_all() -> boolean

Deactivate all active prayers.

Returns:

  • boolean - True if successful

active_prayers

prayer:active_prayers() -> table

Get list of active prayers.

Returns:

  • table - Array of active prayer names

Example:

local active = prayer:active_prayers()
for _, name in ipairs(active) do
    logger:info("Active: " .. name)
end

is_quick_prayer_active

prayer:is_quick_prayer_active() -> boolean

Check if quick prayers are active.

Returns:

  • boolean - True if quick prayers on

toggle_quick_prayers

prayer:toggle_quick_prayers() -> boolean

Toggle quick prayers on/off.

Returns:

  • boolean - True if successful

activate_quick_prayers

prayer:activate_quick_prayers() -> boolean

Activate quick prayers.

Returns:

  • boolean - True if successful

deactivate_quick_prayers

prayer:deactivate_quick_prayers() -> boolean

Deactivate quick prayers.

Returns:

  • boolean - True if successful

quick_prayers

prayer:quick_prayers() -> table

Get list of quick prayers.

Returns:

  • table - Array of quick prayer names

set_quick_prayers

prayer:set_quick_prayers(prayer_names: table) -> boolean

Set quick prayers from list.

Parameters:

ParameterTypeRequiredDescription
prayer_namestableYesArray of prayer names

Returns:

  • boolean - True if successful

Prayer Names

Available prayers (use prayer.Effect.PRAYER_NAME):

  • THICK_SKIN
  • BURST_OF_STRENGTH
  • CLARITY_OF_THOUGHT
  • SHARP_EYE
  • MYSTIC_WILL
  • ROCK_SKIN
  • SUPERHUMAN_STRENGTH
  • IMPROVED_REFLEXES
  • RAPID_RESTORE
  • RAPID_HEAL
  • PROTECT_ITEM
  • HAWK_EYE
  • MYSTIC_LORE
  • STEEL_SKIN
  • ULTIMATE_STRENGTH
  • INCREDIBLE_REFLEXES
  • PROTECT_FROM_MAGIC
  • PROTECT_FROM_MISSILES
  • PROTECT_FROM_MELEE
  • EAGLE_EYE
  • MYSTIC_MIGHT
  • RETRIBUTION
  • REDEMPTION
  • SMITE
  • CHIVALRY
  • PIETY
  • PRESERVE
  • RIGOUR
  • AUGURY
  • DEADEYE
  • MYSTIC_VIGOUR

Common Patterns

PvP Protection

local function enable_pvp_protection()
    prayer:activate_prayer(prayer.Effect.PROTECT_FROM_MELEE)
    prayer:activate_prayer(prayer.Effect.RAPID_RESTORE)
    prayer:activate_prayer(prayer.Effect.EAGLE_EYE)
end

enable_pvp_protection()

Melee Boost

local function boost_melee()
    prayer:deactivate_all()
    prayer:activate_prayer(prayer.Effect.ULTIMATE_STRENGTH)
    prayer:activate_prayer(prayer.Effect.INCREDIBLE_REFLEXES)
    prayer:activate_prayer(prayer.Effect.PROTECT_ITEM)
end

boost_melee()

Prayer Point Management

local function manage_prayers()
    if prayer:is_low_prayer(15) then
        logger:warn("Prayer low, restoring...")
        
        local prayer_potion = inventory:find_first({name_contains = "Prayer"})
        if prayer_potion then
            prayer_potion:click()
        end
    end
end

Quick Prayer Toggle

local function toggle_quick_prayer_with_check()
    if prayer:has_prayer_points(10) then
        prayer:toggle_quick_prayers()
        logger:info("Quick prayers toggled")
    else
        logger:warn("Not enough prayer points")
    end
end

Combat Prayer Rotation

local function rotate_combat_prayers()
    local prayers_to_use = {
        prayer.Effect.ULTIMATE_STRENGTH,
        prayer.Effect.INCREDIBLE_REFLEXES,
        prayer.Effect.PIETY
    }
    
    for _, prayer_name in ipairs(prayers_to_use) do
        if not prayer:is_prayer_active(prayer_name) then
            prayer:activate_prayer(prayer_name)
            return
        end
    end
end

Related APIs

  • Skills API - Prayer level
  • Inventory API - Prayer potions
  • Combat API - Combat mechanics