Gem Pouch Cleaner (script)

From Elanthipedia
Revision as of 17:59, 22 October 2015 by SHELTIM (talk | contribs) (Added "empty" case to EXIT so it properly closes the pouch)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Gem Pouch Cleaner (script)
Category utility
Front-end StormFront
Author Seped


Description

This script cleans out your gem pouch by selling any gems under a certain value. To use the script give it the name of the merchant, the value of the leading digit you want to sell things cheaper than, and then the number of trailing digits.

Too sell all gems under 500 copper to magpie

.gemsell magpie 5 2

1 plat

.gemsell magpie 1 4

So 1 = bronze, 2 = silver 3 = gold 4 = plat.

Script

#%1 gemseller %2 and %3 are the leading value and the trailing digits. .sell appraiser 5 2 sells anything under 500, 1 1 would be less than 10.


SETVARIABLE gem TSAVORITE
COUNTER SET 0

SETVARIABLE ordinal FIRST

PUT open pouch

GETGEM:
	MATCH NEXTGEMTYPE What were you
	MATCH HOLDINGGEM You get
	PUT get %ordinal %gem from pouch
	MATCHWAIT

HOLDINGGEM:		
	GOTO SELLGEM%2%

SELLGEM9:
	MATCHRE SELLGEM /("|\s)8\d{1,%3%}\s(Lirums|Kronars|Dokoras)/
SELLGEM8:
	MATCHRE SELLGEM /("|\s)7\d{1,%3%}\s(Lirums|Kronars|Dokoras)/
SELLGEM7:
	MATCHRE SELLGEM /("|\s)6\d{1,%3%}\s(Lirums|Kronars|Dokoras)/
SELLGEM6:
	MATCHRE SELLGEM /("|\s)5\d{1,%3%}\s(Lirums|Kronars|Dokoras)/
SELLGEM5:
	MATCHRE SELLGEM /("|\s)4\d{1,%3%}\s(Lirums|Kronars|Dokoras)/
SELLGEM4:
	MATCHRE SELLGEM /("|\s)3\d{1,%3%}\s(Lirums|Kronars|Dokoras)/
SELLGEM3:
	MATCHRE SELLGEM /("|\s)2\d{1,%3%}\s(Lirums|Kronars|Dokoras)/
SELLGEM2:
	MATCHRE SELLGEM /("|\s)1\d{1,%3%}\s(Lirums|Kronars|Dokoras)/
SELLGEM1:
	MATCHRE SELLGEM /("|\s)\d{1,%3%}\s(Lirums|Kronars|Dokoras)/
	MATCHRE KEEPGEM /("|\s)\d+/
	PUT ask %1 to appraise %gem
	MATCHWAIT


SELLGEM:
	PUT sell %gem to %1
	GOTO GETGEM:


KEEPGEM:
	COUNTER ADD 1
	PUT stow %gem
	GOTO NEXTORDINAL:


NEXTORDINAL:
	GOTO %ordinal

FIRST:
	SETVARIABLE ordinal SECOND
	GOTO GETGEM
SECOND:
	SETVARIABLE ordinal THIRD
	GOTO GETGEM
THIRD:
	SETVARIABLE ordinal FOURTH
	GOTO GETGEM
FOURTH:
	SETVARIABLE ordinal FIFTH
	GOTO GETGEM
FIFTH:
	SETVARIABLE ordinal SIXTH
	GOTO GETGEM
SIXTH:
	SETVARIABLE ordinal SEVENTH
	GOTO GETGEM
SEVENTH:
	SETVARIABLE ordinal EIGHTH
	GOTO GETGEM
EIGHTH:
	SETVARIABLE ordinal NINTH
	GOTO GETGEM
NINTH:
	GOTO EXIT


NEXTGEMTYPE:
	SETVARIABLE ordinal FIRST
	GOTO %gem

TSAVORITE:
	SETVARIABLE gem ZIRCON
	GOTO GETGEM
ZIRCON:
	SETVARIABLE gem QUARTZ
	GOTO GETGEM
QUARTZ:
	SETVARIABLE gem CHALC
	GOTO GETGEM
CHALC:
	SETVARIABLE gem CORAL
	GOTO GETGEM
CORAL:
	SETVARIABLE gem MOONSTONE
	GOTO GETGEM
MOONSTONE:
	SETVARIABLE gem ONYX
	GOTO GETGEM
ONYX:
	SETVARIABLE gem AMBER
	GOTO GETGEM
AMBER:
	SETVARIABLE gem PEARL
	GOTO GETGEM
PEARL:
	SETVARIABLE gem CHRYSO
	GOTO GETGEM
CHRYSO:
	SETVARIABLE gem LAZULI
	GOTO GETGEM
LAZULI:
	SETVARIABLE gem TURQUOISE
	GOTO GETGEM
TURQUOISE:
	SETVARIABLE gem BLOODSTONE
	GOTO GETGEM
BLOODSTONE:
	SETVARIABLE gem HEMATITE
	GOTO GETGEM
HEMATITE:
	SETVARIABLE gem MORGANITE
	GOTO GETGEM
MORGANITE:
	SETVARIABLE gem SAPPHIRE
	GOTO GETGEM
SAPPHIRE:
	SETVARIABLE gem AGATE
	GOTO GETGEM
AGATE:
	SETVARIABLE gem CARNELIAN
	GOTO GETGEM
CARNELIAN:
	SETVARIABLE gem RUNESTONE
	GOTO GETGEM
RUNESTONE:
	SETVARIABLE gem DIAMOND
	GOTO GETGEM
DIAMOND:
	SETVARIABLE gem TOPAZ
	GOTO GETGEM
TOPAZ:
	SETVARIABLE gem CRYSTAL
	GOTO GETGEM
CRYSTAL:
	SETVARIABLE gem EMERALD
	GOTO GETGEM
EMERALD:
	SETVARIABLE gem RUBY
	GOTO GETGEM
RUBY:
	SETVARIABLE gem TOURMALINE
	GOTO GETGEM
TOURMALINE:
	SETVARIABLE gem TANZANITE
	GOTO GETGEM
TANZANITE:
	SETVARIABLE gem JADE
	GOTO GETGEM
JADE:
	SETVARIABLE gem IVORY
	GOTO GETGEM
IVORY:
	SETVARIABLE gem SUNSTONE
	GOTO GETGEM
SUNSTONE:
	SETVARIABLE gem IOLITE
	GOTO GETGEM
IOLITE:
	SETVARIABLE gem BERYL
	GOTO GETGEM
BERYL:
	SETVARIABLE gem GARNET
	GOTO GETGEM
GARNET:
	SETVARIABLE gem ALEXANDRITE
	GOTO GETGEM
ALEXANDRITE:
	SETVARIABLE gem AMETHYST
	GOTO GETGEM
AMETHYST:
	SETVARIABLE gem CITRINE
	GOTO GETGEM
CITRINE:
	SETVARIABLE gem AQUAMARINE
	GOTO GETGEM
AQUAMARINE:
	SETVARIABLE gem ANDALUSITE
	GOTO GETGEM
ANDALUSITE:
	SETVARIABLE gem DIOPSIDE
	GOTO GETGEM
DIOPSIDE:
	SETVARIABLE gem SPINEL
	GOTO GETGEM
SPINEL:
	SETVARIABLE gem PERIDOT
	GOTO GETGEM
PERIDOT:
	SETVARIABLE gem KUNZITE
	GOTO GETGEM
KUNZITE:
	SETVARIABLE gem OPAL
	GOTO GETGEM
OPAL:
	SETVARIABLE gem STONES
	GOTO GETGEM
STONES:
	SETVARIABLE gem STAR-STONE
	GOTO GETGEM
STAR-STONE:




EXIT:
MATCH DONE empty
MATCHRE DONE /find %c% gem/
MATCHRE OOPS /find \d+ gem/
PUT count pouch
MATCHWAIT
OOPS:
ECHO *** Expected only %c% gems ***
ECHO *** Missing gems from the script, please update it and add the new gems to elanthipedia as well! ***
DONE:
PUT close pouch