Skip to content

Expressions

Expressions Overview

When using the if or while conditions, you can access the following expressions to check against.

The following operators are supported:

Operator Description
= Equal
== Equal
!= Not equal
< Less than
<= Less than or equal
> Greater than
>= Greater than or equal

count/counter

  • count ('name of counter')
  • counter ('name of counter')
  • count ('name of item') [hue]
  • count (graphicID) [hue]

Description: Used to get the current amount of a specific item in player's backpack. Omitting the hue argument will result in count of all items of the specified type regardless of their hue. The expression can be used either directly by item type and hue, or by referencing a named counter manually set up in the Counters tab. More info

Example

1
2
3
if count 'garlic' < 5
    say 'getting low on garlic'
endif
1
2
3
if count 'spellbook' '1121' == 0
    say 'no runebooks found!'
endif
1
2
3
if count 'gold coin' > count 'gold coin' 0
    overhead 'woot woot fancy coins in the pack!'
endif

diffhits

  • diffhits
  • diffhp

Description: Used to get the difference between you max hits and current hits.

Example

1
2
3
if diffhits > 40
    overhead 'I need a heal!'
endif

diffmana

  • diffmana

Description: Used to get the difference between you max mana and current mana.

Example

1
2
3
if diffmana > 40
    skill 'Meditation'
endif

diffstam

  • diffstam

Description: Used to get the difference between you max stamina and current stamina.

Example

1
2
3
 if diffstam > 30
    overhead 'Need stamina'
endif

diffweight

  • diffweight

Description: Used to get the difference between you max weight and current weight.

Example

1
2
3
if diffweight > 20
    overhead 'I can lift 20 more stone'
endif

followers

Description: Used to get the current number of followers.

Example

1
2
3
4
5
if followers = 0
    overhead 'No one following me!'
else
    overhead 'I have followers'
endif
1
2
3
4
5
if followers < maxfollowers
    overhead 'You can have more followers!'
else
    overhead 'You hit your followers limit'
endif

findbuff

  • findbuff 'name of buff/debuff

Description: Used to check if a specific buff/debuff is applied to you.

Example

1
2
3
4
5
6
7
if findbuff 'magic reflection'
    overhead 'Im set!'
else
    cast 'magic reflection'
    wft
    target 'self'
endif

findtype

  • findtype ('name of item') [inrangecheck (true/false)/backpack] [hue] OR findtype (graphicID) [inrangecheck (true/false)/backpack] [hue]

Description: Used to check if a specific item name of graphic ID exists. Range check, if true, will check within 2 tiles.

The as keyword

If you use findtype along with as you can assign a temporary variable to use throughout the script. See example below.

In-Game Info Gump

Not sure what name to enter or graphic ID to enter? Type >info and click on any item or mobile for more information.

item-command

Click the blue dot next to the value you want to copy to the clipboard.

Example

1
2
3
if findtype 'saw'
    say 'found saw'
endif
1
2
3
if findtype '4148'
    say 'found saw'
endif
1
2
3
if findtype 'saw' true
    say 'found saw within 2 tiles'
endif
1
2
3
if findtype 'saw' backpack
    say 'found saw in my pack'
endif
1
2
3
4
if findtype 'dagger' as 'mydagger'
    overhead 'found dagger'
    dclick 'mydagger'
endif
1
2
3
4
if findtype 'dagger' backpack 45 as 'mydagger'
    overhead 'found dagger'
    dclick 'mydagger'
endif

hidden

  • hidden

Description: Used to check if you are hidden.

Example

1
2
3
if hidden
    overhead 'they cant see me'
endif

hp & maxhp

  • hp
  • maxhp
  • hits
  • maxhits

Description: Used to get your current or max hit points/health levels.

Example

1
2
3
4
while hp < 100
    say 'not at 100 yet'
    wait 5000
endwhile
1
2
3
if maxhp = 120
    say 'Full hp!'
endif

insysmsg

  • insysmsg ('message to look for')
  • insysmessage ('message to look for')

Description: Used to check if certain text appears within the system message log.

System Message Queue

Not sure if a specific message is in Razor's system message queue? Type >sysmsgs to see what Razor can find.

Using clearsysmsg will clear out the queue completely.

Example

1
2
3
if insysmsg 'too far away'
    overhead 'You are too far away'
endif

invuln

  • invuln
  • invul
  • blessed

Description: Used to get your invulnerable status

Example

1
2
3
if invuln
    overhead 'I feel.. so powerful.'
endif

itemcount

  • itemcount

Description: Used to return the current number of items you're carrying

Example

1
2
3
if itemcount < 125
    overhead 'I still have room!'
endif

lhandempty

  • lhandempty

Description: Used to check if your left hand is empty

Example

1
2
3
if lhandempty
    hotkey 'empty right hand!'
endif

mana & maxmana

  • mana
  • maxmana

Description: Used to get your current or max mana levels.

Example

1
2
3
4
while mana < maxmana
    skill 'meditation'
    wait 11000
endwhile

maxfollowers

Description: Used to get the maximum number of allowed followers.

Example

1
2
3
if followers = maxfollowers
    overhead 'You hit your limit'       
endif
1
2
3
4
5
if followers < maxfollowers
    overhead 'You can have more followers!'
else
    overhead 'You hit your followers limit'
endif

maxweight

  • maxweight

Description: Used to get your max allowed weight.

Example

1
2
3
if weight <= maxweight
    say 'I am overweight'
endif

mounted

  • mounted

Description: Used to check if you are currently on a mount

Example

1
2
3
4
5
if mounted
    say 'mounted'
else
    say 'not mounted'
endif

name

  • name

Description: Used to get your name of the currently logged in character

Example

1
2
3
if name = 'Quick'
    overhead 'thats me!'
endif

paralyzed

  • paralyzed

Description: Used to check if you are currently paralyzed.

Example

1
2
3
if paralyzed
    overhead 'I cannot move!'
endif

poisoned

  • poisoned

Description: Used to check if you are currently poisoned.

Example

1
2
3
if poisoned
    hotkey 'drink cure'
endif

position

  • position (x, y)
  • position (x, y, z)

Description: Used to check if your current position matches the provided.

Example

1
2
3
4
5
if position 2729 2133
    overhead 'You are currently in front of the Bucs Den teleporter'
elseif position 2728 2133 5
    overhead 'You are standing on the Bucs Den teleporter'
endif

queued

  • queued

Description: Used to check if your current queue is active (from restocking, organizing, etc)

Example

1
2
3
4
5
    if queued
        overhead 'Queue is active'
    else
        overhead 'No queue'
    endif
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
overhead 'Organizing'

organizer 1

while queued
    overhead 'Currently Organizing'
    wait 500 
endwhile

overhead 'Organized'
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
overhead 'Restocking'

restock 11
waitfortarget 
target 'self'

while queued
    overhead 'Currently restocking'
    wait 500 
endwhile

overhead 'Restocked'

rhandempty

  • rhandempty

Description: Used to check if your right hand is empty

Example

1
2
3
if rhandempty
    hotkey 'empty right hand!'
endif

skill

  • skill ('name')

Description: Used to get the current skill level for a given skill.

Supported skill names

anatomy, animallore, itemidentification, itemid, armslore, begging, peacemaking, peace, cartography, detectinghidden, discord, discordance, evaluatingintelligence, evalint, forensicevaluation, forensiceval, hiding, provocation, provo, inscription, poisoning, spiritspeak, stealing, taming, tasteidentification, tasteid, tracking, meditation, stealth, removetrap, imbuing

Example

1
2
3
4
5
if skill 'magery' < 62.5
    cast 'invisibility'
    waitfortarget
    target 'self'
endif

stam & maxstam

  • stam
  • maxstam

Description: Used to get your current stamina or max stamina.

Example

1
2
3
if stam < 30
say 'I need to rest'
endif
1
2
3
if maxstam = 120
say 'I feel so powerful!'
endif

str, dex & int

  • str
  • dex
  • int

Description: Used to get your current strength, dexterity and intelligence.

Example

1
2
3
if str = 100
    say 'I am a strong person'
endif

targetexists

  • targetexists ['any'/'beneficial'/'harmful'/'neutral']

Description: Used to check if the client current has a target cursor up

Example

1
2
3
4
5
if targetexists 'beneficial'
    overhead 'Beneficial target found'
elseif targetexists 'harmful'
    overhead 'Harmful target found'
endif

varexist

  • varexist
  • varexists

Description: Used to check if a variable exists.

Example

1
2
3
4
5
6
7
8
if not varexist 'myrunebook'
    overhead 'Runebook variable not found -- select one'
    setvar 'myrunebook'
endif

dclick 'myrunebook'
waitforgump 'any'
gumpresponse 5

warmode

  • warmode

Description: Used to get your current combat/war status

Example

1
2
3
4
5
if warmode
    overhead 'I'm read to fight'
else
    overhead 'Peace to you'
endif

weight

  • weight

Description: Used to get your current weight.

Example

1
2
3
if weight = 300
    say 'I feel heavy'
endif

Last update: 2022-11-24