Scroll inventory manager (script)

From Elanthipedia
Jump to navigation Jump to search
Scroll inventory manager (script)
Category information
Front-end Genie
Author ABSOLON


Description

Personal output
Shop output

This script will compile a list of scrolls, their locations, their index (i.e. first, second, etc.,) which spells they contain, and their cost if applicable. It can be used both for scrolls on your person as well as scrolls for sale in a shop. It will also include the main section of your vault if you are inside of it. 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, and scrolls which no longer function will be listed as "Obsolete."

Instructions

There are four user variables that need to be set manually within the script at the very top.

Variable Description Notes
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. I recommend using as few containers as possible, since each container takes roughly 10-15 seconds to search.
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. This should be a much rarer occurrence now that adjectives are additionally being used to distinguish between scrolls.

Planned features

  • Adding capability to specify a container(s) via arguments to allow searching specific containers without running the whole script or for containers you don't want to normally search every time.
  • 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.
  • Possibly updating vault capability to include vault surfaces. This could potentially cause the script to take a very long time to complete, so I am holding off on this for now until I can think of a good solution.
  • Possible streamlining of scroll adjective and nouns for rarer scroll types in order to lower the time it takes to complete the script.

Changelog

  • v1.1 - March 3, 2015
-Changed scroll noun to also include the adjective (e.g. fine scroll) in order to reduce the impact of having more than 11 of the same type of noun in the same container.
-Added price to shop window output.
-Added automatic inclusion of your vault to personal inventory output when standing in your vault.
-Only includes the main section of your vault, and not any surfaces within it.
-Several minor display and code streamlining changes.
  • v1.0 - March 1, 2015
-Script created and uploaded.

Script

### .scroll - Written by ABSOLON 3/1/2015
### v1.1 - 3/3/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 rucksack|book bag|scroll case|thigh pouch
	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
	var vault 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 fine scroll|grey scroll|illuminated scroll|lilac scroll|linen scroll|moldering scroll|off-white scroll|parchment scroll|plain scroll|tattered scroll|vellum scroll|white scroll|yellow scroll|papyrus roll|smudged parchment|faded vellum|hhr'lav'geluhh bark|ostracon|tattered papyrus|seishaka leaf|clay tablet|wax tablet
	var scroll_type_total 22
	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
	var sort_command
	if %shop then
		{
		var container placeholder
		var container_total 0
		var output_window %shop_scrolls_output_window
		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,"\.","|")
		}
	else 
		{
		var preposition in my
		var output_window %personal_scrolls_output_window
		if contains("$roomname","Carousel Chamber") then
			{
			var vault 1
			var current_container vault
			var preposition in
			send open vault
			}
		}
		
### Set-up
	send #window show %output_window
	send #clear %output_window
	if %shop then send #echo Yellow,DarkBlue >%output_window $roomname
### Actions
	action instant var spell_name $3 when ^(Read:  |)(Look:  |)It is labeled \"(.+)\.\"
	action instant var spell_name Unknown when ^(Read:  |)(Look:  |)Illustrations of complex, three-dimensional shapes cover much of the
	action instant var spell_name Obsolete when ^You see nothing unusual
	action instant var spell_cost $1 when ^Cost:  (\d+)

	action instant 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 instant goto continue when ^(Read:  |)(Look:  |)(It is labeled|Illustrations|You see nothing unusual)
	action instant goto continue2 when ^I could not find
	
main:
	var index_counter 0
	var current_index
	var scroll_type_counter 0
	var current_scroll
	var first_scroll 1
	if !%vault then eval current_container element("%container",%container_counter)
	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)
	eval current_index element("%index", %index_counter)
	if %shop then
		{
		put shop %current_index %current_scroll_type %preposition %current_container
		}
	else
		{
		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
		{
		if !%first_scroll then send #echo >%output_window
		}
continue2:
	if %shop then
		{
		if %spell_cost >= 10000 then
			{
			evalmath spell_cost %spell_cost/10000
			var spell_cost %spell_cost platinum
			}
		else
			{
			var spell_cost %spell_cost copper
			}
		send #echo >%output_window %current_index %current_scroll_type: %spell_name (%spell_cost)
		}
	else
		{
		send #echo >%output_window %current_index %current_scroll_type: %spell_name
		}
	var first_scroll 0
	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 %preposition %current_container")
			send #echo Red >%output_window To see the rest try using %sort_command and running the script again.
			}
		if %shop then
			{
			eval sort_command toupper("shop %current_container")
			send #echo Red >%output_window Use %sort_command to browse them manually.
			}
		var index_counter 0
		math scroll_type_counter add 1
		}
	goto loop

next_container:
	math container_counter add 1
	if %vault then
		{
		var vault 0
		var container_counter 0
		var preposition in my
		}
	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