Skip to content

Scripting Overview

Introduction

The Razor Scripting Engine is a "command based scripting language" designed to make it easier to read, create, edit and share Razor scripts.

To learn more about this version of Razor, please visit the home page or GitHub repository.

Design

This is not an implementation of the Steam or Razor Enhanced scripting languages or functionality into Razor. The scripting engine attempts to maintain existing Razor functionality while offering quality of life improvements over the existing macro system.

For example, instead of having to do the following:

  • Record macro
  • Double click dagger
  • Stop recording
  • Right-click on dagger
  • Select Double Click use by type

You can simply type:

1
dclicktype 'dagger'

Scripts vs. Macros

While updates to Razor have made it easier to share macros with friends, one of the core issues with Razor macros is the serialized format they are stored in, which essentially makes it the syntax. While one could edit macros outside of Razor, it was never designed for user input and simply uses | as a delimiter to store commands and parameters.

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. More so, is not user friendly if one were to type want to type it out.

1
2
3
Assistant.Macros.MacroCastSpellAction|33
Assistant.Macros.WaitForTargetAction|30
Assistant.Macros.TargetRelLocAction|3|1

With a Razor script, it becomes:

1
2
3
cast 'blade spirits'
waitfortarget
targetrelloc 3 1

Another example using a script that uses detect hidden, waits for target, targets self, waits .40 seconds, checks sysmessage, says something and targets the closest mobile.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Assistant.Macros.UseSkillAction|14
Assistant.Macros.WaitForTargetAction|30
Assistant.Macros.HotKeyAction|1059|
Assistant.Macros.PauseAction|00:00:00.4000000
Assistant.Macros.IfAction|4|0|you can see nothing
Assistant.Macros.ElseAction
Assistant.Macros.SpeechAction|0|38|3|ENU|2|16|52|I Ban Thee
Assistant.Macros.WaitForTargetAction|30
Assistant.Macros.HotKeyAction|2003|
Assistant.Macros.EndIfAction

With a Razor script, it becomes:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
skill 'detecthidden'
waitfortarget
target 'self'

wait 400

if insysmsg 'you see nothing'
    overhead 'All clear'
else
    say 'I ban thee'
    waitfortarget
    hotkey 'target closest grey humanoid'
endif

As you can see, while maintaining the same functionality, a Razor script is much easier to read and edit.

Script Editor

Razor Script can be written using any text editor. The script editor built into Razor offers syntax highlighting and auto-completion.

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.


Last update: 2021-01-28