UOSAGAS Scripting

Syntax & Comments

Razor Script has almost no punctuation. Learning it is mostly learning three things: how to quote text, how to write a serial, and what the two little modifier symbols do.

One line, one instruction

Each line is a command, optionally followed by arguments separated by spaces. Blank lines are ignored. You can put several statements on one line by separating them with ;, though it rarely reads better.

say 'hello'
wait 500
overhead 'done' 68

Comments

Anything after // or # is ignored to the end of the line. Both work everywhere, so pick one and stay consistent.

// This whole line is a comment
# so is this one
say 'hello'     // and this tail is too

Quoting

Wrap text in single or double quotes whenever it contains a space, and whenever it is a name rather than a keyword. Both quote styles behave identically.

say 'Hello world!'
dclicktype "clean bandage"
hotkey 'Bandage self'

A single word without spaces usually works unquoted. skill anatomy and skill 'anatomy' are the same. Quote anyway: it costs nothing and it keeps a name from colliding with a keyword.

Numbers & serials

Plain numbers are decimal. Anything starting with 0x is hexadecimal. That is how serials and graphic IDs are normally written, and how the client shows them.

wait 650              // 650 milliseconds
dclick 0x400EED2A     // a serial
dclicktype 0x0F0C     // a graphic ID (heal potion)
dclicktype 3852       // the same graphic, in decimal

The @ and ! modifiers

Two symbols change how a command behaves. They can be combined.

@ for quiet

Prefix a command with @ and it stops complaining. Warnings like “item not found” are suppressed; the command still runs. Use it in loops that poll for something which is usually absent.

@dclicktype 'bandage' backpack   // no warning when there are none left

! for force

Suffix a command with ! to change what it does. The exact meaning depends on the command, which is why the reference spells it out per entry. The common cases:

  • pushlist! only adds when the value is not already in the list.
  • poplist! removes every match, not just the first.
  • setvar! keeps the variable in this script only, instead of saving it to your profile.
@setvar! globalTimeout 650    // quiet AND script-local
pushlist! 'ore' 0x19B9        // only if not already there

Putting values in text

overhead and sysmsg replace {{name}} with that variable's value. Handy for seeing what a script actually picked.

if findtype 3852 self as pot
    overhead 'found potion {{pot}}'
endif

The braces also take a whole expression. Anything you could write after if works, with the same arguments and quoting, and prints its current value. That is how you watch a skill tick up while a script runs:

overhead "Alchemy: {{skill 'Alchemy'}}" 88
sysmsg 'hp {{hits}}/{{maxhits}}'
overhead 'bandages left: {{counttype 3617 backpack}}'

Variables win: if a variable and an expression share a name, the braces insert the variable. Skill values print with one decimal place (98.7), true/false expressions print as true or false, and something that is neither a variable nor a valid expression prints as <not found> instead of stopping the script.

Only overhead and sysmsg interpolate. Everywhere else, pass the variable as its own argument: dclick pot, not dclick '{{pot}}'.