Don't forget, you can log in with your Play.net account

Lich script development: Difference between revisions

From Elanthipedia
Jump to navigation Jump to search
No edit summary
No edit summary
 
(8 intermediate revisions by 3 users not shown)
Line 18: Line 18:
{{Lich script
{{Lich script
|description=A large set of helper functions for common actions shared by many scripts.
|description=A large set of helper functions for common actions shared by many scripts.
|usage=
Probably the single most useful function in this file is <code>bput</code> (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:

<code>fput "forage grass", 'Roundtime'</code>

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:

<code>fput "get box", 'you pick up', 'get what?'</code>

Lets you know with confidence if a box was picked up or if the item was missing:

<code>bput "get box", 'you pick up', 'get what?'</code>
|args=
|settings=
|uservars=
|children=
}}

=== common-arcana ===
{{Lich script
|description=A large set of helper functions for common actions related to spell casting, ability activation, etc.
|usage=
|usage=
|args=
|args=
Line 28: Line 53:
{{Lich script
{{Lich script
|description=A large set of helper functions for common actions related to crafting.
|description=A large set of helper functions for common actions related to crafting.
|usage=
|args=
|settings=
|uservars=
|children=
}}

=== common-healing ===
{{Lich script
|description=A large set of helper functions for common actions related to health, wounds, and healing.
|usage=
|args=
|settings=
|uservars=
|children=
}}

=== common-items ===
{{Lich script
|description=A large set of helper functions for common actions related to manipulating items.
|usage=
|usage=
|args=
|args=
Line 69: Line 114:
|description=
|description=
|usage=
|usage=
[https://github.com/elanthia-online/lich-5/wiki/Documentation-for-Installing-and-Upgrading-Lich First Time Setup]
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.
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.
Line 113: Line 158:
* <code><nowiki>Flags.add(<key>, <trigger>|[<trigger1,...,triggerN])</nowiki></code>
* <code><nowiki>Flags.add(<key>, <trigger>|[<trigger1,...,triggerN])</nowiki></code>
* <code><nowiki>Flags.add('test', 'exp help')</nowiki></code>
* <code><nowiki>Flags.add('test', 'exp help')</nowiki></code>
* <code><nowiki>Flags.add('another', ['exp help', 'a second message'])</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
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
the message will be treated as a regular expression and is case insensitive (google for more info) so be careful with
Line 140: Line 185:
|args=
|args=
|settings=
|settings=
|uservars=
|children=
}}

=== sorter ===
{{Lich script
|description=A script that converts inventories into sorted categories.
|usage=
|args=
|settings={{Lich setting|name=width|desc=<nowiki>(0-9999)</nowiki> Specify how many characters wide your game window is, and the script will display container contents in columns.}}^{{Lich setting|name=mute_old_inventory|desc=<nowiki>(True|False)</nowiki> Will mute the normal output for inventory, so you don't get sorted version and the normal output}}^{{Lich setting|name=sort_inv_command|desc=<nowiki>(True|False)</nowiki> Sorts the output from command "inventory"}}^{{Lich setting|name=sort_look_others|desc=<nowiki>(True|False)</nowiki> Sorts the output looking at other players}}^{{Lich setting|name=sort_look_items_command|desc=<nowiki>(True|False)</nowiki> Sorts the output from command "look item"}}^{{Lich setting|name=ignore_categories|desc=Categories from base-items.yaml to ignore. Enter in regex format. Default is <code><nowiki>lootables|trash</nowiki></code>}}
|uservars=
|uservars=
|children=
|children=

Latest revision as of 14:21, 7 January 2025


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


common

A large set of helper functions for common actions shared by many scripts.


common-arcana

A large set of helper functions for common actions related to spell casting, ability activation, etc.


common-crafting

A large set of helper functions for common actions related to crafting.


common-healing

A large set of helper functions for common actions related to health, wounds, and healing.


common-items

A large set of helper functions for common actions related to manipulating items.


common-money

A large set of helper functions for common actions related to money and coins.


common-summoning

A large set of helper functions for common actions related to summoning weapons.


common-travel

A large set of helper functions for common actions related to travel.


dependency


drinfomon

Updated info tracking for use in other scripts in DragonRealms


events

Flags are simple true/false string detectors.


sorter

A script that converts inventories into sorted categories.


spellmonitor


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.