Up to Main Index Up to Journal for January, 2017
JOURNAL FOR THURSDAY 19TH JANUARY, 2017
______________________________________________________________________________
SUBJECT: What are vetoes anyway?
DATE: Thu 19 Jan 21:59:31 GMT 2017
I’ve had a couple of emails asking what are vetoes and how are they used. This
I can understand, veto is kind of a strange word you don’t use every day.
Veto is Latin for ‘I forbid’. If you veto something you are prohibiting or
voting against it.
In WolfMUD vetoes are used to prohibit actions (commands). For example, any
object can usually be put into a container with the PUT command. Suppose we
have a pet rock that is afraid of the dark - and why not:
%%
Ref: PET1
Name: a pet rock
Aliases: PET ROCK
This is a smooth, flat, rock slightly tapered at one end. It's about three
inches wide tapering to about an inch, five inches long and an inch thick.
On one of the flat sides there are two slight depressions side by side near
the tapered end. At the tip of the tapered end is a light green fuzz of what
appears to be moss.
%%
We don’t want players to put our poor nyctophobic pet rock inside anything -
because it will be dark inside!
This is where vetoes come in. We can veto the PUT command and ‘forbid’ it from
being used just on the pet rock:
%%
Ref: PET1
Name: a pet rock
Aliases: PET ROCK
Vetoes: PUT→You get the strong impression that the pet rock does no
want to be put inside anything! How strange...
This is a smooth, flat, rock slightly tapered at one end. It's about three
inches wide tapering to about an inch, five inches long and an inch thick.
On one of the flat sides there are two slight depressions side by side near
the tapered end. At the tip of the tapered end is a light green fuzz of what
appears to be moss.
%%
Now if we try to put the pet rock inside anything we get:
Fireplace
You are in the corner of the common room in the dragon's breath tavern. A
fire burns merrily in an ornate fireplace, giving comfort to weary
travellers. The fire causes shadows to flicker and dance around the room,
changing darkness to light and back again. To the south the common room
continues and east the common room leads to the tavern entrance.
You see a pet rock here.
You see a curious brass lattice here.
You see a small green ball here.
You see a small red ball here.
You see an iron bound chest here.
You can see exits east, southeast and south.
>get pet
You get a pet rock.
>put pet chest
You get the strong impression that the pet rock does no want to be put
inside anything! How strange...
>
At the moment vetoes are not as useful as they could be. The reason for this
is that they are static - they either veto a command or they do not. For
example we couldn’t add a veto to stop our pet rock from being put into a
container if it already contained another pet rock. In the above example we
cannot even refer to the object it is being put into (yet!).
Dynamic vetoes are planned but will be coded initially. For example the GET
command could be vetoed if you are carrying too much. The PUT command could be
vetoed if the container was already full. Why would we use dynamic vetoes
instead of plugging the logic into the GET or PUT command code directly?
Vetoes allow us to prohibit commands based on a type - a container - or per
object - our pet rock - basis. Instead of hard coding checks into commands we
can delegate to the specific objects in question.
Even hierarchies of vetoes are possible. For example conside putting item A
into container B. Item A could veto being put into container B - as in our
rock example. But container B might also veto having item A put into it.
There are also indirect vetoes to be considered. For example suppose there is
a strong room. The strong room contains a glass case with a jewel in it. The
strong room also contains a guardian. The guardian should be able to
indirectly veto the TAKE command on the glass case. If you want to take the
jewel you must first kill or remove the guardian. If the guardian is gone the
veto would no longer be applicable and you can take the jewel.
For a simple idea vetoes can - or will be - quite a powerful feature.
Now, should I add a veto to players so that you cannot GET another player and
carry them around anymore? >:)
--
Diddymus
Up to Main Index Up to Journal for January, 2017