Elanthipedia Shops (script)
Elanthipedia Shops (script) | |
---|---|
Category | information |
Front-end | Genie |
Author | Isharon |
This script creates Elanthipedia forms for shops (that use the SHOP verb). The results are logged to the Shop file in Genie's Logs folder.
This script is intended for experienced Elanthipedia contributors only. The forms that are created by this script require some manual editing. (See below for details.) Please check for errors before posting them to Elanthipedia.
Instructions
Syntax
.ESHOP (YES): Type yes if you want the script to create the Store At A Glance and ShopDescription sections. (Store At A Glance is used once per shop. ShopDescription is used once per room.
A menu will prompt you to select the type of item you're adding:
- Weapon
- Shield
- Armor/Barding
- Item: Other
Required Genie Settings
You must install and use this alias to set the shop surface variable.
#alias {aps} {appraise $0 $preposition $shop quick} #alias {sh} {shop $0 on $shop} #alias {sha} {shop $0 on $shop;appraise $0 on $shop careful} #alias {shs} {shop;shop $shop} #alias {sv} {#var shop $0}
The "shop surface" is the thing on which the item is placed (for example, table, second rack, or oak shelf). Every time you change shop surfaces (via the sv alias), you need to use the shs alias to set the preposition.
You must install these triggers to set the currency variable. (Appraise something once to set it.)
#trigger {^You .+ worth .+ dokoras} {#var currency Dokoras} #trigger {^You .+ worth .+ kronars} {#var currency Kronars} #trigger {^You .+ worth .+ lirums} {#var currency Lirums}
You must install these triggers to set the preposition variable. (Use the shs alias to set it every time you change shop surfaces.)
#trigger {^Behind .+, you see:$} {#var preposition behind} #trigger {^In .+, you see:$} {#var preposition in} #trigger {^On .+, you see:$} {#var preposition on} #trigger {^Under .+, you see:$} {#var preposition under}
Sample Usage (Walkthrough)
Running the Script
You want to add inventory for Misenseor Goods (4), so you go to a room in that shop. (For the purpose of this walkthrough, I will assume that nothing has been posted on this shop's page.)
> shop The following items contain goods for sale: an iron hook a birch pedestal a huge cedar rack an antique fretwork table [Type SHOP [ITEM] to see what's on it.]
The first surface with items to buy is the antique fretwork table, so you type sv fretwork table to set the shop surface variable. (You won't see anything when you do this.)
Then you type shs to set the preposition variable (so the script knows whether to look on, in, or under the table).
> shs On the fretwork table, you see: a mammoth Botolf war icon set atop a bloodstained haft of hickory for 902000 copper Dokoras a mammoth Be'ort war icon set atop a haft of weeping willow for 902000 copper Dokoras a mammoth Asketi war icon set atop a haft of blighted mikkhalbamar for 902000 copper Dokoras a mammoth Huldah war icon set atop a haft of silver-green mistwood for 902000 copper Dokoras a mammoth Dergati war icon set atop a haft of black walnut for 902000 copper Dokoras a mammoth Trothfang war icon set atop a haft of veiny copperwood for 902000 copper Dokoras a mammoth Harawep war icon set atop a haft of burrowed oak for 902000 copper Dokoras The inventory of an antique fretwork table rotates. [Type SHOP [GOOD] to see some details about it.]
To run the script, you type .eshop yes. (Typing "yes" causes the script to generate a "Store At A Glance" and a "ShopDescription." If you already had that, you'd just type .eshop.)
ITEM TYPE: 1: Weapon 2: Shield 3: Armor/Barding 4: Item: Other Enter Type Number:
The war icon is a weapon, so you enter 1.
The script then generates a ShopHeader section with item links and prices.
Once it's done, you move on to the huge cedar rack. (Type sv cedar rack and then shs.)
> shs On the cedar rack, you see: some silver-blue scythewing moth handwraps for 72160 copper Dokoras a holy water sprinkler studded with stony basilisk fangs for 99220 copper Dokoras a steel jambiya with a hilt wrapped in membranous kartais wing for 36080 copper Dokoras a serrated bone-white scythe hung with a pair of sluagh claws for 63140 copper Dokoras a twisted black horn for 8118 copper Dokoras a dark crimson sword etched with spidery lightning for 8118 copper Dokoras a golden-bladed scimitar with a hilt wrapped in metallic-red scaled leather for 13530 copper Dokoras an oaken impalement stake branded with viperous coils for 9020 copper Dokoras a granite mace sculpted like a gaunt greenish fist for 4510 copper Dokoras a morning star studded with Adan'f tail barbs for 10824 copper Dokoras a silver-bladed scimitar with a hilt wrapped in midnight-blue scaled leather for 13530 copper Dokoras [Type SHOP [GOOD] to see some details about it.]
Start by typing .eshop. (You don't type yes this time, because you already have the Store At A Glance and a ShopDescription.)
Repeat this process for every shop surface in the room. When you're done with the room, move on to the next room (if there is one) or open your Shop log (if that was the last room). Every time you move to a new room, include "yes" to generate the room's ShopDescription.
Editing the Shop Form
See Required Manual Editing (below) for details about how to edit shop forms.
When you're done with the fretwork table and the cedar rack, your Shop log should look like this:
{{Store At A Glance |Store Name =Misenseor Goods, Zealous Destruction |Province = |Town = |MapNumber = |Owner =n |NumRooms = |restrict = |levelres = |Store Type =[Guild],[Race],Alchemy,Armor,Barber,Boat,Cambrinth,Casino,Clothing,Container,Cosmetics,Crafting,Drink,Dye,Embroidery,Engraving,Estate Holder,Face Painting,Festival,Fishing Supply,Fletching,Florist,Food,Forging Supply,Furrier,Game,Gem,General,Heraldry,Herb,Hider,Horse,Housing,Jewelry,Juggling,Locksmithing,Magic,MAMAS,Map,Miscellaneous,Music,Origami,Pawn,Perfume,Pet,Rare Materials,Repair,Shield,Spellbook,Tack,Tanning,Tattoo,Tobacco,Toy,Trinket,Vault Furniture,Weapon,Wedding |Fest = |Coin =Dokoras }} {{ShopDescription |roomname=Misenseor Goods, Zealous Destruction |desc=The pinewood walls enclosing this side of the shop are equipped with implements of battle for the use of warrior monks. Large twin bowls, filled with red liquid, flank a stylized thirteen-pointed star burnt into the wall between the room's two egresses.<br /> You also see an iron hook with a strap of braided mey mosshair on it, a birch pedestal with several things on it, a huge cedar rack with several things on it and an antique fretwork table with several things on it.<br /> Obvious exits: southwest, northwest. }} {{ShopHeader|title=On the fretwork table}} {{ShopItem|t= w | mammoth Kerenhappuch war icon set atop a red-gold haft of rosewood | 902000 }} {{ShopItem|t= w | mammoth Zachriedek war icon set atop a haft of sickly aspen | 902000 }} {{ShopItem|t= w | mammoth Botolf war icon set atop a bloodstained haft of hickory | 902000 }} {{ShopItem|t= w | mammoth Be'ort war icon set atop a haft of weeping willow | 902000 }} {{ShopItem|t= w | mammoth Asketi war icon set atop a haft of blighted mikkhalbamar | 902000 }} {{ShopItem|t= w | mammoth Huldah war icon set atop a haft of silver-green mistwood | 902000 }} {{ShopItem|t= w | mammoth Trothfang war icon set atop a haft of veiny copperwood | 902000 }} |} {{ShopHeader|title=On the cedar rack}} {{ShopItem|t= w | silver-blue scythewing moth handwraps | 72160 }} {{ShopItem|t= w | holy water sprinkler studded with stony basilisk fangs | 99220 }} {{ShopItem|t= w | steel jambiya with a hilt wrapped in membranous kartais wing | 36080 }} {{ShopItem|t= w | serrated bone-white scythe hung with a pair of sluagh claws | 63140 }} {{ShopItem|t= w | twisted black horn | 8118 }} {{ShopItem|t= w | dark crimson sword etched with spidery lightning | 8118 }} {{ShopItem|t= w | golden-bladed scimitar with a hilt wrapped in metallic-red scaled leather | 13530 }} {{ShopItem|t= w | oaken impalement stake branded with viperous coils | 9020 }} {{ShopItem|t= w | granite mace sculpted like a gaunt greenish fist | 4510 }} {{ShopItem|t= w | morning star studded with Adan'f tail barbs | 10824 }} {{ShopItem|t= w | silver-bladed scimitar with a hilt wrapped in midnight-blue scaled leather | 13530 }} |}
- Most of the Store At A Glance table can't be filled out by the script, so the form leaves space for you to fill it out. Make sure the Store Name is the official name of the store. (The store name usually stops at the comma.)
- This is a festival shop, so Province, Town, and MapNumber are excluded. (Map numbers are Ranik map numbers from Elanthipedia.)
- If this shop has an obvious owner, fill out that person's first name. If not, leave it as n (for none).
- Fill out NumRooms.
- If there are no restrictions or circle requirements, you can delete those lines.
- Store Types: Delete whatever types don't apply. If this shop has items that are for a particular guild or race, fill those out.
- Fest: This is Hollow Eve Festival 410.
{{Store At A Glance |Store Name =Misenseor Goods |Owner =n |NumRooms =5 |Store Type =Cleric,Paladin,Clothing,Container,Jewelry,Magic,Weapon |Fest =Hollow Eve Festival 410 |Coin =Dokoras }}
If the prices were written in something other than coppers, there will be underscores. Delete the underscores.
Add commas to prices that are 1,000 or greater. I left tabs between each field of the inventory table. This allows you to copy and paste the ShopItem lines into Excel to automatically add commas to the prices that are 1,000 or greater. If you would prefer to manually add the commas, I've included a version without tabs.
Delete the tabs.
{{ShopHeader|title=On the fretwork table}} {{ShopItem|t=w|mammoth Kerenhappuch war icon set atop a red-gold haft of rosewood|902,000}} {{ShopItem|t=w|mammoth Zachriedek war icon set atop a haft of sickly aspen|902,000}} {{ShopItem|t=w|mammoth Botolf war icon set atop a bloodstained haft of hickory|902,000}} {{ShopItem|t=w|mammoth Be'ort war icon set atop a haft of weeping willow|902,000}} {{ShopItem|t=w|mammoth Asketi war icon set atop a haft of blighted mikkhalbamar|902,000}} {{ShopItem|t=w|mammoth Huldah war icon set atop a haft of silver-green mistwood|902,000}} {{ShopItem|t=w|mammoth Trothfang war icon set atop a haft of veiny copperwood|902,000}} |} {{ShopHeader|title=On the cedar rack}} {{ShopItem|t=w|silver-blue scythewing moth handwraps|72,160}} {{ShopItem|t=w|holy water sprinkler studded with stony basilisk fangs|99,220}} {{ShopItem|t=w|steel jambiya with a hilt wrapped in membranous kartais wing|36,080}} {{ShopItem|t=w|serrated bone-white scythe hung with a pair of sluagh claws|63,140}} {{ShopItem|t=w|twisted black horn|8,118}} {{ShopItem|t=w|dark crimson sword etched with spidery lightning|8,118}} {{ShopItem|t=w|golden-bladed scimitar with a hilt wrapped in metallic-red scaled leather|13,530}} {{ShopItem|t=w|oaken impalement stake branded with viperous coils|9,020}} {{ShopItem|t=w|granite mace sculpted like a gaunt greenish fist|4,510}} {{ShopItem|t=w|morning star studded with Adan'f tail barbs|10,824}} {{ShopItem|t=w|silver-bladed scimitar with a hilt wrapped in midnight-blue scaled leather|13,530}} |}
Required Manual Editing
Store At A Glance and ShopDescription
The script will add "Store At A Glance" and "ShopDescription" every time you run it. Delete all but the first ones.
- Store At A Glance" Most of this needs to be filled out manually. See Template:Store At A Glance for help.
- Store Name: You'll probably need to edit this, as most room names have extra text. For example, if the room is "Gersvinda's Natural Studies, Studio," it should be changed to just "Gersvinda's Natural Studies."
ShopDescription
If there is not a "You also see" line in the room, the script will print a line that is only one line break (<br>). Delete that.
Item Types
If your table contains more than one type of item, you need to manually change some of the item types in the t= field. The options are:
- Weapon: w
- Shield: s
- Armor: a
- Clothing: c
- Jewelry: j
- Housing: h
- Food/Drink: f
- Items (all other): i
Prices
If the prices were written in something other than coppers, there will be underscores. Delete the underscores.
Add commas to prices that are 1,000 or greater. I left tabs between each field of the inventory table. This allows you to copy and paste the ShopItem lines into Excel to automatically add commas to the prices that are 1,000 or greater. If you would prefer to manually add the commas, I've included a version without tabs.
Delete the tabs.
Ticket Prices
If the price is in tickets, you need to add the word "Tickets" after the price. For example:
{{ShopItem|t=w|throwing dagger with a buzzard hilt|2 Tickets}}
Changelog
2/26/2016
- Added support for bloodscrip|kernels?
5/23/2015
- Removed menu support for unused item type flags
11/4/2013
- Brand new version that greatly reduces the amount of time it takes to log inventory. Please read the documentation before posting these forms to Elanthipedia.
- Added "rotating stock" footnote
9/25/2013
- Added racial item class to combat/rp class toggles.
11/10/2012
- Shortened pauses by half a second.
11/4/2012
- Added "Hider" as a shop type.
5/16/2012
- Fixed bug that prevented taps from being set on items "atop several" surfaces.
4/28/2012
- Added support for items on "two" surfaces. (This was preventing certain taps from being read.)
11/14/2011
- Added support for items on the surface. (This was preventing certain taps from being read.)
11/9/2011
- Added support for items that are behind a shop surface.
11/4/2011
- Added more shop type options to the list; fixed "Store At A Glance" section so that it's not specific to Hollow Eve Festival 403.
- Added partial support for ticket prices.
11/2/2011
- Added barding (horse armor) to the menu.
05/23/2011
- The script now uses triggers to set the currency and preposition variables.
05/13/2011
- The script now adds the room objects and room exits to the ShopDescription.
- Fixed a bug that caused the script to list the last item twice.
- The "Store At A Glance" and "ShopDescription" sections are now optional.
05/14/2011
- Added store types to "Store At A Glance." (Erase the ones that don't apply to the shop that you're editing.)
Script (With Tabs for Excel)
put #class rp on put #class arrive off put #class combat off put #class joust off put #class racial off put #class shop off var source $roomname action goto end when ^I could not find what (you|you were) referring to\.$ var numbers first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh var numbers.index 0 action setvariable shopheader $1 when ^(.+), you see:$ action setvariable tap $2 when ^You tap (a|an|some|the) (.+) (atop|behind|inside|under) (an?|several|\bsome\b|\bthe\b|\btwo\b) action setvariable short $2 when ^Short: (a|an|some|the) (.+) action setvariable costi $1 when ^Cost:\s+(\d+) (Kronars?|Lirums?|Dokoras?|[Tt]ickets?|bloodscrip|kernels?|[Ff]ame) send shop $shop waitforre ^(Behind|In|On|Under).+, you see:$ if_1 goto ShopDesc goto StartShop ShopDesc: put #log >Shop.txt {{Store At A Glance put #log >Shop.txt |Store Name =$roomname put #log >Shop.txt |Province = put #log >Shop.txt |Town =$zonename put #log >Shop.txt |MapNumber =$zoneid put #log >Shop.txt |Owner =- put #log >Shop.txt |NumRooms = put #log >Shop.txt |restrict = put #log >Shop.txt |levelres = put #log >Shop.txt |Store Type =[Guild], [Race], Alchemy, Alteration, Armor, Barber, Boat, Book, Cambrinth, Casino, Clothing, Container, Cosmetics, Crafting, Drink, Dye, Embroidery, Engineering, Engraving, Estate Holder, Face paint, Festival, Fletching, Florist, Food, Forging, Furrier, Games, Gem, General, Heraldry, Herb, Hider, Horse, Housing, Jewelry, Juggling, Light, Locksmithing, Magic, MAMAS, Map, Miscellaneous, Music, Origami, Outfitting, Pawn, Perfume, Pet, Rare Materials, Repair, Shield, Siegery, Smoking, Spellbook, Tack, Tanning, Tattoo, Tobacco, Toy, Trinket, Vault Furniture, Weapon, Wedding, Writing put #log >Shop.txt |Fest = put #log >Shop.txt |Coin =$currency put #log >Shop.txt }} put #log >Shop.txt put #log >Shop.txt {{ShopDescription put #log >Shop.txt |roomname=$roomname put #log >Shop.txt |desc=$roomdesc<br /> put #log >Shop.txt $roomobjs<br /> put #log >Shop.txt $roomexits put #log >Shop.txt }} put #log >Shop.txt StartShop: put #log >Shop.txt "{{ShopHeader|title=%shopheader}}" put #echo put #echo ITEM TYPE: put #echo put #echo 1: Weapon put #echo put #echo 2: Shield put #echo put #echo 3: Armor/Barding put #echo put #echo 4: Item: Other put #echo put #echo Enter Type Number: matchre Weapon ^1$ matchre Shield ^2$ matchre Armor ^3$ matchre Item ^4$ matchwait Weapon: var type w goto Shop1 Shield: var type s goto Shop1 Armor: var type a goto Shop1 Item: var type i goto Shop1 Shop1: action setvariable tap $2;setvariable price $3 when ^\s+(an?|some|the) (.+) for (\d+) ([Tt]ickets?|bloodscrip|kernels?|[Ff]ame)$ action setvariable tap $2;setvariable price $3 when ^\s+(an?|some|the) (.+) for (\d+) copper (Kronars?|Dokoras?|Lirums?|[Tt]ickets?|bloodscrip|kernels?|[Ff]ame)$ action setvariable tap $2;setvariable price $3_0 when ^\s+(an?|some|the) (.+) for (\d+) bronze (Kronars?|Dokoras?|Lirums?|[Tt]ickets?|bloodscrip|kernels?|[Ff]ame)$ action setvariable tap $2;setvariable price $3 when ^\s+(an?|some|the) (.+) for (\d+\.\d+) bronze (Kronars?|Dokoras?|Lirums?|[Tt]ickets?|bloodscrip|kernels?|[Ff]ame)$ action setvariable tap $2;setvariable price $3_00 when ^\s+(an?|some|the) (.+) for (\d+) silver (Kronars?|Dokoras?|Lirums?|[Tt]ickets?|bloodscrip|kernels?|[Ff]ame)$ action setvariable tap $2;setvariable price $3_0 when ^\s+(an?|some|the) (.+) for (\d+\.\d+) silver (Kronars?|Dokoras?|Lirums?|[Tt]ickets?|bloodscrip|kernels?|[Ff]ame)$ action setvariable tap $2;setvariable price $3_000 when ^\s+(an?|some|the) (.+) for (\d+) gold (Kronars?|Dokoras?|Lirums?|[Tt]ickets?|bloodscrip|kernels?|[Ff]ame)$ action setvariable tap $2;setvariable price $3_00 when ^\s+(an?|some|the) (.+) for (\d+\.\d+) gold (Kronars?|Dokoras?|Lirums?|[Tt]ickets?|bloodscrip|kernels?|[Ff]ame)$ action setvariable tap $2;setvariable price $3_0000 when ^\s+(an?|some|the) (.+) for (\d+) platinum (Kronars?|Dokoras?|Lirums?|[Tt]ickets?|bloodscrip|kernels?|[Ff]ame)$ action setvariable tap $2;setvariable price $3_000 when ^\s+(an?|some|the) (.+) for (\d+\.\d+) platinum (Kronars?|Dokoras?|Lirums?|[Tt]ickets?|bloodscrip|kernels?|[Ff]ame)$ action put #log >Shop.txt "{{ShopItem|t= %type | %tap | %price }}" when for (\S+) (copper|bronze|silver|gold|platinum) (Kronars?|Dokoras?|Lirums?)$ action put #log >Shop.txt "{{ShopItem|t= %type | %tap | %price }}" when for (\S+) ([Tt]ickets?|bloodscrip|kernels?|[Ff]ame) action put #log >Shop.txt "{{ShopFootnote|rotating stock}}" when ^The inventory of.+rotates\.$ send shop $shop waitfor [Type SHOP [GOOD] to see some details about it.] pause 1 goto end end: put #log >Shop.txt |} send shop put #class racial on exit
Script (Without Tabs)
put #class rp on put #class arrive off put #class combat off put #class joust off put #class racial off put #class shop off var source $roomname action goto end when ^I could not find what (you|you were) referring to\.$ var numbers first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|eleventh var numbers.index 0 action setvariable shopheader $1 when ^(.+), you see:$ action setvariable tap $2 when ^You tap (a|an|some|the) (.+) (atop|behind|inside|under) (an?|several|\bsome\b|\bthe\b|\btwo\b) action setvariable short $2 when ^Short: (a|an|some|the) (.+) action setvariable costi $1 when ^Cost:\s+(\d+) (Kronars?|Lirums?|Dokoras?|Tickets?|bloodscrip|kernels?) send shop $shop waitforre ^(Behind|In|On|Under).+, you see:$ if_2 goto ShopDesc goto StartShop ShopDesc: put #log >Shop.txt {{Store At A Glance put #log >Shop.txt |Store Name =$roomname put #log >Shop.txt |Province = put #log >Shop.txt |Town =$zonename put #log >Shop.txt |MapNumber =$zoneid put #log >Shop.txt |Owner =- put #log >Shop.txt |NumRooms = put #log >Shop.txt |restrict = put #log >Shop.txt |levelres = put #log >Shop.txt |Store Type =[Guild], [Race], Alchemy, Alteration, Armor, Barber, Boat, Book, Cambrinth, Casino, Clothing, Container, Cosmetics, Crafting, Drink, Dye, Embroidery, Engineering, Engraving, Estate Holder, Face paint, Festival, Fletching, Florist, Food, Forging, Furrier, Games, Gem, General, Heraldry, Herb, Hider, Horse, Housing, Jewelry, Juggling, Light, Locksmithing, Magic, MAMAS, Map, Miscellaneous, Music, Origami, Outfitting, Pawn, Perfume, Pet, Rare Materials, Repair, Shield, Siegery, Smoking, Spellbook, Tack, Tanning, Tattoo, Tobacco, Toy, Trinket, Vault Furniture, Weapon, Wedding, Writing put #log >Shop.txt |Fest = put #log >Shop.txt |Coin =$currency put #log >Shop.txt }} put #log >Shop.txt put #log >Shop.txt {{ShopDescription put #log >Shop.txt |roomname=$roomname put #log >Shop.txt |desc=$roomdesc<br /> put #log >Shop.txt $roomobjs<br /> put #log >Shop.txt $roomexits put #log >Shop.txt }} put #log >Shop.txt StartShop: put #log >Shop.txt "{{ShopHeader|title=%shopheader}}" put #echo put #echo ITEM TYPE: put #echo put #echo 1: Weapon put #echo put #echo 2: Shield put #echo put #echo 3: Armor/Barding put #echo put #echo 4: Item: Other put #echo put #echo Enter Type Number: matchre Weapon ^1$ matchre Shield ^2$ matchre Armor ^3$ matchre Item ^4$ matchwait Weapon: var type w goto Shop1 Shield: var type s goto Shop1 Armor: var type a goto Shop1 Item: var type i goto Shop1 Shop1: var number %numbers(%numbers.index) gosub Shop2 math numbers.index add 1 if %numbers.index > 11 then goto end goto Shop1 number1: var number first return number2: var number second return number3: var number third return number4: var number fourth return number5: var number fifth return number6: var number sixth return number7: var number seventh return number8: var number eighth return number9: var number ninth return number10: var number tenth return number11: var number eleventh return Shop2: send tap %number %1 $preposition $shop waitforre ^You send shop %number %1 $preposition $shop waitforre ^Short pause .5 gosub CommaCost put #log >Shop.txt "{{ShopItem|t=%type|%tap|%cost}}" put #log >Shop.txt return CommaCost: var commanumber %costi eval length len(%commanumber) var cost %commanumber if %length < 4 then goto return evalmath length %length - 3 eval temp substr(%commanumber, %length, 3) var cost %temp topcost: if %length < 3 then goto lastcost evalmath length %length - 3 eval temp substr(%commanumber, %length, 3) var cost %temp,%cost goto topcost lastcost: if %length > 0 then { eval temp substr(%commanumber, 0, %length) var cost %temp,%cost } goto return return: return end: put #log >Shop.txt |} send shop waitforre ^\[Type SHOP \[ITEM\] to see what's on it|^There is nothing to buy here send shop $shop waitforre ^\[Type SHOP \[GOOD\] to see some details about it|^There is nothing to buy here put #echo Last noun: %1 ($preposition $shop) put #class racial on exit