Razor Scripting: Difference between revisions
(Created page with "The Razor assistant distributed with the Outlands client is a fork of Razor Community Edition. The scripting engine is well documented [https://razorce.com here]. Outlands has...") |
No edit summary |
||
Line 1: | Line 1: | ||
The Razor assistant distributed with the Outlands client is a fork of Razor Community Edition. The scripting engine is well documented [https://razorce.com here]. Outlands has additionally extended that scripting engine with the following features. | The Razor assistant distributed with the Outlands client is a fork of Razor Community Edition. The scripting engine is well documented [https://razorce.com here]. Outlands has additionally extended that scripting engine with the following features. | ||
==Lists== | ==Lists== | ||
List support includes the following commands: | List support includes the following commands: | ||
Line 52: | Line 52: | ||
This will iterate the elements in my_list, assigning the variable 'x' to the next element on each iteration. | This will iterate the elements in my_list, assigning the variable 'x' to the next element on each iteration. | ||
==Timers== | ==Timers== | ||
Timers represent background timers that run while the rest of your script executes. All units are in milliseconds. They can be queried to check how much time has elapsed since they were started, or reset back to an earlier count. | Timers represent background timers that run while the rest of your script executes. All units are in milliseconds. They can be queried to check how much time has elapsed since they were started, or reset back to an earlier count. | ||
Revision as of 06:00, 17 February 2021
The Razor assistant distributed with the Outlands client is a fork of Razor Community Edition. The scripting engine is well documented here. Outlands has additionally extended that scripting engine with the following features.
Lists
List support includes the following commands:
createlist ('list name')
Create a new list
clearlist ('list name')
Clear an existing list
removelist ('list name')
Delete a list
pushlist ('list name') ('element value') ['front'/'back']
Add an item to the front or back of the list
poplist ('list name') ('element value'/'front'/'back')
Remove an item from the front of back of the list
Additionally, the following list-related expressions have been added. These may be used within if
and while
statements.
listexists ('list name')
True if the list exists
list (list name) (operator) (value)
Compare the length of the list to an integer
inlist (list name) (element)
Test if an element is in a list.
Finally, for
and foreach
loops can be used for iteration as follows:
for 10 say 'hello' endfor
This will iterate exactly 10 times.
foreach x in my_list say x endfor
This will iterate the elements in my_list, assigning the variable 'x' to the next element on each iteration.
Timers
Timers represent background timers that run while the rest of your script executes. All units are in milliseconds. They can be queried to check how much time has elapsed since they were started, or reset back to an earlier count.
The following commands for working with timers have been added:
createtimer (timer name)
Create a new timer, starting at 0.
removetimer (timer name)
Destroy an existing timer.
settimer (timer name) (value)
Set a timer to the given value. It will begin counting up from the given value immediately.
Additionally, two expressions have been added for timers:
timer ('timer name') (operator) (value)
Compare the current value of the timer (the time elapsed since it was started in milliseconds) to a given value
timerexists ('timer name')
Check if a timer exists
Example:
// Create a new timer if not timerexists 'sample' createtimer 'sample' endif // Reset every 10 seconds if timer 'sample' > 10000 settimer 'sample' 0 endif