UOSAGAS Scripting

Getting Started

Razor Script is a small, line-based language for automating your character. Every line is one instruction. There are no brackets, no semicolons and no functions, which makes it quick to learn and hard to over-engineer.

What it is

A script is a plain text file with one command per line. Commands do things (cast, dclick, say). Expressions read things (hp, findtype, bandaging) and are used to decide whether something should happen.

There are 92 commands and 63 expressions. The reference for both is generated from the assistant itself, so if something is listed there, it works here.

Your first script

Open Razor, go to the Scripts tab and press New…. Give it a name, then type this (the Delete button next to it removes a script again, after asking):

hello.razor
// Everything after two slashes is a note to yourself
overhead 'Hello Eren!' 68
sysmsg 'This only I can see'

Press Play. You should see a message float over your head and another appear in the lower-left. Neither is sent to the server. They are yours alone, which makes them the safest way to see what a script is thinking.

Now make it react to something. if runs the indented block only when the expression is true, and endif closes it:

hurt.razor
if hp < maxhp
    overhead 'I am hurt!' 38
endif

Indentation is for your eyes only, Razor ignores it. Use it anyway: a script with four nested ifs and no indentation is unreadable. The editor's Format button (Shift+Alt+F) does it for you.

Where scripts live

Scripts are .razor files in the Scripts folder next to your Razor profile. Subfolders become categories in the list, so you can keep Combat/ apart from Crafting/.

Because they are just text files, a script someone shares with you only needs to be dropped in that folder. Press Refresh and it appears. That is exactly what the script library hands you.

Running a script

Press Play on the Scripts tab, or bind a hotkey to it on the Hot Keys tab and start it from the game. While a script runs, the editor marks the line being executed in blue; if it fails, the offending line turns red and the error tells you which line and why.

Only one script runs at a time. Starting another stops the first. That is deliberate, and it is why script hands over rather than forking.

Making it repeat

A script runs once, top to bottom, and stops. Most useful scripts want to keep watching, so they end with loop, which jumps back to the first line:

autoheal.razor
// Bandage yourself whenever you are hurt and free to do soif not dead    if findtype "clean bandage%s%" backpack        if bandaging = 0 and hp != maxhp            hotkey 'Bandage self'            wait 650        endif    endifendifloop

That is a real, working script, and it already shows most of the language: an expression that finds an item (findtype), one that reads a timer (bandaging), a command that fires a Razor hotkey (hotkey), and a pause so it does not spam the server.

Always pause inside a loop. A loop with no wait runs as fast as the client ticks and will hammer the server. Even wait 100 is enough when nothing needs doing.

Where to go next