Scroll inventory manager (script)

From Elanthipedia
Revision as of 00:12, 2 March 2015 by ABSOLON (talk | contribs)
Jump to navigation Jump to search
Scroll inventory manager (script)
Category utility
Front-end Genie
Author ABSOLON


Description

Personal output
Shop output

This script will compile a list of scrolls, their locations (including their index - e.g. first, second, etc.) and which spells they contain. It can be used for both scrolls on your person as well as scrolls for sale in a shop. The list is only a snapshot of the scroll inventory at the time the script was run and does not track them if they move around.

These lists are both displayed in their own windows to aid in quickly locating the scroll you need, and so you can compare your inventory side by side with that of a shop if desired.

Scrolls that have not been labelled by reading yet will be listed as 'Unknown' in the output.

Instructions

There are four user variables in the script that need to be set manually.

  • personal_scrolls_output_window - The name of the window that you want your scrolls to display in. Default: Scrolls
  • shop_scrolls_output_window - The name of the window that you want shop scrolls to display in. Default: ShopScrolls
  • container - The list of containers you carry scrolls in. Entries should be separated with a | character. (E.g. scroll case|backpack) The default is set to what I use, so it will likely need to be changed to match your containers.
  • container_total - The number of containers you included in the above list.

Syntax

.scroll
  • Used without any arguments, the script will sort through the list of containers on your person that are set in the user variables section of the script.
.scroll shop
  • Used with the 'shop' argument, the script will search all shop surfaces for any scrolls.

Genie settings

There are no required settings, although I recommend using the following highlight to help make unidentified scrolls easier to notice. Several other highlights are automatically handled by the script without affecting your highlights file.

#highlight {regexp} {Red} {: (Unknown|Obsolete)}

Also, if you adjust the font, location, and size of the windows that the script creates then make sure to save your layout and profile so you don't have to do it again the next time you open Genie.

Notes

Because of the way the game engine does not allow index values over eleventh, the script is not currently capable of displaying more than eleven scrolls with the same base noun in the same container. The script will indicate this may be the case when it occurs.

Planned features

  • Adding price to the shop output.
  • Adding links to each scroll that would GET the specific scroll from your container or BUY it from the shop. (This is awaiting a solution to display issues with the way Genie handles the #link and #echo commands.)
  • Possibly implementing global variables to remember where each scroll is.
  • Add vault to personal list if inside your vault.

Changelog

None yet.

Script

### .scroll - Written by ABSOLON 3/1/2015
### Updates will be found at https://elanthipedia.play.net/mediawiki/index.php/Scroll_inventory_manager_(script)

### User Variables - Change these to suit your needs
	var personal_scrolls_output_window Scrolls
	var shop_scrolls_output_window ShopScrolls
	var container scroll case|thigh pouch|rucksack|book bag
	var container_total 4

echo ******************************
echo * Usage: .scroll
echo * -sorts through all your scrolls and outputs their contents and locations.
echo * -set which containers the script will search in the user variables section at the top of the script.
echo * 
echo * Usage: .scroll shop
echo * -sorts through all of a shop's scrolls and outputs their contents and locations.
echo *
echo * Note: All options are limited to the 11th index of a scroll in/on a given container due to the game engine. 
echo * This can be worked around to some degree for scrolls on your person using SORT <scroll> in <container> to reverse the order.
echo ******************************
if_1 then goto parse_input
goto start

parse_input:
	if %1 = "shop" then goto start
	pause
	echo
	echo ***********
	echo * Invalid option entered. Please try again.
	echo ***********
	exit

start:
### Script variables - Do not change these unless changing how the script works
	var shop 0
	if %1 = "shop" then var shop 1
	var index first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh
	var index_total 11
	var scroll_type scroll|roll|parchment|vellum|bark|ostracon|papyrus|leaf|tablet
	var scroll_type_total 9
	var surface_array altar|armoir|armoire|bale|bar|barn|barrel|basket|bedroll|bench|bin|block|blossom|boar|board|bookcase|bookshelf|bookshelves|bookstand|box|branch|breakfront|broomstick|bucket|buffet|bull|bureau|bust|butterflies|butterfly|cabinet|carpet|cart|carton|case|catalog|cauldron|chair|chest|closet|cloud|coffer|container|cord|cornucopia|corral|cot|counter|cradle|crate|cushion|desk|display|drawer|dresser|drum|dummies|dummy|easel|endtable|fence|firepit|footrest|fountain|framework|garderobe|goblin|gourd|grinder|hand|hanger|hatstand|head|highboy|hole|hook|hooks|horse|jar|keg|lattice|locker|mannequin|mantel|mantle|moon|net|niche|ogre|pail|pallet|panel|peccaries|peccary|pedestal|peg|pegboard|pew|pillow|pipe|pit|plank|planter|platter|plinth|podium|pole|post|pumpkin|quilt|rack|rope|rug|salver|sawhorse|shelf|shell|shelves|showcase|sidebar|sideboard|skeleton|skippet|spittoon|stable|stand|star|stool|stove|stump|sun|table|tomb|tray|tree|trestle|trough|trunk|turtle|urn|valet|vanities|vanity|vat|wall|wardrobe|waterwheel|web|webbing|workbench|worktable
	var container_counter 0
	if %shop then
		{
		var container placeholder
		var container_total 0
		var output_window %shop_scrolls_output_window
		}
	else 
		{
		var preposition in my
		var output_window %personal_scrolls_output_window
		}
	if %shop then
		{
		action (parse) goto no_shop when ^There is nothing to buy here
		action (parse) var raw_container $4 $5;eval container replacere(%container,%container,%container.%raw_container);math container_total add 1 when ( +)a(|n)(.*\b)(.+\b) (%surface_array)( |$)
		action (parse) on
		pause 0.1
		put shop
		pause
		action (parse) off
		if length(%container) >= 12 then eval container substr(%container,12)
		eval container replacere(%container,"\.","|")
		}
		
### Set-up
	send #window show %output_window
	send #clear %output_window
	if %shop then send #echo Yellow,DarkBlue >%output_window $roomname
### Actions
	action var spell_name $1 when ^It is labeled \"(.+)\.\"
	action var spell_name $1 Unknown when ^Illustrations of complex, three-dimensional shapes cover much of the
	action var spell_name $1 Obsolete when ^You see nothing unusual
	action var index_counter 0;math scroll_type_counter add 1;goto loop when ^I could not find what you were referring to.
	if %shop then
		{
		action instant var preposition in when ^In .+, you see:$
		action instant var preposition on when ^On .+, you see:$
		}
	action goto continue when ^It is labeled|^Illustrations|^You see nothing unusual
	action goto continue2 when ^I could not find
	
main:
	var index_counter 0
	var current_index
	var scroll_type_counter 0
	var current_scroll
	var sort_command
	eval current_container element("%container",%container_counter)
	if %current_container = "" then goto done
	if %shop then
		{
		send shop %current_container
		pause
		}
	send #echo Yellow >%output_window %preposition %current_container:	

loop:
	pause 0.1
	if %scroll_type_counter >= %scroll_type_total then goto next_container
	eval current_scroll_type element("%scroll_type", %scroll_type_counter)
	if %index_counter = 0 then 
		{
		##send #echo Green >%output_window %current_scroll_type:
		}
	eval current_index element("%index", %index_counter)
	put look %current_index %current_scroll_type %preposition %current_container
	pause 10
	send #echo >%output_window
	send #echo Red >%output_window *************
	send #echo Red >%output_window * Script timed out!
	send #echo Red >%output_window *************
	exit 
	
continue:
	if ((%index_counter = 0) && (%scroll_type_counter > 0)) then
		{
		send #echo >%output_window
		}
continue2:
	send #echo >%output_window %current_index %current_scroll_type: %spell_name 
	math index_counter add 1
	if %index_counter >= %index_total then
		{
		send #echo Red >%output_window There may be more of these.
		if !%shop then
			{
			eval sort_command toupper("sort %current_scroll_type in my %current_container")
			send #echo Red >%output_window To see the rest try using %sort_command and running the script again.
			}
		var index_counter 0
		math scroll_type_counter add 1
		}
	goto loop

next_container:
	math container_counter add 1
	send #echo >%output_window
	if %container_counter >= %container_total then goto done
	goto main

no_shop:
	pause 0.1
	echo *****************
	echo * You are not in a shop!
	echo *****************
	exit
	
done:
	send #echo Gray >%output_window Complete!
	exit