Lich script development
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: Probably the single most useful function in this file is bput
(short for 'blocking put').
bput is designed to be a more robust version of fput in situations where you know the desired response from the game. Unlike fput which will resend the same command repeatedly until it sees the desired message first from the game, bput only sends a given command one time (unless round time or type ahead errors occur) and then waits for the desired response. if the desired response isn't seen bput will eventually time out and echo debugging information.
This would never work because the game sends a response line "You search around..." before "Roundtime" is encountered:
fput "forage grass", 'Roundtime'
Similarly a command that can only succeed once can cause fput to hang. In this case, you have to deal with the failure case and just spam the command until failure in a noisy room with fput:
fput "get box", 'you pick up', 'get what?'
Lets you know with confidence if a box was picked up or if the item was missing:
bput "get box", 'you pick up', 'get what?'
Script arguments:
Settings used in this script:
UserVars used in this script:
Other scripts used by this script:
common-arcana
A large set of helper functions for common actions related to spell casting, ability activation, etc.
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-healing
A large set of helper functions for common actions related to health, wounds, and healing.
Script usage:
Script arguments:
Settings used in this script:
UserVars used in this script:
Other scripts used by this script:
common-items
A large set of helper functions for common actions related to manipulating items.
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:
sorter
A script that converts inventories into sorted categories.
Script usage:
Script arguments:
Settings used in this script:
- width: (0-9999) Specify how many characters wide your game window is, and the script will display container contents in columns.
- mute_old_inventory: (True|False) Will mute the normal output for inventory, so you don't get sorted version and the normal output
- sort_inv_command: (True|False) Sorts the output from command "inventory"
- sort_look_others: (True|False) Sorts the output looking at other players
- sort_look_items_command: (True|False) Sorts the output from command "look item"
- ignore_categories: Categories from base-items.yaml to ignore. Enter in regex format. Default is
lootables|trash
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.