DIY

A Guide for Shop Owners

web-ified and updated by Sined - accuracy not guaranteed


Foreward

Hi. This is an attempt to provide new shop owners with a more up to date manual on operating a player shop. I've tried to include warnings about commands and items that have problems, and where possible suggest other ways of doing things. If you spot something that doesn't work, please email or mudmail me.

Sined


Discworld shop help - Shop owner - Page 1

Congratulations on your new shop!

This guide will explain many features of your new shop and how to setup different sorts of controls. The book is designed to be a step-by-step guide, not a reference. That means that one section builds on the next and should be studied that way.

A player run shop is a shop in which you control the price things are sold for, and who can use your shop. You also control how many items can be listed by each player, how much markup you put on items and just about any other shop related feature you can think of.

Players do not have control of the price that you sell their items; they are paid for the item at the price they specify when the shop buys it, and then the shop controls the amount it is sold for. The controls in the shop for changing an item on sale only work for the shop owner and their employees, not for the previous owner of the item.

Definitions

Owner
The person who owns the shop, this is the only person who can add people to the allow list.
Manager
Anyone on the allow list for the room. Managers are almost as powerful as the owner, and can use all commands except the room allow commands in the same way as the owner.
Helper
A helper added by The Owner or a Manager. Helpers can approve / reject goods offered for sale.

Contents

  1. Contents and Introduction
  2. Summary of commands
  3. Money handling
  4. Status and Statistics
  5. Equipping the Shop - Meet the Spulluf
  6. Working with the shop's stock
  7. Working with the waiting list: Simple controls
  8. Changing the status of things: Shop name and signs
  9. Changing the status of things: Hiring players to work for you
  10. Changing the status of things: Disallowing people from using the shop
  11. Changing the status of things: Setting up general criteria
  12. Changing the status of things: Setting up people for automatic acceptance
  13. Changing the status of things: Setting up items for automatic acceptance
  14. Working with expressions: Introduction
  15. Expressions: Setting up people for automatic acceptance
  16. Expressions: Setting up items for automatic acceptance
  17. List and examples of controls used in expressions
  18. User defined expressions
  19. Function & Variable Reference (extra)

Also available:

Sined's Shop Expressions used in Fruitcakes

Guide for shop helpers

Quick start

You've probably already asked your best friend to come sell something at your brand new shop and it's not working! Why not!?

A brand new shop is geared to deny everybody except those you specifically add, and a pre-owned shop may have settings left behind from a previous owner. An easy way to reset that is:

set use expression true

In addition, some types of shop furniture may have use conditions set. These can be seen with "status room" and the conditions set to "allow anyone" with commands such as:

set use expression for buy true (shop counters)
set use expression for use true (shop counters)
set use expression for pickler true (picklers)
set use expression for poker true (poker tables)
set use expression for bank true (bank counters)
set use expression for deposit true (bank counters)
set use expression for withdraw true (bank counters)

Status room should show you the current use conditions for the room itself, as well as any furniture in the room which has specific settable conditions.

You might wish to implement more advanced filters:

set use expression for buy as not (guild = "dishonoured")
set use expression for use as ((guild = "assassins") or (guild = "priests") or (guild = "thieves") or (guild = "warriors") or (guild = "witches") or (guild = "wizards"))

You can also set conditions on other shop equipment:


Discworld shop help - Shop owner - Page 2

Summary of the commands

Here is a quick list of all the commands available in the shop. A more detailed explanation of all these commands will follow in later sections.

Working with the shop itself:

Working with money:

Looking at statistics & logs:

Working with status:

Working with functions:

Working with Shop Counters

Working with Bank Master Counters

Working with Bank Franchise Counters

Working with Money Changers

Working with Poker Tables


Discworld shop help - Shop owner - Page 3

Money Handling

The very important bit of the shop, how do you get paid? Well, it's easy! You come into the shop and use the command 'royalties' to check your royalty pool. You can also 'collect royalties' or 'collect royalties of <amount>' to collect your royalties or parts of it. The same goes for people who are selling items in your shop. Once an item is approved into the stock of the shop, the money goes into their royalty pool.

If your royalties go below zero you need to use 'pay deficit' to pay off your deficit before you can do any other manipulations on the shop.

You can set the percentage that is added onto any item the player sells to the shop (your profit) using the 'markup <percentage>' command. There is also a way that you can override this default percentage for items that are auto accepted if you want to do that. See page 13 and 16 for details. You can also change individual prices once items have been accepted. See page 6 for details.

You can tell what your current markup percentage (and all kinds of other stuff) is from using the command 'status' or 'status hints'.

Examples:

> collect royalties of $1
You collect A$1 in royalties.

> collect royalties
You collect A$200 in royalties.

> pay deficit
You pay off A$20 in deficit.

> markup 30
You set the percentage to add to the sale price to 30%.


Discworld shop help - Shop owner - Page 4

Statistics

The status command gives information about the room and shop items.

The shop keeps track of the amount of money you made and the amount which you spent on the upkeep of your shop. This allows you to tell if you are making a profit or a loss.

'stats money' gives you statistics on moneys made, spent, current inventory value and your royalty pool or deficit.

Examples:

Status example:

> syntax status
Forms of syntax available for the command 'status':
status hints <object>
status <object>
status room {hint|hints}
status room
status hint <object>
status room weekly
status <object> hints

> status room
The owner of the property is sined.
The name of the property is shop.
The black list is empty.
The property does not currently have a sign set.
Current float is A$0.
Use condition: true.
  Use poker condition: true.
  Use pickler condition: true.
  Use blackjack condition: true.
  Use poll add condition: true.
  Use buy condition: true.
  Use poll vote condition: true.
  Use use condition: true.

the pickler status:

   Fee Per Use : 10p (fixed)
   Cost Per Use: 10p
   Profit : A$4710.67
Vote duration: 121 hours
the large shop counter
   The current percentage to automatically add to the buy price is: 10%
   Limits on what can be sold.
   Maximum number of items allowed in the shop : 150 currently 0 (fixed).
   Maximum number of items allowed per player : disabled.
   Automatically queue sales more than : disabled.
   Automatically deny sales more than : disabled.
   Helpers : None at all.
   No limits set per player.

   Automatically approve sales less than : disabled.
Use 'expressions' to see the expressions.
Use 'functions shop' to see the user defined functions.
Money Changer:
   Percentage cut 2%
   No money in the system.
The Green Slab box:
   Revenue : A$77.66
   Cost from publisher : 3p
   Sale price : 3p
   Back Issue Cost from publisher : 10p
   Back Issue Sale price : 10p
the AM Daily box:
   Revenue : A$136.01
   Cost from publisher : 3p
   Sale price : 3p
   Back Issue Cost from publisher : 10p
   Back Issue Sale price : 10p

Status hints shop counter example:

> status hints shop counter
the large shop counter
   The current percentage to automatically add to the buy price is: 10%
       Hint: markup <percent>
   Limits on what can be sold.
   Maximum number of items allowed in the shop : 150 currently 0 (fixed).
   Maximum number of items allowed per player  : disabled.
       Hint: set max number <number|disable>
   Automatically queue sales more than         : disabled.
       Hint: set high queue cost <cost|disable>
   Automatically deny sales more than          : disabled.
       Hint: set high deny cost <cost|disable>
   Helpers     : None at all.
       Hint: helper add <name>
       Hint: helper remove <name>
       Hint: helper list
   No limits set per player.
       Hint: set max number <max sellable|disable> for <player>
       Hint: set high queue cost <cost|disable> for <player>
       Hint: set high deny cost <cost|disable> for <player> to <cost|disable>

   Automatically approve sales less than       : disabled.
       Hint: set low approve cost <cost|disable>
Use 'expressions' to see the expressions.
Use 'functions shop' to see the user defined functions.
You get the status of the large shop counter.

Stats Money example:

> stats money
Current money spent A$4196.50 and money made A$5115.54.
The current stock value is A$1514.97.

The owner current has a cash float (royalties) of A$7091.10.

Note that although the stats commands has several forms, these don't all work!

> syntax stats
Forms of syntax available for the command 'stats':
stats money
stats items by seller
stats items by value
stats items by name
stats items by number

> stats items by seller
A runtime error occurred.
Please use the "bug" command to report it, describing what you tried to do when it happened.

> stats items by value
A runtime error occurred.
Please use the "bug" command to report it, describing what you tried to do when it happened.

> stats items by name
A runtime error occurred.
Please use the "bug" command to report it, describing what you tried to do when it happened.

> stats items by number
A runtime error occurred.
Please use the "bug" command to report it, describing what you tried to do when it happened.


Discworld shop help - Shop owner - Page 5

Equipping the Shop - Meet the Spulluf

The Spulluf is a friendly fellow who sells you your shop furniture. He also takes away your unwanted items.

Spulluf Commands

The items available from the Spulluf (in AM$) are:

The spulluf says to you: A) the smithy costs A$6000 (20 square yards)
The spulluf says to you: B) the small poker table costs A$2000 (10 square yards)
The spulluf says to you: C) the medium poker table costs A$3000 (20 square yards)
The spulluf says to you: D) the large poker table costs A$4000 (30 square yards)
The spulluf says to you: E) the money changer counter costs A$600 (5 square yards)
The spulluf says to you: F) the blackjack table costs A$600 (15 square yards)
The spulluf says to you: G) the small shop counter costs A$1200 (40 square yards)
The spulluf says to you: H) the medium shop counter costs A$3000 (60 square yards)
The spulluf says to you: I) the large shop counter costs A$11000 (80 square yards)
The spulluf says to you: J) the deluxe shop counter costs A$35000 (100 square yards)
The spulluf says to you: K) the pickler costs A$600 (2 square yards)
The spulluf says to you: L) the blackboard costs A$600 (1 square yards)
The spulluf says to you: M) the newspaper box costs A$2.25 (1 square yards)
The spulluf says to you: N) the newspaper archive box costs A$6.75 (5 square yards)
The spulluf says to you: O) the master bank counter costs A$40000 (91 square yards)
The spulluf says to you: P) the small bank counter costs A$1000 (10 square yards)
The spulluf says to you: Q) the bank counter costs A$2000 (20 square yards)
The spulluf says to you: R) the large bank counter costs A$4000 (30 square yards)
The spulluf says to you: S) the huge bank counter costs A$10000 (40 square yards)
These require a lot of maintenance by shop managers to transfer surpluses to / from the bank master branches, and you may incur currency exchange fees when you do so. Players will moan if your counter is full / empty when they want to transfer funds from / to the currency area your counter is in to / from the area the master counter or another franchise is in.
The spulluf says to you: T) the postal counter costs A$16000 (25 square yards)
The spulluf says to you: U) the opinion poll costs A$600 (2 square yards)

The spulluf has a help file:

Name
spulluf - purchase exciting things
Syntax
list on <spulluf>
browse <id> on <spulluf>
buy <id> from <spulluf>
buy <id> with <options> from <spulluf>
dismiss <spulluf>
trash <object> with <spulluf>
Description
Spulluf will sell commercial items to you in commercial properties. They are very nice and happy to hang around and wait for you to finish.
Some of the things sold require options, to specify options you use a comma sperated list with the format <option name>=<option>
When you trash a shop item it will completely destroy the item and not give you any money back from the operation.
Example
> list on spulluf
> buy a from spulluf
> buy g with storeroom size=150, counter type=polished hardwood from spulluf

Discworld shop help - Shop owner - Page 6

Working with the shop's stock

You can change the name and the category of an object in the shop's stock using the 'change name of <object> to <string>' (doesn't work), 'change category of <object> to <string>' and 'change price of <object> to <currency>'.

The owner of the shop can control the categories of the shop. They can add, remove and rename categories as they wish (except you cannot remove a non-empty category).

'category add <name>' adds a category to the current list of categories in the shop.

'category remove <name>' removes a category from the current list of categories in the shop.

'category rename <category> to <category>' renames a category to another name. This will move all the items currently in the old category to the new name as well.

'category list' will show you the list of current categories.

'category default <name>' sets the current default category to use for all operations that require a default category.

Examples:

> category add Healing Tea
You add a new category.

> category remove Healing Tea
Removed the shop category Healing Tea.

> category list
The current categories are:
Weapons
General (default)

> category rename Healing Tea to Tea
You rename category Healing Tea to Tea.

> change name of dl to sarilak
You change the name of Sarilar to sarilak.

> change price of dm to $800
You change the value of Sarilak to A$800.

> change category of dm to weapons
You change the category of Sarilak to Weapons.

You can display some additional information in the ist of categories, and in the list of goods in each category.

Category Description:

category description <category_name> "<description_text>"

The category description will appear indented below the category name in the list of categories (i.e. when a customer uses "list" with no arguments).

Category Information:

category informattion <category_name> "<information_text>"

The category information will appear above the list of items when the category is listed (i.e. when a customer uses "list <category_name>"). Category information can include colour codes using %^COLOUR%^text%^RESET%^ type codes.


Discworld shop help - Shop owner - Page 7

Working with the waiting list: Simple controls

The default setup of the shop will put any item that is attempted to be sold to the shop into an approval list. This list can be seen using the 'waiting' and 'waiting unapproved' commands.

The items in the waiting list are all given ids and they must be used to reference these items. Please note these ids are totally separate to the ids used in the shop itself.

The items in the two different waiting lists are referenced seperately, so the items in the unapproved list all have '-' in front of their name while the ones in the approved list do not. You must include the '-' when refering to items in the "waiting unapproved" list, and not in the "waiting" list.

The items can be approved with the command 'approve <id>' and rejected with the command 'reject <id>' or 'reject <id> message <reject message>'. When players sell items in a group, you can use the 'reject <id> position <number>' or 'reject <id> position <number> message <reject message>' to reject only some of the items.

When you approve an item the shop will try and take the money it will cost to approve it from your inventory. If you do not have enough money either in your inventory or in your royalties to approve the item, the shop will refuse to put the item into the shops inventory.

Before approve an item you may wish to check to see if it is really what they say it is. There a few commands that allow you to do this. The first one is 'browse waiting <id>' which allows you to look at the short and long descriptions and the read message of an item. The base cost mentioned when you browse an item is what their value is without taking in account enchantment, condition, etc. The scaled cost is the opposite.

The other method of checking items is using the 'checkout <id>' and 'checkin <object>' commands. These allow an object to be taken out of the approval list and checked over without actually buying the object. If you loose the object in some way after you have checked it out (burying it or whatever) then the person who sold the item will be credited with the money for actually selling it to the shop. So be careful not to destroy the object. Once you have finished examining it you can check it back in for approval/rejection.

Players can retrieve their items while they are still waiting for approval by using 'retrieve <id>'.

Examples:

> waiting
The current approval items are:
AA) Balwog's sparkling ruby for A$3 in General, 1 objects (a sparkling ruby) 5 in stock.

> browse waiting aa
The sparkling ruby: (Base cost A$20; scaled cost A$20
This is a large, sparkling ruby. Although it looks pretty, the cloudiness in it suggests that it could well be a fake.
> reject aa message It's a fake!
Sending to: Balwog
Sending to: Balwog

It sends twice, once for the object and once for the message.

Sometimes when you reject you get a message:

Unable to send the parcel for some reason (-7).

This means that the player you are sending to is idle and unable to receive mail.

> approve af
You approve a nodachi to be sold as nodachi in Weapons for A$100.

> checkout af
Moved a coat of jazerant armour into your inventory for you to check.
You check out one of the coats of jazerant armour.

> checkin jazerant armour
You check the coat of jazerant armour back in.


Discworld shop help - Shop owner - Page 8

Changing the status of things: Shop name and signs

Shop name

You can set the name of your shop to be whatever you wish. The name of the shop will be used for messages inside the shop and will also be displayed on a sign outside the shop.

Examples:

> name shop Lanfear's house of fun
You set the shop name to 'Lanfear's house of fun'.

Shop signs

You can set a sign to bec placed outside your shop (you can buy them at the sign shop). The sign will be displayed to people who are on the street.

When a sign is removed it will be placed back into your inventory. If you set a sign when a sign is already set then the existing sign will be removed first.

Examples:

> set sign blue sign
You set the large sign as your shop sign.

> remove sign
You remove the large sign from Lanfear's Shop.


Discworld shop help - Shop owner - Page 9

Hiring players to work for you

Controllers / Managers

You can allow people to help manage the shop by using 'allow <player>'. To remove them from the allow list, use 'deny <player>. To see who is on allow, use 'allow list'. They can change or add anything of the settings, except collect your royalties.

Note - any controller has complete access to the shop float!
Note - If you have a wizard or priest controller/manager, and use player shop functions relying on "cointainsspell" or "containsimbue", delete the function(s) before denying that player, and then reload the function(s) after the staff changes have been made.

Examples:

> allow lassan
Lanfear, avon and lassan are allowed to control this room.

> deny lassan
Lanfear and avon are allowed to control this room.

Helpers / Employees

Helpers are able to approve or reject items offered for sale, and to change the prices, categories and descriptions of items in stock. They have access to the "change", "approve" and "reject" commands.

Note - If you have a wizard or priest helper, and use player shop functions relying on "cointainsspell" or "containsimbue", delete the function(s) before removing that player, and then reload the function(s) after the staff changes have been made.

Examples:

> helper add lanfear
You add Lanfear as a helper.

> helper list
The current helpers are: tom, dick, harry and lanfear.
This might show newbie helpers, you can also check helpers with "status room"

> helper remove lanfear
You remove Lanfear as a helper.


Discworld shop help - Shop owner - Page 10

Disallowing people from using the shop

You can deny individual people complete access to your shop if you want to, so they have no ability to either buy or sell items. To do this you use the black list control in the shop. Black listing is checked before everything else and overrides everything.

To add someone to your black list go 'blacklist add <player>' and to remove someone from your black list go 'blacklist remove <player>'. You can also add all the people from your ignore list to the black list if you wish by typing 'blacklist add ignore'.

You can see the current people in your black list using the 'status room' command.

The owner can also control who uses the shop on a broader level. Overall, you can restrict the use of the shop based on guild, level, memberships of club, family names etc., by using the buy or use expressions. Please see page 15 for more details.

Examples:

> blacklist add brighid
You add brighid to the black list.

> blacklist remove brighid
You remove brighid from the black list.

> blacklist add ignore
You add cold, eben and soxy to the black list.


Discworld shop help - Shop owner - Page 11

Changing the status of things: Setting up general criteria

You can setup limits and prices at which things will be automatically accepted, denied or queued, as well as how many objects a player can have for sale at the shop at any time. You can also set up these limits and prices individually for specific players. In later sections you'll learn how to automatically approve/deny things based on custom criteria.

'set high deny cost <cost|disable>' sets up the maximum cost that anything at all can be sold to the shop at. If an item exceeds this cost then it will not be allowed to be sold at all. It will be denied and not moved into the acceptance list. If this is unset, or set to 0, then there is no upper limit on the cost of something allowed to be sold in the shop.

'set high queue cost <cost|disable>' sets up the value at which items will enter the approval list even if they were set up to be automatically approved.

'set max number <max sellable|disable>' sets the maximum number of items than can be listed by the player in both the shop and in their approval list. This is to stop the shop owner from being deluged in items for approval from one player.

'set low approve cost <cost|disable>' sets up the maximum cost that an item will automatically be accepted into the shop for. If this is set to a non-zero value then anything which sells for less than this will be added to the shop's inventory without going through the normal acceptance process.

'status' and 'status hints' can be used to view the status of all the current auto approval limits specified in the shop.

The order for checking for things for automatic approval is this: first the seller is checked for any hard limits on their sale price, then the item itself is checked for any limits, then the expressions are evaluated and checked and lastly the low level limits for automatic approval are checked on the player. When the seller is checked for hard limits and for the limit at which items can be sold automatically their limits specified specifically for the player are checked, and if they do not exist then the default limits are checked.

Examples:

> set high deny cost $2000
You set the shop to automatically deny any item costing more than A$2000.

> set high queue cost $1000
You set the shop to automatically put any item costing more than A$1000 into the approve list.

> set max number 20
You set the default number of sold items per person to 20.

> set low approve cost $0.50$
You set the shop to automatically accept any item costing less than 50p.


Discworld shop help - Shop owner - Page 12

Setting up people for automatic acceptance

You can setup people so that items they sell have different limits to the defaults. This applies to the deny limit, the approve limit and the number of items the shop will stock.

'set high deny cost <cost|disable> for <player>' sets the deny limit for the player. If they try and sell an item for more than this it will be denied. This can be higher or lower than the default limit. If this is disabled then the default limit will be used.

'set high queue cost <cost|disable> for <player>' sets the approve limit for the player. If they try and sell an item for more than this it will be automatically queued in the waiting list. This can be higher or lower than the default limit. If this is disabled then the default limit will be used.

'set max number <max sellable|disable> for <player>' sets the number of items the shop will stock for the player. It will deny them from selling more than this to the shop, this includes both the inventory and anything they have waiting for acceptance. This can be higher or lower than the default limit. If the number is set to 0 then this will be disabled and the default limit will be used.

'status' and 'status hints' will show you the current status of all the players approval limits.

Examples:

> set high deny cost $500$ for silvara
You set the maximum cost of items accepted by silvara to A$500.

> set high queue cost $400$ for silvara
You set the maximum cost of items automatically approved by silvara to A$400.

> set max number 50 for silvara
You set the maximum number of items sellable by silvara to 50.

> set high deny cost disable for silvara
You disable the maximum cost of items to be sold by silvara.


Discworld shop help - Shop owner - Page 13

Setting up items for automatic acceptance

You can set individual limits on how much a shop will pay for specified items. The shop will approve the item sold for less than the specified amount and put anything that is sold for more in the waiting list.

There are two basic ways (and then some variations) with which you can set your shop up to
accept items automatically:

  1. Short descriptions and selling price are the criteria against which items are matched to determine the eligibility for automatic acceptance.
  2. Short descriptions, selling price and/or other attributes (like object condition) will be evaluated. This method makes use of expressions which will be discussed later. For now, just remember that there are more sophisticated ways of testing items than what is discussed in this section.

With both the above-mentioned methods you can either enter the name for an item or an identifier for an object to be tested for eligibility. "Eek! What is that?" I hear you ask. Well, for the purposes of your shop, items are things _you_ have to describe to the shop. As for objects, as long as you have it in your inventory, the shop will take its description from the object itself. (This is great for when you want to match up hard to enter descriptions, like the ones with colours in them.). Clear as mud, right? Syntaxes then examples to follow!

Syntax:

Examples:

> auto add name small turquoise vial up to $5$
You set the shop to automatically accept any item with a short of small turquoise vial up to a cost of A$5.

> auto remove name small turquoise vial
You remove the item small turquoise vial from the list of automatically accepted items.

For the following examples please assume that I have a 'small turquoise vial' in my inventory.

> auto add object vial up to $5$
You set the shop to automatically accept any of small turquoise vial up to a cost of A$5.

> value vial
The item the small turquoise vial can be sold if it costs less than A$5 (small turquoise vial).

> auto remove object vial
You remove the small turquoise vial from the list of automatically accepted items.

Variations:

Ok, I hope that wasn't too bad. Earlier I said that there are two methods (and some variations) to automatically accept items into the shop. For the variations, the first bit of the syntax stays the same ('auto add name/object <name/object> up to <value>'), but them we add some stuff (examples to follow):

- as <list name>

When you want the things being accepted to have a specific name.

- with markup <percentage>

Used to override the default markup up specified by "markup <percentage>", as seen in 'status'.

- as <list name> with markup <percentage>

Both

- value <amount>

This overrides the amount the item will be sold for. This allows you to accept it for any value you wish but sell it at a fixed cost (so you do not have any pence involved for instance).

Examples:

> auto add object vial up to $5$ as amazing healing potion!
You set the shop to automatically accept any of small turquoise vial up to a cost of A$5 as "amazing healing potion!".

> auto add object vial up to $5$ as amazing healing potion! with markup 10
You set the shop to automatically accept any of small turquoise vial up to a cost of A$5 as "amazing healing potion!" with a markup of 10%.

Next Section

Ok! Now we're off to the next section which is an introduction to expressions. I know it's a bit boring but it's not too long and it's stuff you really, really need to know or you'll ask silly questions and people will laugh at you! ... So read on :)


Discworld shop help - Shop owner - Page 14

Introduction to Expressions

Before we look at where you can use expressions and a list of controls (functions and variables) which can be used, let's look at a short explanation of the different components used in expressions.

The expressions are setup free form using the operators 'and', 'or', 'not' '+', '-', '*', '/', '>', '>=', '<', '<=', '=', '<>' '[', ']', '{', '}', 'sizeof', 'contents' or 'if'. The main operators behave like you would expect and you can manipulate numbers and money as you wish.

There are three types of constants you can specify. Money constants are defined by a string with $'s around it, i.e.: $5 dollars$ or $4 lancre pennies$ or $4.00$. Use of $4.00$ will work with Ankh-Morpork money but will not work in other parts of the country. String constants are defined with '"'s, i.e.: "frog", "blue". Integer constants are just numbers, i.e.: 12, 14, 100. Easy, right? Ok.

The 'if' operator is a special case and can be used as a flow control construct. The syntax of an if is: 'if <condition> then <expression> else <expression> endif' (Don't forget the endif!)

Arrays are always of a uniform type, so you will have an array of objects, or strings or numbers. An array is ordered series of things. The ordered bit means that array[0] will always be the same as array[0] and it comes before array[1]. If you think of an array like a set of drawers in a cabinet, the bottom draw is number 0, the next one up is 1 and so on. So draw 1 is the contents of the draw second from the bottom. Which would be draw[1] in an expression.

There are two things you can do with an array, you can get specific elements out of the array and you can turn something back into an array. To get a specific element of an array you use the '[]' operator. For example 'objects[0]' is the first element of the objects array. You can recreate arrays using the '{}' operator. For example: {objects[0]} makes an array of size 1.

Arrays can be added and subtracted. They cannot be used with any of the other operators.

'sizeof' returns the size of the array. So sizeof({objects[0]}) would be 1, and sizeof({12,13,14}) would be 3.

Next section we go to cover a bit more how to control players who are allowed to buy and use the shop.


Discworld shop help - Shop owner - Page 15

Controlling Access By Groups

The owner can control who can use the shop. This makes everyone effectively black listed and only allows specified people to use the shop, rather than letting anyone except those who are black listed use the shop.

'buy expression <expression|disable>' sets up an expression which must be matched for the person to be able to buy from the shop. It defaults to 'true' which means the shop can always be bought from.

Doesn't work, use: set use expression for buy as <expression>

'use expression <expression|disable>' sets up an expression which must be matched for the person to be able to use the shop. It defaults to 'true' which means the shop can always be used.

Doesn't work, use: set use expression for use as <expression>

Example:

> buy expression (((guild = "warriors") and (level < 100)) or (guild = "wizards") or (guild = "thieves") or (guild = "assassins") or (guild = "witches") or (guild = "priests")) and not clubmember ("shadowlisters")
You set the expression to use when checking to see if someone can buy from the shop to (((guild = "warriors") and (level < 100)) or (guild = "wizards") or (guild = "thieves") or (guild = "assassins") or (guild = "witches") or (guild = "priests")) and ( not clubmember("shadowlisters")).

but that doesn't seem to work, the following do

> set use expression for buy as ((guild = "assassins") or (guild = "priests") or (guild = "thieves") or (guild = "witches") or (guild = "wizards") or (guild = "warriors") or (guild = "adventurers"))
You set the expression to use when checking to see if someone can use the property for buy to guild = "assassins" or guild = "priests" or guild = "thieves" or guild = "witches" or guild = "wizards" or guild = "warriors" or guild = "adventurers".

> set use expression for use as ((guild = "assassins") or (guild = "priests") or (guild = "thieves") or (guild = "witches") or (guild = "wizards") or (guild = "warriors") or (guild = "adventurers"))
You set the expression to use when checking to see if someone can use the property for use to guild = "assassins" or guild = "priests" or guild = "thieves" or guild = "witches" or guild = "wizards" or guild = "warriors" or guild = "adventurers".


Discworld shop help - Shop owner - Page 16

Setting up items for automatic acceptance

To see all expressions regulating auto acceptance of items in your shop, use 'expressions' or 'expressions hints'.

Remember on page 12 we talked about items and objects? If not, have a quick look at that again please, because the same principle counts here. I will wait.

Back? Ok. There are two ways in which you can check for different things concerning items being sold to you, both using expressions (and this does not include the difference between an item and an object, I'm not counting that):

  1. Short descriptions, selling price and other attributes. i.e. accept a jet black rod if it is 95% charged for $5).
  2. Selling price and other attributes. (Yes! We're cutting out the descriptions). i.e. accept / deny whatever item if it contains the imbue 'resurrect' for the price of the object + $20.

Wow!

On to the first method.. (Keep in mind that the expressions must always return a money value.) The syntaxes follow (remember the next section has a list of all functions and variables you can use in expressions, as well as examples for each, although there are some examples at the end of this section as well):

Remember that you have the same variations for these syntaxes as you had earlier on page 13, i.e. 'auto add object <object> with <expression> as <list name> with markup <percentage>'. You also remove them in the same way.

Right, now we get to the second method with which we can setup the automatic acceptance / denial of items with expressions. This method is independent of objects and items since they test only selling price and attributes of the item being sold, i.e. accept any item with resurrect imbued on for the objectvalue + $10, or deny any item with object condition less than 50. The syntaxes are as follows:

Examples:

> auto add name small silver needle with if objectcondition(objects) > 50 then $2$ else $1$ endif
You set the shop to automatically accept any item with a short of "small silver needle" with an expression of if objectcondition(objects) > 50 then A$2 else A$1 endif.

> auto add item object needle with if objectcondition(objects) > 50 then $2$ else $1$ endif
You set the shop to automatically accept any of the small silver needle with an expression of if objectcondition(objects) > 50 then A$2 else A$1 endif.

> auto add deny expression sizeof(objectmatch (objects, "small silver needle")) > 0
You set the shop to automatically deny any item matching the expression objectmatch(objects, "small silver needle").

> auto add approve expression containsimbue(objects,"resurrect") cost objectbasevalue + $100$ as resurrect imbue
You set the shop to automatically accept any item matching the expression containsimbue(objects, "resurrect") with a cost of objectbasevalue(objects) + A$100.

I don't think I ever managed to get the approve and deny expressions to work as described. If I did, I can't remember how I did it!


Discworld shop help - Shop owner - Page 17

Function and Variable help

For help on the specific functions and variables you can look at the help available from inside the shop. There are a few useful commands for determining the available functions and the help.

You can get a list of all the internally defined functions with the command 'functions internal'. You can get a look at all the available help files with 'functions help list' and you can get help on a specific function with 'functions help <name>'.

A complete description of the functions will not be done in here, we will just show you a few examples of how they can be used.

Commands:

Example:

> auto add name red mace with if (inventorynumber("red mace") < 10) and (charges > 90) then $8$ else if (inventorynumber("red mace") < 10) and (charges > 75) then $6$ else endif endif as Red Mace


Discworld shop help - Shop owner - Page 18

User defined expressions (functions)

Once you start setting up the shop, you might find yourself making a lot of the following type of functions: auto add object boots if condition > 90 then $40 else if condition >80 the $30 etc etc. Well, it's tedious and besides, it uses the same principle over and over again. Surely there is an easier way? Yes! There is! You can define functions which control the sale of items in the shop using expressions. You can define a function that takes arguments or not. The function is defined in two parts.

  1. The header of the function which defines which arguments are used and the name of the function.
  2. The second part is the expression to use.

There are three syntaxes to manipulate user defined functions with:

The allowed types as arguments to the functions are: money, integer, boolean, string.

Examples

Function to check condition of items being sold:

> add function conditiontest(money low, money middle, money high) as if objectcondition > 90 then high else if objectcondition > 75 then middle else if objectcondition > 60 then low endif endif endif
You successfully add:
money conditiontest(money low, money middle, money high) {
   if objectcondition > 90 then
      high
   else
      if objectcondition > 75 then
         middle
      else
         if objectcondition > 60 then
            low
         else
            A$0
         endif
      endif
   endif
}

Function to check to see if the thing being sold contains something:

> add function contains(string name, integer number) as sizeof(objects) = 1 and sizeof(objectmatch(contents(objects[0]), name)) = number

Example of implementation

> auto item object frog with conditiontest($50$, $40$, $10$)
You setup the item 'frog' to be approved with an expression of: conditiontest($50.00, $40.00, $10,00)

> auto add approve expression contains("diamond engagement ring", 5) and (inventorynumber("bag of five engagement rings") < 5) cost $25$ as Bag of five engagement rings


Discworld shop help - Shop owner - Page 19

Variables (functions below)

deity, family, guild, level, objects, order, playername, salecategory, salecost, salename

deity

Name

deity - the deity the player worships

Syntax

string deity

Description

The deity the player worships.

Examples

deity = "pishe"

See also

order, family, salename, level, guild, salecost, salecategory

family

Name

family - the family the player belongs to

Syntax

string family

Description

This variable is the value of the family the person belongs to

Examples

family = "honeydreamers"

See also

family, salename, level, guild, salecost, salecategory, deity

guild

Name

guild - the guild the player belongs to

Syntax

string guild

Description

The name of the guild the player belongs to. This is one of: witches, warriors, wizards, thieves, assassins, priests

Examples

if (guild = "warrors" and level > 100) then $20$ endif

See also

order, family, salename, level, salecost, salecategory, deity

level

Name

level - the player's level

Syntax

int level

Description

The level of the player selling the item.

Examples

level > 300

See also

order, family, salename, guild, salecost, salecategory, deity

objects

Name

objects - the objects to check

Syntax

array object objects

Description

This is the array of objects that is being tested to be sold. If a person tries to sell two katana's this is the set of both katana's.

Examples

objects
contents(objects[0])

See also

contents, sizeof

order

Name

order - the wizard order

Syntax

string order

Description

The wizard order the player ordering belongs to.

Examples

order = "silver star"

See also

order, family, salename, level, guild, salecost, salecategory, deity

playername

Name

playername - the player's name

Syntax

string playername

Description

The name of the player. This is without any title or family name, ie the name the player types at login, and is not matched for case.

Examples

set use expression for poll add as (playername = "lanfear")
set use expression for buy as not (playername = "nastygit")

See also

order, family, salename, level, guild, salecost, salecategory, deity

salecategory

Name

salecategory - the category the object was sold in

Syntax

string salecategory

Description

The category the player has tried to sell the item in.

Examples

salecategory = "bottles of ink"

See also

order, family, salename, level, guild, salecost, deity

salecost

Name

salecost - the amount of money the player has sold the item for

Syntax

money salecost

Description

The amount of money the player attempted to sell the item for. This is the amount they have entered in.

Examples

salecost = $10$

See also

order, family, salename, level, guild, salecategory, deity

salename

Name

salename - the name the item is being sold as

Syntax

string salename

Description

This the name the player has attempted to sell the item for.

Examples

salename = "big fluffy banana"

See also

order, family, level, guild, salecost, salecategory, deity

Functions (variables above)

charges, citizenof, containsimbue, containsspell, contents, inventorynumber, objectbasevalue, objectcondition, objectmatch, objectshort, objectstolen, objecttype, objectvalue, objectwarded, percentageliquid, sizeof

charges

Name

charges - finds the number of charges left in an item.

Syntax

int charges(array object obs)

Description

This method will find the number of charges left in the specified objects.

Examples

charges(objects) > 10

citizenof

Name

citizenof - find if the person is a citizen of a city

Syntax

bool citizenof(string city)

Description

This method determines if the current person is a citizen of the the specificied city or not. You can use this to restrict what someone does based on their citizenship.

Examples

citizenof("ankh-morpork")

See also

clubmember

containsimbue

Name

containsimbue - contains an imbue

Syntax

array object containsimbue(array object obs, string imbue)

Description

This method will find the objects that contain the specified imbue in the set of passed in objects. If you set the imbue type you are looking for to "any" then it will match any sort of imbue. To detect imbues one of the shop employees must be a priest.

Warning: User functions relying on this shop function should be deleted before making removing any priests from manager or helper status. The function(s) can be added again after the staff changes have been made. This is especially important where the player being removed is also being deleted.

Examples

containsimbue(objects, "ressurect")
containsimbue(objects, "any")

See also

containsspell, objects

containsspell

Name

containsspell - contains an spell

Syntax

array object containsspell(array object obs, string spell)

Description

This method will find the objects that contain the specified spell in the set of passed in objects. If you set the spell type you are looking for to "any" then it will match any sort of spell. To detect spells on scrolls one of the shop employees must be a wizard.

Warning: User functions relying on this shop function should be deleted before making removing any wizards from manager or helper status. The function(s) can be added again after the staff changes have been made. This is especially important where the player being removed is also being deleted.

Examples

containsspell(objects, "ressurect")
containsspell(objects, "any")

See also

containsimbue, objects

contents

Name

contents - return the contents of the container

Syntax

array object contents(object ob)

Description

This method will return the array objects that are inside the specified object. This only takes a single object as an input, it does not take an array of objects.

Examples

if sizeof(objects) = 1 and sizeof(objectmatch(contents(objects[0]), 'red towel') = 12 then $20$ else $0$ endif

See also

sizeof, objects

inventorynumber

Name

inventorynumber - the number of items of the specified type in the inventory

Syntax

int inventorynumber(string str)

Description

This method will find the number of items of the specified type in the inventory of the shop already.

Examples

inventorynumber('red socks')

See also

objectmatch, objectshort

objectbasevalue

Name

objectbasevalue - the base value of the objects

Syntax

int objectbasevalue(array object obs)

Description

This method will find the base value of the passed in objects. The base value is before any scaling is applied, like for condition or for enchantment.

Examples

objectbasevalue(objects)

See also

objectvalue

objectcondition

Name

objectcondition - the condition of the object

Syntax

int objectcondition(array object obs)

Description

This method will find the condition of the passed in objects. This will return the lowest condition of the set of objects. So if one has a higher condition than another of the objects, the lowest one will be used. Condition is a %age of best possible condition for the object.

Examples

objectcondition(objects) > 95

objectmatch

Name

objectmatch - the objects matching

Syntax

array object objectmatch(array object obs, string match)

Description

This method finds the objects that match the specified match name. This can be used to check the number of each type of thing. The string used in the match here is like the matching used in the parser itself.

Examples

if sizeof(objectmatch(objects,'red towel')) = 2 then $20$ endif

See also

objectshort

objectshort

Name

objectshort - match the short description

Syntax

array object objectshort(array object obs, string short)

Description

This method will find the objects that match the short passed in. It does this only on the passed in objects. The short is match explicately, so it does not do matching like in the parser. The short of an object is what you will see in your inventory when you do an inventory (without any modifiers like (lit)).

Examples

objectshort(objects, 'katana')

See also

objectmatch

objectstolen

Name

objectstolen - determine if any of the objects are stolen

Syntax

array object objectstolen(array object obs)

Description

This method will find if any of the objects have been stolen or not. It will return the array of stolen objects.

Examples

if sizeof(objectstolen(objects)) > 0 then $0$ else $20 endif

See also

objectwarded

objecttype

Name

objecttype - the type of the objects

Syntax

string objecttype(array object obs)

Description

This method returns the type of the passed in objects. The type is one of: weapon, armour, clothing, misc, mixed. If there is more than one type of item then the type of 'mixed' will be returned. The type of 'misc' is for any object that is not a weapon, armour or clothing.

Examples

objecttype(objects) = 'armour'

objectvalue

Name

objectvalue - the value of the object

Syntax

money objectvaluie(array object obs)

Description

This method will return the value of the passed in objects. It will always return the lowest value of all the passed in objects. The value is the scaled value based on the condition, the enchantment and any other modifiers of the base cost of the object.

Examples

objectvalue(objects)

See also

objectbasevalue

objectwarded

Name

objectwarded - check to see if the objects are warded

Syntax

boolean objectwarded(array object obs)

Description

This method will see if the objects are warded.

Examples

objectwarded(objects)

See also

objectstolen

percentageliquid

Name

percentageliquid

Syntax

int percentageliquid(array object obs, string liquidname)

Description

This method will find the percentage of the certain type of liquid in the container. So you can make sure that bottles are full of tea or honey and not half empty.

Examples

percentageliquid(objects, 'honey')

sizeof

Name

sizeof - find the size of the array

Syntax

int sizeof(array)

Description

This method will find the size of the passed in array. It can be used for checking things like the sizeof the objects array or the size of things inside a container.

Examples

sizeof(objects) = 1
sizeof(contents(objects[0]))

See also

contents, objects