Shopkeeper DIL.
Version 1.02 Original Author : Boh/Shai <shai@valhalla.com>
Conversion for HTML by: Peter Ryskin <d908988@student.dtu.dk>
Some changes made by Awake <awake@valhalla.com>
Dil Shopkeepers for Dummies. An easy to
understand, step by step instruction on how to use the dil shopkeepers.
The shopkeeper DIL is a DIL like all else, all you do is add it to the
mobile with the correct arguments and voila, you have yourself a shopkeeper
dealing goods.
This is a bit different from the SFUN shopkeeper and it actually allows
ANYTHING to be a shop, but you should let it make sense.
Don't make a small rock on the ground sell tuborgs galore :).
Syntax:
dilcopy shopkeeper@function( produced, acts, opentimes, tradetypes, sellprofit,
buyprofit, maxcash, closedil, dilparams );
produced:
-
- Is a stringlist holding the symbolic name for the item, followed by the
number it should produce each day and finally max number of that item in
stock that is allowed.
Example:
-
{"tuborg@udgaard 2 50"}
-
- Will make the shopkeeper sell tuborgs, which it produces 2 new ones each
new mud-day until the limit of 50 items is reach in the stock.
acts:
-
- Stringlist Acts hold the custom acts for the shopkeeper (if you want
any), if you just want to define some of the acts then leave the rest empty
and the main DIL will use the standard acts.
Example:
-
{ "$1n says, 'Damnit, I'm fresh out of that!'",
-
"$1n says, 'HAH! Where did you expect to get that from?'",
-
"$1n says, 'I do not trade with items like that!'",
-
"$1n says, 'First get the money for it $3n!'",
-
"$1n says, 'Glad doing business with you, have fun with the $2n'",
-
"$1n says, 'Great! I've always wanted one of these'",
-
"$1n says, 'I don't seem to have that many in my stock'",
-
"$1n says, 'I'm on my break, GET LOST!'",
-
"$1n says, 'I have no use for a $2n'",
-
"$1n says, 'Sorry, I can't afford it'" }
-
acts.[0] : "$1n says, 'Damnit...
-
The first act will be used if the shopkeeper doesn't have that particular
item in stock.
-
acts.[1] : "$1n says, 'HAH! Where...
-
Second act
is if the player is trying to sell the shopkeeper something which the player
does not have in his inventory, worn items cant be sold.
-
acts.[2] : "$1n says, 'I do not trade...
-
Act number
three is if the player is trying to sell the shopkeeper something which
is of another item type than his tradetype.
-
(This is just 1 type right now, will be expanded to allow multiple
types.)
-
acts.[3] : "$1n says, 'First get the...
-
Fourth act is if the player can't afford the item which he tried to purchase.
-
acts.[4] : "$1n says, 'Glad doing business...
-
Fifth act is if sale was successful when player is buying from shopkeeper.
-
acts.[5] : "$1n says, 'Great! I've always...
-
Sixth act is if sale was successful when player is selling to shopkeeper.
-
acts.[6] : "$1n says, 'I don't seem to have...
-
Seventh act is when the shop don't have the requested amount of a specific
item in the stock.
-
acts.[7] : "$1n says, 'I'm on my...
-
Act number eight is what the shopkeeper will say when players try to do
business with it while it's closed.
-
acts.[8] : "$1n says, 'I have no use...
-
Act number nine
is if the player is trying to sell the shopkeeper an item he does not trade
with.
-
acts.[9] : "$1n says, 'Sorry, I can't afford...
-
Act number tem is what the shopkeeper will say he has spend all his money
buying items from the players.
NOTE: In the acts above, $1n refers to the shop-keeper,
$2n to the unit being sold/bought/etc. and $3n to the
mobile dealing with the shopkeeper.
opentimes:
-
This stringlist hold the open&close times for the shop, toggling
the open/closed stated each time one of the numbers is reached. When the
shop goes into "closed mode", you have the option to pass it a
DIL which will start as soon as the shop closes. This is explained later
on.
Example:
{ "6","20"}
-
- Will make the shop open at 6 am and close at 8 pm.
Right now it only supports 2 points in time, But it will be changed
so that you can have up to 300 diffrent times, which should be more than
ample considering the number of hours in a day Remember you could make
the opentimes last for longer then a day.
NOTE : The only way to let the shop stay open for 24 hrs is to NOT
pass any argument here, just leave it clean.
tradetypes
-
The string hold the different tradetypes one after another. You can use
the defines contrary to belief, or you can use the actual numbers.
Example:
"1 15 17"
or,
""+ITEM_LIGHT+" "+ITEM_CONTAINER+" "+ITEM_DRINK_CONTAINER+" "
-
This makes the shopkeeper sell and buy lights, containers and drinkcontainers.
sellprofit:
-
This integer is the percentage that determines what the shop should demand
for the item, ranging from 100 and up. The actual price demanded is based
on the .cost field of the item.
-
Example:
-
80
-
Will make the shopkeeper sell objects at the price of 80% of their original
value.
buyprofit:
-
This integer is the percentage that determines what the shop should offer
for the item, ranging from 100 and down. The actual price demanded is based
on the
-
.cost field of the item.
Example:
-
80
-
Will
make the shopkeeper buy objects at the price of 80% of their original value.
maxcash:
This integer decides how much cash the shopkeeper should have when loaded.
Example:
409600
-
Will make the shopkeeper start with 10 platinum pieces that he/she can
buy items for.
closedil:
-
This string is the template of the function you want the DIL to start when
the shop is closing.
-
NOTE: - DIL will be destroyed as soon as an opentime is reached,
so dont do anything that takes too long for the unit to finish. Too long
means more then 5 minutes, or one mud hour
Example:
-
"closedil@boh"
-
this will copy the dil closedil@boh to the shopkeeper as soon as
it closes, and it will also be destroyed when the shop opens (if it still
exists that is). Remember that if you move the shopkeeper, you have to
return it to the original position or it will be stuck at the position
where the dil got destroyed.
dilparams:
-
This string should hold the parameters for the dil you want started when
the shop closes. If you don't want any parameters passed just put '()'
in this string. If this string is empty the shopkeeper code will use '()'
as standard. This has been added for ease of use (to allow lazyness :)
Example:
-
"( gnu, 56 )"
-
Will pass the string gnu, and the number 56 as parameters to the
DIL-function being copied onto the shopkeeper when it get started. Note
that these are constants and can't be changed.
Updates from SFUN shopkeeper:
-
Shopkeeper can now buy any amount of items and will never run out of money,
this should be taken into consideration when setting the profit numbers.
Since a high profit number will result in players running about selling
everything they can find to the shopkeeper.
-
You can buy N number of a specific items so you don't have to buy a tuborg
10 times, you can just type:
'buy 10 tuborg' and the shopkeeper will hand it over IF:
A. You can afford it.
B. You can carry the weight.
C. You can carry the number of item in your inventory.
D. It has the number of that item in his stock.
-
New shopkeeper DIL does not destroy the non-shop items in the invenory
of the shopkeeper, which means you dont have to steal from it to get the
items it's wearing.
-
Allows for a DIL to be added to the shop when it's closed.
-
Notifies itself a while before the shop is opened again by sending a message
to itself with the argument 'opening'
Notes
-
The shopkeeper only produces items each mud day, which means that if a
shopkeeper runs out it won't have new items until the next mud-day. In
extreme times this can mean that the shopkeeper won't have a new thing
of that type until the 2 hour mud-day has been completed.
-
The shopkeepers start out with the max number you give them, and it won't
be increased until 2 hours after ( the next mud-day).
-
If the pressure is high enough from above I might add a parameter for shop-reset
time, but that will be left for the administration to decide.
-
When the time left until the shop opens is 1 mudhour (5 minutes) the code
will start sending a message to the unit it's attached to. This is to allow
you to put the shopkeeper back where you want it or change something or
whatever.
An example is the shopkeepers in demon_realm, where the shopkeepers
fade away when the shop closes, and reappears 1 mudhour before opening
time. This feature only works if the shop has open/close times though.
Message sent is 'opening', you have to put the aware flag on the dil for
this feature to work though.
-
There is also a message sent when the shop closes, with the argument 'closing'.
See Also:
-
.
-
Dil Documentation.
Well, you've reached this far, hope you still know what your own name
is :). If you have any ideas or remarks for/on shopkeeper code just email
or mud-mail me about it.
Boh/Shai
Last Updated April 15, 1998