Expressions
Statements & Loops¶
As found in the Razor macro system, you can use if, for, foreach, and while when writing a script to add some basic logic and flows.
if¶
Syntax:
1 2 3 4 5 6 7 | |
Description: This selects a path to execute based on the value of a boolean expression. An if statement can be combined with else or elseif to choose two or more distinct paths based on the result of the boolean expression. All if statements must end with endif.
Example
1 2 3 | |
1 2 3 4 5 6 7 8 9 | |
1 2 3 4 5 6 7 | |
1 2 3 | |
for¶
Syntax:
1 2 3 | |
Description: This allows you to execute a block of commands a specific number of times. All for loops must end with endfor.
Tip
You can use the index variable to track your position in the for loop.
When using for or while you have access to the index variable. This can be used with overhead (for example) to indicate the current loop number.
Example
1 2 3 4 | |
1 2 3 4 | |
foreach¶
Syntax:
1 2 3 | |
Description: This allows you to iterate over a list containing values. All foreach loops must end with endfor.
Example
1 2 3 4 5 6 7 | |
while¶
Syntax:
1 2 3 | |
Description: This allows you execute a block of commands while a certain expression is true. All while loops must end with endwhile.
Example
1 2 3 4 | |
Expression Operators¶
When using the if or while conditions, you can access the following expressions in the statement.
The following operators are supported:
| Operator | Description |
|---|---|
| = | Equal |
| == | Equal |
| != | Not equal |
| < | Less than |
| <= | Less than or equal |
| > | Greater than |
| >= | Greater than or equal |
Expressions¶
Expressions are combined with statements like if and while to alter the execution path of your script.
Below are the several different types of expressions you can use broken into categories.
List Expressions¶
inlist¶
inlist ('list name') ('list item')
Description: Used to check if a specific item is in a list
Example
1 2 3 | |
list¶
list ('list name')
Description: Used to check how many items are in a specific list
Example
1 2 3 | |
listexists¶
listexists ('list name')
Description: Used to check if a list exists with a specific name.
Example
1 2 3 | |
poplist¶
poplist ('list name') ('list value'/'front'/'back')
Description: This command will remove (pop) an item from the list. You can either pass in the specific item, or use front or back to remove the item from the front or back of the list.
Example
1 2 3 | |
Misc Expressions¶
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 | |
1 2 3 | |
1 2 3 | |
findtype¶
findtype ('name of item') [inrangecheck (true/false)/backpack] [hue]ORfindtype (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.

Click the blue dot next to the value you want to copy to the clipboard.
Example
1 2 3 | |
1 2 3 | |
1 2 3 | |
1 2 3 | |
1 2 3 4 | |
1 2 3 4 | |
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 | |
itemcount¶
itemcount
Description: Used to return the current number of items you're carrying
Example
1 2 3 | |
queued¶
queued
Description: Used to check if your current queue is active (from restocking, organizing, etc)
Example
1 2 3 4 5 | |
1 2 3 4 5 6 7 8 9 10 | |
1 2 3 4 5 6 7 8 9 10 11 12 | |
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 | |
varexist¶
varexistvarexists
Description: Used to check if a variable exists.
Example
1 2 3 4 5 6 7 8 | |
Player Attribute Expressions¶
diffhits¶
diffhitsdiffhp
Description: Used to get the difference between you max hits and current hits.
Example
1 2 3 | |
diffmana¶
diffmana
Description: Used to get the difference between you max mana and current mana.
Example
1 2 3 | |
diffstam¶
diffstam
Description: Used to get the difference between you max stamina and current stamina.
Example
1 2 3 | |
diffweight¶
diffweight
Description: Used to get the difference between you max weight and current weight.
Example
1 2 3 | |
followers¶
Description: Used to get the current number of followers.
Example
1 2 3 4 5 | |
1 2 3 4 5 | |
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 | |
hidden¶
hidden
Description: Used to check if you are hidden.
Example
1 2 3 | |
hp & maxhp¶
hpmaxhphitsmaxhits
Description: Used to get your current or max hit points/health levels.
Example
1 2 3 4 | |
1 2 3 | |
lhandempty¶
lhandempty
Description: Used to check if your left hand is empty
Example
1 2 3 | |
invuln¶
invulninvulblessed
Description: Used to get your invulnerable status
Example
1 2 3 | |
mana & maxmana¶
manamaxmana
Description: Used to get your current or max mana levels.
Example
1 2 3 4 | |
maxfollowers¶
Description: Used to get the maximum number of allowed followers.
Example
1 2 3 | |
1 2 3 4 5 | |
maxweight¶
maxweight
Description: Used to get your max allowed weight.
Example
1 2 3 | |
mounted¶
mounted
Description: Used to check if you are currently on a mount
Example
1 2 3 4 5 | |
name¶
name
Description: Used to get your name of the currently logged in character
Example
1 2 3 | |
paralyzed¶
paralyzed
Description: Used to check if you are currently paralyzed.
Example
1 2 3 | |
poisoned¶
poisoned
Description: Used to check if you are currently poisoned.
Example
1 2 3 | |
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 | |
rhandempty¶
rhandempty
Description: Used to check if your right hand is empty
Example
1 2 3 | |
skill¶
skill ('name')
Description: Used to get the current skill level for a given skill.
Supported skill names
Razor used to rely on a static list of names but now reads from your client's skills.mul file for the names of the skill.
Real vs Shown (or Value)
By default, Razor will compare against the shown skill value that includes other factors such as your stats. If you'd like to compare to the real skill value, use the ! in front of skill. See the example below.
Example
1 2 3 4 5 | |
1 2 3 4 5 6 7 | |
stam & maxstam¶
stammaxstam
Description: Used to get your current stamina or max stamina.
Example
1 2 3 | |
1 2 3 | |
str, dex & int¶
strdexint
Description: Used to get your current strength, dexterity and intelligence.
Example
1 2 3 | |
1 2 3 | |
1 2 3 | |
warmode¶
warmode
Description: Used to get your current combat/war status
Example
1 2 3 4 5 | |
weight¶
weight
Description: Used to get your current weight.
Example
1 2 3 | |
Timer Expressions¶
timer¶
timer ('name')
Description: Used to check how much time is left in an existing timer
Example
1 2 3 4 5 6 7 8 9 | |
1 2 3 4 5 6 7 8 9 10 11 12 | |
timerexists¶
timerexist ('name')
Description: Used to check if a timer exists
Example
1 2 3 4 5 6 7 8 9 | |