Docs / Razor Script / Expression Reference Expression Reference
All 63 expressions the assistant registers. Expressions
read state. Put them in an if or while, compare them with
an operator, or capture a serial with as.
Generated from the assistant itself. Expressions that return a number also read as
true or false: zero is false, anything else is true, so if bandaging means
“a bandage is still running”.
⌕ /
All Targeting Magic & Skills Gumps & Menus Lists, Timers & Variables Player State World & Objects Misc
⚠ Not supported (3)
Targeting targetexists
targetexists ['any' | 'beneficial' | 'harmful' | 'neutral'] Checks for a target cursor, optionally of a specific kind.
Parameter Meaning kind optional any (default), beneficial, harmful or neutral.
Example Copy
if targetexists 'harmful'
target 'closest' 'enemy'
endif Magic & Skills Returns the seconds left on the running bandage; 0 means you are free to apply the next one. Works for healing and veterinary.
Example Copy
if bandaging = 0 and hp != maxhp
hotkey 'Bandage self'
endif On UOSagas: Tracked from the bandage messages and estimated at about 8 seconds, because our server sends no bandage timer. Reliable enough to gate a heal loop, but do not treat it as a precise stopwatch.
skill
skill ('name of skill') Returns the skill value. Add ! to read the base value instead of the modified one.
Parameter Meaning 'name of skill' Skill name with spaces removed.
Example Copy
if skill 'magery' > 50
cast 'greater heal'
endif Gumps & Menus gumpexists
gumpexists (gumpId | 'any') Checks whether a specific gump, or any gump at all, is currently open.
Parameter Meaning gumpId | 'any' Which gump to look for.
Example Copy
if gumpexists 'any'
gumpclose
endif ingump
ingump ('text') [gumpId | 'any'] Substring search over the text of an open gump.
Parameter Meaning 'text' Text to look for. gumpId | 'any' optional Which gump to search. Defaults to the last one opened.
Example Copy
waitforgump 'any'
if ingump 'teleport home'
gumpresponse 4
endif Lists, Timers & Variables atlist
atlist ('list name') (index) Returns the value at the given index, counting from 0.
Parameter Meaning 'list name' List name. index Position, starting at 0.
Example Copy
if atlist 'loot' 0 as first
dclick first
endif cooldown
cooldown ('name') Returns the remaining milliseconds, or 0 when the cooldown is finished or unknown, so a bare 'if cooldown' asks whether it is still running.
Parameter Meaning 'name' Cooldown name.
Example Copy
if cooldown 'bandage' > 2000
overhead 'more than 2s left'
endif inlist
inlist ('list name') (element) Case-insensitive search through the list.
Parameter Meaning 'list name' List name. element Value to look for.
Example Copy
if not inlist 'loot' 0x19B9
pushlist 'loot' 0x19B9
endif Returns the list length.
Parameter Meaning 'list name' List name.
Example Copy
if list 'loot' > 0
poplist 'loot' 'front'
endif listexists
listexists ('list name') Checks whether the list has been created.
Parameter Meaning 'list name' List name.
Example Copy
if not listexists 'loot'
createlist 'loot'
endif poplist
poplist ('list name') ('element' | 'front' | 'back') The expression form of the poplist command: removes the entry and gives you its value.
Parameter Meaning 'list name' List name. 'element' | 'front' | 'back' What to remove.
Example Copy
while list 'loot' > 0
if poplist 'loot' 'front' as item
dclick item
endif
endwhile timer
timer ('timer name') Returns how long the timer has been running.
Parameter Meaning 'timer name' Timer name.
Example Copy
createtimer 'trip'
while timer 'trip' < 60000
walk 'North'
endwhile timerexists
timerexists ('timer name') Checks whether the timer has been created.
Parameter Meaning 'timer name' Timer name.
Example Copy
if not timerexists 'trip'
createtimer 'trip'
endif varexist
varexist ('name') Checks for a saved variable. Add @ to check script-local variables instead. 'varexists' is an alias.
Also spelled varexists
Parameter Meaning 'name' Variable name.
Example Copy
if not varexist 'dummy'
setvar 'dummy'
endif varexists varexist ('name') Checks for a saved variable. Add @ to check script-local variables instead. 'varexists' is an alias.
Parameter Meaning 'name' Variable name.
Example Copy
if not varexist 'dummy'
setvar 'dummy'
endif Player State True when your character is blessed / invulnerable. 'invul' and 'invuln' are aliases.
Also spelled invul , invuln
Example Copy
if blessed
overhead 'safe'
endif Without an argument, true when your character is a ghost. With a serial, true when that mobile is visible as a ghost.
Parameter Meaning mobile optional Serial of the mobile to check. A mobile that is unknown to the client counts as not dead.
Example Copy
if not dead
# main loop
endif Current dexterity.
Example Copy
if dex > 90
overhead 'quick'
endif maxhp minus hp, usually easier to read than comparing both. 'diffhp' is an alias.
Also spelled diffhp
Example Copy
if diffhits > 30
potion 'heal'
endif maxhp minus hp, usually easier to read than comparing both. 'diffhp' is an alias.
Example Copy
if diffhits > 30
potion 'heal'
endif maxmana minus mana.
Example Copy
if diffmana > 40
skill 'meditation'
endif maxstam minus stam.
Example Copy
if diffstam > 40
potion 'refresh'
endif maxweight minus weight.
Example Copy
if diffweight < 20
overhead 'nearly full'
endif findbuff ⚠ Not supported
findbuff ('name of buff') Searches your active buffs by name.
Parameter Meaning 'name of buff' Buff name, substring match.
Example Copy
if not findbuff 'magic reflection'
cast 'magic reflection'
endif On UOSagas: Always false right now. The buff and debuff packet handler is not wired up yet, so Razor sees no buffs at all. The expression parses and runs, it simply never matches. A fix is planned.
finddebuff ⚠ Not supported
finddebuff ('name of debuff') Searches your active debuffs by name.
Parameter Meaning 'name of debuff' Debuff name, substring match.
Example Copy
if finddebuff 'bleed'
potion 'heal'
endif On UOSagas: Always false right now, for the same reason as findbuff: there is no buff or debuff tracking yet.
Current follower slots in use.
Example Copy
if followers < maxfollowers
overhead 'can tame more'
endif True while your character is not visible.
Example Copy
if not hidden
skill 'hiding'
endif Current hit points. 'hits' is an alias.
Example Copy
if hp < 50
potion 'heal'
endif
See also maxhp · diffhits
Current hit points. 'hits' is an alias.
Also spelled hits
Example Copy
if hp < 50
potion 'heal'
endif
See also maxhp · diffhits
Current intelligence.
Example Copy
if int >= 100
overhead 'clever'
endif True when your character is blessed / invulnerable. 'invul' and 'invuln' are aliases.
Example Copy
if blessed
overhead 'safe'
endif True when your character is blessed / invulnerable. 'invul' and 'invuln' are aliases.
Example Copy
if blessed
overhead 'safe'
endif True when nothing is equipped on the left hand layer.
Example Copy
if lhandempty
overhead 'shield?'
endif Current mana.
Example Copy
if mana >= 11
cast 'greater heal'
endif maxfollowers
maxfollowers Maximum follower slots.
Example Copy
if followers = maxfollowers
overhead 'full'
endif Maximum hit points. 'maxhits' is an alias.
Example Copy
if hp != maxhp
hotkey 'Bandage self'
endif Maximum hit points. 'maxhits' is an alias.
Also spelled maxhits
Example Copy
if hp != maxhp
hotkey 'Bandage self'
endif Maximum mana.
Example Copy
while mana < maxmana
skill 'meditation'
wait 11000
endwhile Maximum stamina.
Example Copy
if stam = maxstam
overhead 'rested'
endif Maximum weight before you are overloaded.
Example Copy
if diffweight < 20
script 'bank run'
endif True when something is on your mount layer.
Example Copy
if not mounted
dclick 'lastobject'
endif The name of your character.
Example Copy
if name = 'Rex'
overhead 'hello'
endif True while your character cannot move.
Example Copy
if paralyzed
overhead 'Paralyzed!' 38
endif True while your character is poisoned.
Example Copy
if poisoned
potion 'cure'
endif position
position (x) (y) [z] Compares your position to the given coordinates.
Parameter Meaning x World X. y World Y. z optional World Z. Defaults to your current Z.
Example Copy
if position 5923 1145
overhead 'on the spot'
endif True when nothing is equipped on the right hand layer.
Example Copy
if rhandempty
dclicktype 'dagger'
endif Current stamina.
Example Copy
if stam < 20
potion 'refresh'
endif Current strength.
Example Copy
if str < 100
overhead 'weak'
endif True when your character is in war mode.
Example Copy
if not warmode
warmode 'on'
endif Current weight.
Example Copy
if weight > maxweight
overhead 'overloaded' 38
endif World & Objects count
count ('counter name' | 'name' | graphic) [hue] Reads one of your Display/Counters entries by name. If no counter matches, it counts items of that type instead. 'counter' is an alias.
Also spelled counter
Parameter Meaning 'counter name' | 'name' | graphic Counter name, item name, or graphic ID. hue optional Restrict to one colour.
Example Copy
if count 'bandage' < 20
restock 1
endif counter count ('counter name' | 'name' | graphic) [hue] Reads one of your Display/Counters entries by name. If no counter matches, it counts items of that type instead. 'counter' is an alias.
Parameter Meaning 'counter name' | 'name' | graphic Counter name, item name, or graphic ID. hue optional Restrict to one colour.
Example Copy
if count 'bandage' < 20
restock 1
endif counttype
counttype ('name' | graphic) [source] [hue] [range] Adds up the stack sizes of every matching item.
Parameter Meaning 'name' | graphic Tiledata name or graphic ID. source optional backpack, self, ground, or a container serial. hue optional Restrict to one colour. range optional Maximum distance in tiles.
Example Copy
if counttype 0x0F7A backpack < 50
restock 1
endif find
find (serial) [source] [hue] [quantity] [range] Like findtype, but you already know the serial. Returns the serial when it matches the filters, otherwise 0.
Parameter Meaning serial The object to look for. source optional backpack, self, ground, or a container serial. hue optional Restrict to one colour. quantity optional Minimum stack size. range optional Maximum distance in tiles.
Example Copy
if find 0x40001234 backpack
overhead 'still there'
endif findlayer
findlayer self (layer) Looks up what you are wearing on a given layer. Returns 0 when the layer is empty.
Parameter Meaning self The only supported source. layer Layer name. See the Layers page.
Example Copy
if findlayer self righthand as weapon
getlabel weapon weaponlabel
endif findtype
findtype ('name' | graphic) [source] [hue] [quantity] [range] Searches for an object by Tiledata name or graphic ID. Returns the serial, or 0 when nothing matches, so it reads as true or false inside an if. Use 'as' to keep the result. Item names support the %s% plural wildcard, e.g. "clean bandage%s%" matches both singular and plural.
Parameter Meaning 'name' | graphic Tiledata name (supports %s%) or graphic ID. source optional backpack, self (worn, including container contents), ground, a container serial, or true/false for the CE range check. 'any' skips the slot. hue optional Restrict to one colour. 'any' to ignore. quantity optional Minimum stack size. range optional Maximum distance in tiles.
Example Copy
if findtype "clean bandage%s%" backpack
hotkey 'Bandage self'
endif
if findtype 3852 self as PotsHeal
dclick PotsHeal
endif
See also find · findtypelist · counttype · dclicktype · targettype
Returns the hue of an item or mobile.
Parameter Meaning serial The object to inspect.
Example Copy
if hue 0x40001234 = 0x1809
overhead 'right colour'
endif Total item count in your backpack, including containers inside it.
Example Copy
if itemcount > 120
overhead 'pack is full'
endif Returns one of: innocent (blue), friend (green), hostile (grey), criminal (grey), enemy (orange), murderer (red), invulnerable (yellow).
Parameter Meaning mobile The mobile to check.
Example Copy
if noto 'last' = 'murderer'
attack 'last'
endif Misc insysmessage insysmsg ('text') Substring search over Razor's recent system messages. Clear the queue first if an old match would confuse you. 'insysmessage' is an alias.
Parameter Meaning 'text' Text to look for.
Example Copy
if insysmsg 'You are frozen'
dclicktype 'pouch' backpack
endif
See also clearsysmsg · waitforsysmsg
insysmsg
insysmsg ('text') Substring search over Razor's recent system messages. Clear the queue first if an old match would confuse you. 'insysmessage' is an alias.
Also spelled insysmessage
Parameter Meaning 'text' Text to look for.
Example Copy
if insysmsg 'You are frozen'
dclicktype 'pouch' backpack
endif
See also clearsysmsg · waitforsysmsg
Reports whether structured-PvP restrictions are limiting what scripts may do.
Example Copy
if pvp
overhead 'restricted'
endif On UOSagas: Always false. UOSagas has no structured-PvP restriction system, so nothing is ever restricted. The expression stays registered so scripts that use it still parse and run.
True when the action queue is not empty. Useful to wait for a dress or organizer to finish.
Example Copy
dress 'My Sunday Best'
while queued
wait 100
endwhile
Nothing matches that. Try find, gump or wait.