Elanthipedia Shops (script): Difference between revisions
No edit summary |
(→Script) |
||
Line 325: | Line 325: | ||
put #log >Shop.txt |restrict = |
put #log >Shop.txt |restrict = |
||
put #log >Shop.txt |levelres = |
put #log >Shop.txt |levelres = |
||
put #log >Shop.txt |Store Type =[Guild],[Race],Alchemy,Armor,Barber,Casino,Clothing,Container,Cosmetics,Drink,Dye,Embroidery,Engraving,Face Painting,Fishing Supply,Fletching,Florist,Food,Forging Supply,Gem,General,Heraldry,Herb,Horse,Housing,Jewelry,Locksmithing,Magic,MAMAS,Map,Miscellaneous,Music,Origami,Perfume,Pet,Repair,Shield,Tack,Tanning,Tattoo,Tobacco,Toy,Trinket,Weapon,Wedding |
put #log >Shop.txt |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,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 |
||
put #log >Shop.txt |Fest = |
put #log >Shop.txt |Fest = |
||
put #log >Shop.txt |Coin =$currency |
put #log >Shop.txt |Coin =$currency |
Revision as of 16:16, 7 October 2012
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 [ITEM NOUN] (YES): Type yes if you want the script to create the Store At A Glance and ShopDescription sections. Otherwise, just type the item noun. (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: Clothing
- Item: Jewelry
- Item: Housing
- Item: Food/Drink
- 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 {es} {.eshop $0} #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 antique fretwork table a huge cedar rack a birch pedestal an iron hook
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 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 Idon war icon set atop a sculpted haft of satinwood for 902000 copper Dokoras a mammoth Kerenhappuch war icon set atop a red-gold haft of rosewood 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 Drogor war icon set atop a sea-worn haft of teak for 902000 copper Dokoras
To run the script, you type .eshop icon 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 icon.)
ITEM TYPE: 1: Weapon 2: Shield 3: Armor/Barding 4: Item: Clothing 5: Item: Jewelry 6: Item: Housing 7: Item: Food/Drink 8: Item: Other Enter Type Number:
The war icon is a weapon, so you enter 1.
The script "shops" each of the war icons and 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: a silver-bladed scimitar with a hilt wrapped in midnight-blue scaled leather for 13530 copper Dokoras a morning star studded with Adan'f tail barbs for 10824 copper Dokoras a granite mace sculpted like a gaunt greenish fist for 4510 copper Dokoras an oaken impalement stake branded with viperous coils for 9020 copper Dokoras a golden-bladed scimitar with a hilt wrapped in metallic-red scaled leather for 13530 copper Dokoras a dark crimson sword etched with spidery lightning for 8118 copper Dokoras a twisted black horn for 8118 copper Dokoras a serrated bone-white scythe hung with a pair of sluagh claws for 63140 copper Dokoras a steel jambiya with a hilt wrapped in membranous kartais wing for 36080 copper Dokoras a holy water sprinkler studded with stony basilisk fangs for 99220 copper Dokoras some silver-blue scythewing moth handwraps for 72160 copper Dokoras
The scimitar is the first item listed, so start with that by typing .eshop scimitar. (You don't type yes this time, because you already have the Store At A Glance and a ShopDescription.)
Wait for the script to finish, and then type .eshop star. Keep doing this until you have done all of the items on the cedar rack.
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,Casino,Clothing,Container,Cosmetics,Drink,Dye,Embroidery,Engraving,Face Painting,Fishing Supply,Fletching,Florist,Food,Forging Supply,Gem,General,Heraldry,Herb,Horse,Housing,Jewelry,Locksmithing,Magic,MAMAS,Map,Miscellaneous,Music,Origami,Perfume,Pet,Repair,Shield,Tack,Tanning,Tattoo,Tobacco,Toy,Trinket,Weapon,Wedding |Fest = |Coin =Dokoras }} {{ShopDescription |roomname=Misenseor Goods, Zealous Destruction |desc=The pinewood walls enclosing this side of the wagon 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 antique fretwork table with several things on it, a huge cedar rack with several things on it, a birch pedestal with several things on it and an iron hook with a strap of braided mey mosshair on it.<br> Obvious exits: southwest, northwest. }} {{ShopHeader|title=On the fretwork table}} {{ShopItem|t=w|mammoth Dergati war icon set atop a haft of black walnut|902,000}} {{ShopItem|t=w|mammoth Trothfang war icon set atop a haft of veiny copperwood|902,000}} {{ShopItem|t=w|mammoth Idon war icon set atop a sculpted haft of satinwood|902,000}} {{ShopItem|t=w|mammoth Kerenhappuch war icon set atop a red-gold haft of rosewood|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 Drogor war icon set atop a sea-worn haft of teak|902,000}} |} {{ShopHeader|title=On the cedar rack}} {{ShopItem|t=w|silver-bladed scimitar with a hilt wrapped in midnight-blue scaled leather|13,530}} {{ShopItem|t=w|golden-bladed scimitar with a hilt wrapped in metallic-red scaled leather|13,530}} |} {{ShopHeader|title=On the cedar rack}} {{ShopItem|t=w|morning star studded with Adan'f tail barbs|10,824}} |} {{ShopHeader|title=On the cedar rack}} {{ShopItem|t=w|granite mace sculpted like a gaunt greenish fist|4,510}} |} {{ShopHeader|title=On the cedar rack}} {{ShopItem|t=w|oaken impalement stake branded with viperous coils|9,020}} |} {{ShopHeader|title=On the cedar rack}} {{ShopItem|t=w|dark crimson sword etched with spidery lightning|8,118}} |} {{ShopHeader|title=On the cedar rack}} {{ShopItem|t=w|twisted black horn|8,118}} |} {{ShopHeader|title=On the cedar rack}} {{ShopItem|t=w|serrated bone-white scythe hung with a pair of sluagh claws|63,140}} |} {{ShopHeader|title=On the cedar rack}} {{ShopItem|t=w|steel jambiya with a hilt wrapped in membranous kartais wing|36,080}} |} {{ShopHeader|title=On the cedar rack}} {{ShopItem|t=w|holy water sprinkler studded with stony basilisk fangs|99,220}} |} {{ShopHeader|title=On the cedar rack}} {{ShopItem|t=w|silver-blue scythewing moth handwraps|72,160}} |}
- 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 403.
{{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 403 |Coin =Dokoras }}
If you have more than one Store At A Glance table, delete the others. (You'll have more than one Store At A Glance table if the shop has more than one room.) ShopDescription should not need editing.
If you had to run the script more than once per surface, as you did with the cedar rack, you'll need to merge those ShopHeader tables into one table.
{{ShopHeader|title=On the cedar rack}} {{ShopItem|t=w|silver-bladed scimitar with a hilt wrapped in midnight-blue scaled leather|13,530}} {{ShopItem|t=w|golden-bladed scimitar with a hilt wrapped in metallic-red scaled leather|13,530}} {{ShopItem|t=w|morning star studded with Adan'f tail barbs|10,824}} {{ShopItem|t=w|granite mace sculpted like a gaunt greenish fist|4,510}} {{ShopItem|t=w|oaken impalement stake branded with viperous coils|9,020}} {{ShopItem|t=w|dark crimson sword etched with spidery lightning|8,118}} {{ShopItem|t=w|twisted black horn|8,118}} {{ShopItem|t=w|serrated bone-white scythe hung with a pair of sluagh claws|63,140}} {{ShopItem|t=w|steel jambiya with a hilt wrapped in membranous kartais wing|36,080}} {{ShopItem|t=w|holy water sprinkler studded with stony basilisk fangs|99,220}} {{ShopItem|t=w|silver-blue scythewing moth handwraps|72,160}} |}
The last step is to make sure those items are listed in the right order. (They might be out of order if you had more than one item of the same type.) In this case, only the golden-bladed scimitar with a hilt wrapped in metallic-red scaled leather is out of place.
{{ShopHeader|title=On the cedar rack}} {{ShopItem|t=w|silver-bladed scimitar with a hilt wrapped in midnight-blue scaled leather|13,530}} {{ShopItem|t=w|morning star studded with Adan'f tail barbs|10,824}} {{ShopItem|t=w|granite mace sculpted like a gaunt greenish fist|4,510}} {{ShopItem|t=w|oaken impalement stake branded with viperous coils|9,020}} {{ShopItem|t=w|golden-bladed scimitar with a hilt wrapped in metallic-red scaled leather|13,530}} {{ShopItem|t=w|dark crimson sword etched with spidery lightning|8,118}} {{ShopItem|t=w|twisted black horn|8,118}} {{ShopItem|t=w|serrated bone-white scythe hung with a pair of sluagh claws|63,140}} {{ShopItem|t=w|steel jambiya with a hilt wrapped in membranous kartais wing|36,080}} {{ShopItem|t=w|holy water sprinkler studded with stony basilisk fangs|99,220}} {{ShopItem|t=w|silver-blue scythewing moth handwraps|72,160}} |}
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.
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
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
put #class rp on put #class combat off put #class arrive 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) 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 = put #log >Shop.txt |MapNumber = 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,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,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 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}}" echo echo ITEM TYPE: echo echo 1: Weapon echo echo 2: Shield echo echo 3: Armor/Barding echo echo 4: Item: Clothing echo echo 5: Item: Jewelry echo echo 6: Item: Housing echo echo 7: Item: Food/Drink echo echo 8: Item: Other echo echo Enter Type Number: matchre Weapon ^1 matchre Shield ^2 matchre Armor ^3 matchre Clothing ^4 matchre Jewelry ^5 matchre Housing ^6 matchre Food ^7 matchre Item ^8 matchwait Weapon: var type w goto Shop1 Shield: var type s goto Shop1 Armor: var type a goto Shop1 Clothing: var type c goto Shop1 Jewelry: var type j goto Shop1 Housing: var type h goto Shop1 Food: var type f 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 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 waitfor [Type SHOP [ITEM] to see what's on it.] send shop $shop waitfor [Type SHOP [GOOD] to see some details about it.] echo Last noun: %1 ($preposition $shop) exit