UOSAGAS Scripting

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”.

Targeting

targetexists

targetexists ['any' | 'beneficial' | 'harmful' | 'neutral']

Checks for a target cursor, optionally of a specific kind.

ParameterMeaning
kind optional any (default), beneficial, harmful or neutral.
Example
if targetexists 'harmful'
    target 'closest' 'enemy'
endif

Magic & Skills

bandaging

bandaging

Returns the seconds left on the running bandage; 0 means you are free to apply the next one. Works for healing and veterinary.

Example
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.

ParameterMeaning
'name of skill' Skill name with spaces removed.
Example
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.

ParameterMeaning
gumpId | 'any' Which gump to look for.
Example
if gumpexists 'any'
    gumpclose
endif

ingump

ingump ('text') [gumpId | 'any']

Substring search over the text of an open gump.

ParameterMeaning
'text' Text to look for.
gumpId | 'any' optional Which gump to search. Defaults to the last one opened.
Example
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.

ParameterMeaning
'list name' List name.
index Position, starting at 0.
Example
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.

ParameterMeaning
'name' Cooldown name.
Example
if cooldown 'bandage' > 2000
    overhead 'more than 2s left'
endif

inlist

inlist ('list name') (element)

Case-insensitive search through the list.

ParameterMeaning
'list name' List name.
element Value to look for.
Example
if not inlist 'loot' 0x19B9
    pushlist 'loot' 0x19B9
endif

list

list ('list name')

Returns the list length.

ParameterMeaning
'list name' List name.
Example
if list 'loot' > 0
    poplist 'loot' 'front'
endif

listexists

listexists ('list name')

Checks whether the list has been created.

ParameterMeaning
'list name' List name.
Example
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.

ParameterMeaning
'list name' List name.
'element' | 'front' | 'back' What to remove.
Example
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.

ParameterMeaning
'timer name' Timer name.
Example
createtimer 'trip'
while timer 'trip' < 60000
    walk 'North'
endwhile

timerexists

timerexists ('timer name')

Checks whether the timer has been created.

ParameterMeaning
'timer name' Timer name.
Example
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

ParameterMeaning
'name' Variable name.
Example
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.

ParameterMeaning
'name' Variable name.
Example
if not varexist 'dummy'
    setvar 'dummy'
endif

Player State

blessed

blessed

True when your character is blessed / invulnerable. 'invul' and 'invuln' are aliases.

Also spelled invul , invuln

Example
if blessed
    overhead 'safe'
endif

dead

dead [mobile]

Without an argument, true when your character is a ghost. With a serial, true when that mobile is visible as a ghost.

ParameterMeaning
mobile optional Serial of the mobile to check. A mobile that is unknown to the client counts as not dead.
Example
if not dead
    # main loop
endif

dex

dex

Current dexterity.

Example
if dex > 90
    overhead 'quick'
endif

diffhits

diffhits

maxhp minus hp, usually easier to read than comparing both. 'diffhp' is an alias.

Also spelled diffhp

Example
if diffhits > 30
    potion 'heal'
endif

diffhp

diffhits

maxhp minus hp, usually easier to read than comparing both. 'diffhp' is an alias.

Example
if diffhits > 30
    potion 'heal'
endif

diffmana

diffmana

maxmana minus mana.

Example
if diffmana > 40
    skill 'meditation'
endif

diffstam

diffstam

maxstam minus stam.

Example
if diffstam > 40
    potion 'refresh'
endif

diffweight

diffweight

maxweight minus weight.

Example
if diffweight < 20
    overhead 'nearly full'
endif

findbuff

⚠ Not supported
findbuff ('name of buff')

Searches your active buffs by name.

ParameterMeaning
'name of buff' Buff name, substring match.
Example
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.

ParameterMeaning
'name of debuff' Debuff name, substring match.
Example
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.

followers

followers

Current follower slots in use.

Example
if followers < maxfollowers
    overhead 'can tame more'
endif

hidden

hidden

True while your character is not visible.

Example
if not hidden
    skill 'hiding'
endif

hits

hp

Current hit points. 'hits' is an alias.

Example
if hp < 50
    potion 'heal'
endif

See also maxhp · diffhits

hp

hp

Current hit points. 'hits' is an alias.

Also spelled hits

Example
if hp < 50
    potion 'heal'
endif

See also maxhp · diffhits

int

int

Current intelligence.

Example
if int >= 100
    overhead 'clever'
endif

invul

blessed

True when your character is blessed / invulnerable. 'invul' and 'invuln' are aliases.

Example
if blessed
    overhead 'safe'
endif

invuln

blessed

True when your character is blessed / invulnerable. 'invul' and 'invuln' are aliases.

Example
if blessed
    overhead 'safe'
endif

lhandempty

lhandempty

True when nothing is equipped on the left hand layer.

Example
if lhandempty
    overhead 'shield?'
endif

mana

mana

Current mana.

Example
if mana >= 11
    cast 'greater heal'
endif

maxfollowers

maxfollowers

Maximum follower slots.

Example
if followers = maxfollowers
    overhead 'full'
endif

maxhits

maxhp

Maximum hit points. 'maxhits' is an alias.

Example
if hp != maxhp
    hotkey 'Bandage self'
endif

maxhp

maxhp

Maximum hit points. 'maxhits' is an alias.

Also spelled maxhits

Example
if hp != maxhp
    hotkey 'Bandage self'
endif

maxmana

maxmana

Maximum mana.

Example
while mana < maxmana
    skill 'meditation'
    wait 11000
endwhile

maxstam

maxstam

Maximum stamina.

Example
if stam = maxstam
    overhead 'rested'
endif

maxweight

maxweight

Maximum weight before you are overloaded.

Example
if diffweight < 20
    script 'bank run'
endif

mounted

mounted

True when something is on your mount layer.

Example
if not mounted
    dclick 'lastobject'
endif

name

name

The name of your character.

Example
if name = 'Rex'
    overhead 'hello'
endif

paralyzed

paralyzed

True while your character cannot move.

Example
if paralyzed
    overhead 'Paralyzed!' 38
endif

poisoned

poisoned

True while your character is poisoned.

Example
if poisoned
    potion 'cure'
endif

position

position (x) (y) [z]

Compares your position to the given coordinates.

ParameterMeaning
x World X.
y World Y.
z optional World Z. Defaults to your current Z.
Example
if position 5923 1145
    overhead 'on the spot'
endif

rhandempty

rhandempty

True when nothing is equipped on the right hand layer.

Example
if rhandempty
    dclicktype 'dagger'
endif

stam

stam

Current stamina.

Example
if stam < 20
    potion 'refresh'
endif

str

str

Current strength.

Example
if str < 100
    overhead 'weak'
endif

warmode

warmode

True when your character is in war mode.

Example
if not warmode
    warmode 'on'
endif

weight

weight

Current weight.

Example
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

ParameterMeaning
'counter name' | 'name' | graphic Counter name, item name, or graphic ID.
hue optional Restrict to one colour.
Example
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.

ParameterMeaning
'counter name' | 'name' | graphic Counter name, item name, or graphic ID.
hue optional Restrict to one colour.
Example
if count 'bandage' < 20
    restock 1
endif

counttype

counttype ('name' | graphic) [source] [hue] [range]

Adds up the stack sizes of every matching item.

ParameterMeaning
'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
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.

ParameterMeaning
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
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.

ParameterMeaning
self The only supported source.
layer Layer name. See the Layers page.
Example
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.

ParameterMeaning
'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
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

hue

hue (serial)

Returns the hue of an item or mobile.

ParameterMeaning
serial The object to inspect.
Example
if hue 0x40001234 = 0x1809
    overhead 'right colour'
endif

itemcount

itemcount

Total item count in your backpack, including containers inside it.

Example
if itemcount > 120
    overhead 'pack is full'
endif

noto

noto (mobile)

Returns one of: innocent (blue), friend (green), hostile (grey), criminal (grey), enemy (orange), murderer (red), invulnerable (yellow).

ParameterMeaning
mobile The mobile to check.
Example
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.

ParameterMeaning
'text' Text to look for.
Example
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

ParameterMeaning
'text' Text to look for.
Example
if insysmsg 'You are frozen'
    dclicktype 'pouch' backpack
endif

See also clearsysmsg · waitforsysmsg

pvp

⚠ Not supported
pvp

Reports whether structured-PvP restrictions are limiting what scripts may do.

Example
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.

queued

queued

True when the action queue is not empty. Useful to wait for a dress or organizer to finish.

Example
dress 'My Sunday Best'
while queued
    wait 100
endwhile