Scripting Overview
Introduction¶
The UO Razor Scripting Engine is a "command based scripting language" designed to make it easier to read, create, edit and share UO Razor scripts.
To learn more about this version of Razor, please visit the home page.
Quick Start¶
Check out the various Commands, Expressions, and Keywords that are available along with working examples.
Design¶
This scripting engine attempts to maintain and improve existing Razor functionality, offer quality of life improvements over the existing macro system, and provide an easily approachable syntax that is accessible regardless of skill level.
For example, instead of having to do the following with a Razor macro:
- Record macro
- Double click dagger
- Stop recording
- Right-click on dagger
- Select Double Click use by type
You can simply type:
1 |
|
Razor Scripts vs. Razor Macros¶
While updates to Razor have made it easier to edit and share macros, one of the core issues is that they weren't designed to be read and edited by users directly, instead the serialized format they're saved in expects you to use the macro editor in Razor.
For example, even a basic macro that casts blade spirit, waits for the target and casts a relative location based on your position can be difficult to read to the untrained eye.
1 2 3 |
|
With a Razor script, it becomes:
1 2 3 |
|
Another example using a script that uses detect hidden, waits for target, targets self, waits .40 seconds, checks for a system message, says something and targets the closest mobile.
1 2 3 4 5 6 7 8 9 10 |
|
With a UO Razor script, it becomes:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
As you can see, while maintaining the same functionality of macros, a Razor script is much easier to read, edit and share.
Convert Macros to Scripts
Right-Click on any macro to convert it to a script.
Script Editor¶
UO Razor scripts can be written using any text editor. The script editor built into Razor offers syntax highlighting and auto-completion.
Window Size
You can resize the Razor window to make the script editor larger. You can also adjust the size of the script list to give you additional room.
Here are a list of some of keyboard shortcuts available in the editor:
General/Misc¶
Common text editor shortcuts (such as Ctrl-C
and Ctrl-V
for copy/paste are not listed):
-
Ctrl+G: Goto to a specific line dialog
-
Ctrl+F: Find/Search dialog
- F3: Find next
- Ctrl+H: Search & replace dialog
- Ctrl+Shift+C: Comment / Uncomment selected code
- Alt+Mouse Drag: Select multiple lines of text
- Ctrl+Home: Go to the first line
- Ctrl+End: Go to the last line
- Alt+Up: Move selected lines up
- Alt+Down: Move selected lines down
Bookmarks¶
- Ctrl+B: Bookmark line
- Ctrl+Shift+B: Remove bookmark
- Ctrl+B: Move cursor to next bookmark
- Ctrl+Shift+N: Move cursor to previous bookmark
Auto-Complete¶
- Ctrl+Space: Open auto-complete menu
Zoom¶
- Ctrl+Mouse Wheel Up: Zoom in
- Ctrl+Mouse Wheel Down: Zoom out
- Ctrl+0: Reset zoom
About¶
The Razor Scripting Engine was designed and implemented by Quick and is released under GPLv3.