Lich script development: Difference between revisions
No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
{{Lich script |
{{Lich script |
||
|description= |
|description= |
||
|usage=You can turn on debug mode with <code>;e UserVars.bootstrap_debug = true</code> |
|||
|usage= |
|||
|args= |
|args= |
||
|settings= |
|settings= |
||
Line 69: | Line 69: | ||
|description= |
|description= |
||
|usage= |
|usage= |
||
For first time setup, see the Getting Started section of the repository README: https://github.com/rpherbig/dr-scripts/blob/master/README.md |
|||
You'll want to remove any of our scripts that you replace with this from the auto start so they aren't getting run twice. |
|||
Useful helpers: |
|||
* <code>get_script('name')</code> - fetch the script and start tracking it |
|||
* <code>get_yaml('filename')</code> - download the specified yaml file to your profiles directory |
|||
* <code>list_autostarts</code> - show all scripts that are started automatically |
|||
* <code>autostart(script)</code> - add a script to the autostart list |
|||
* <code>remove_autostart(script)</code> - remove a script from the autostart list |
|||
* <code>list_tracked_scripts</code> |
|||
You can turn on debug mode by passing 'debug' as an argument with <code>;dependency debug</code> |
|||
|args= |
|args= |
||
|settings= |
|settings= |
||
Line 77: | Line 90: | ||
=== drinfomon === |
=== drinfomon === |
||
{{Lich script |
{{Lich script |
||
|description=Updated info tracking for use in other scripts in DragonRealms |
|||
|description= |
|||
|usage= |
|usage= |
||
* skill tracking - name/rank/xp |
|||
* info tracking - everything listed under info other than debt wealth and birthdate |
|||
Provides some additional commands to the user: |
|||
* <code>;banks</code> - Tracks your money and converts copper strings to plat format. Not all locations tracked. |
|||
* <code>;vault</code> - Tracks vault contents and location. -not all location included |
|||
Display experience gain in your Field Experience window: |
|||
* <code>;e UserVars.track_exp=true</code> |
|||
|args= |
|args= |
||
|settings= |
|settings= |
||
Line 87: | Line 109: | ||
=== events === |
=== events === |
||
{{Lich script |
{{Lich script |
||
|description= |
|description=Flags are simple true/false string detectors. |
||
|usage= |
|usage= |
||
* <code><nowiki>Flags.add(<key>, <trigger>|[<trigger1,...,triggerN])</nowiki></code> |
|||
* <code><nowiki>Flags.add('test', 'exp help')</nowiki></code> |
|||
* <code><nowiki>Flags.add('another', ['exp help', 'a second message'])</nowiki></code> |
|||
This creates a new flag "test", which will return the matched string any time you see a message containing "exp help". Note that |
|||
the message will be treated as a regular expression and is case insensitive (google for more info) so be careful with |
|||
special characters, remember to use single quote strings if you're going to use special characters. |
|||
Calling add with the same key will overwrite any previous matchers and reset the flag. |
|||
Alternatively you can add an array with multiple matchers. If multiple messages match the flag will be set to the first match found. |
|||
* <code><nowiki>Flags.add('skillexp', '(\w[^:\(\)]+):\s+(\d+)\s\d+\.\d+%[^\(\)]*\((\d+)\/\d+\)')</nowiki></code> |
|||
This example will add a flag watching for the results of an exp message, specifically "exp skillname". |
|||
After sending "exp mech" to the game Flags['skillexp'] would contain... |
|||
["Mechanical Lore: 146 16.82% focused (20/34)", "Mechanical Lore", "146", "20"] |
|||
You can see the array containing entire matched string and the three capture groups containing |
|||
skill name, ranks, and mind state. |
|||
* <code><nowiki>Flags['test']</nowiki></code> |
|||
Returns the match if you've seen any message matching after you called add (or reset); false otherwise |
|||
* <code><nowiki>Flags['test'] = false</nowiki></code> |
|||
* <code><nowiki>Flags.reset('test')</nowiki></code> |
|||
Both of these commands have the same effect, reseting a flag as if it hasn't been seen yet. |
|||
* <code><nowiki>Flags.delete('test')</nowiki></code> |
|||
Removes a flag, stopping any tracking of it. |
|||
|args= |
|args= |
||
|settings= |
|settings= |
||
Line 99: | Line 148: | ||
|description= |
|description= |
||
|usage= |
|usage= |
||
* <code>DRSpells.prep_spell</code> - returns the string name of the currently preparing spell or nil |
|||
* <code>DRSpells.active_spells</code> - returns hash of spells keyed to duration e.g. <code>{"Bless"=>5, "Minor Physical Protection"=>12}</code> |
|||
** 0 means fading, removed from the hash is worn off |
|||
|args= |
|args= |
||
|settings= |
|settings= |
Revision as of 18:59, 16 June 2016
Lich script libraries
These are lich scripts, but do not accomplish a task. Rather, they provide functionality that other scripts can take advantage of.
bootstrap
Script usage: You can turn on debug mode with ;e UserVars.bootstrap_debug = true
Script arguments:
Settings used in this script:
UserVars used in this script:
Other scripts used by this script:
common
A large set of helper functions for common actions shared by many scripts.
Script usage:
Script arguments:
Settings used in this script:
UserVars used in this script:
Other scripts used by this script:
common-crafting
A large set of helper functions for common actions related to crafting.
Script usage:
Script arguments:
Settings used in this script:
UserVars used in this script:
Other scripts used by this script:
common-money
A large set of helper functions for common actions related to money and coins.
Script usage:
Script arguments:
Settings used in this script:
UserVars used in this script:
Other scripts used by this script:
common-summoning
A large set of helper functions for common actions related to summoning weapons.
Script usage:
Script arguments:
Settings used in this script:
UserVars used in this script:
Other scripts used by this script:
common-travel
A large set of helper functions for common actions related to travel.
Script usage:
Script arguments:
Settings used in this script:
UserVars used in this script:
Other scripts used by this script:
dependency
Script usage: For first time setup, see the Getting Started section of the repository README: https://github.com/rpherbig/dr-scripts/blob/master/README.md
You'll want to remove any of our scripts that you replace with this from the auto start so they aren't getting run twice.
Useful helpers:
get_script('name')
- fetch the script and start tracking itget_yaml('filename')
- download the specified yaml file to your profiles directorylist_autostarts
- show all scripts that are started automaticallyautostart(script)
- add a script to the autostart listremove_autostart(script)
- remove a script from the autostart listlist_tracked_scripts
You can turn on debug mode by passing 'debug' as an argument with ;dependency debug
Script arguments:
Settings used in this script:
UserVars used in this script:
Other scripts used by this script:
drinfomon
Updated info tracking for use in other scripts in DragonRealms
Script usage:
- skill tracking - name/rank/xp
- info tracking - everything listed under info other than debt wealth and birthdate
Provides some additional commands to the user:
;banks
- Tracks your money and converts copper strings to plat format. Not all locations tracked.;vault
- Tracks vault contents and location. -not all location included
Display experience gain in your Field Experience window:
;e UserVars.track_exp=true
Script arguments:
Settings used in this script:
UserVars used in this script:
Other scripts used by this script:
events
Flags are simple true/false string detectors.
Script usage:
Flags.add(<key>, <trigger>|[<trigger1,...,triggerN])
Flags.add('test', 'exp help')
Flags.add('another', ['exp help', 'a second message'])
This creates a new flag "test", which will return the matched string any time you see a message containing "exp help". Note that the message will be treated as a regular expression and is case insensitive (google for more info) so be careful with special characters, remember to use single quote strings if you're going to use special characters. Calling add with the same key will overwrite any previous matchers and reset the flag. Alternatively you can add an array with multiple matchers. If multiple messages match the flag will be set to the first match found.
Flags.add('skillexp', '(\w[^:\(\)]+):\s+(\d+)\s\d+\.\d+%[^\(\)]*\((\d+)\/\d+\)')
This example will add a flag watching for the results of an exp message, specifically "exp skillname". After sending "exp mech" to the game Flags['skillexp'] would contain...
["Mechanical Lore: 146 16.82% focused (20/34)", "Mechanical Lore", "146", "20"]
You can see the array containing entire matched string and the three capture groups containing skill name, ranks, and mind state.
Flags['test']
Returns the match if you've seen any message matching after you called add (or reset); false otherwise
Flags['test'] = false
Flags.reset('test')
Both of these commands have the same effect, reseting a flag as if it hasn't been seen yet.
Flags.delete('test')
Removes a flag, stopping any tracking of it.
Script arguments:
Settings used in this script:
UserVars used in this script:
Other scripts used by this script:
spellmonitor
Script usage:
DRSpells.prep_spell
- returns the string name of the currently preparing spell or nilDRSpells.active_spells
- returns hash of spells keyed to duration e.g.{"Bless"=>5, "Minor Physical Protection"=>12}
- 0 means fading, removed from the hash is worn off
Script arguments:
Settings used in this script:
UserVars used in this script:
Other scripts used by this script:
Development tools
create_symlinks.bat
Useful if you are doing development on Windows. Set the LICH_SCRIPTS environment variable to the path to your lich/scripts/
directory.
create_symlinks.sh
Useful if you are doing development on OSX or Linux. Pass it an argument of the path to your lich/scripts/
directory.
util/calculate_new_loot.rb
Compares profiles/*-setup.yaml
files against profiles/base.yaml
to determine proper loot_additions and loot_subtractions settings.