The Scent of a Room

This is an MPI wrapper for smell on Sociopolitical Ramifications. It will show the room scent as well as the scents of all the people in the room when you type smell here.

This could be adapted to change the output of smell on other MUCKs if their smell program is set linkable. You need smell.muf to get the scents of other people since MPI by itself doesn't have the permission to read other people's properties.

If you don't have a parent room go set one up.

First we need to know the db# for the smell program. For SPR it is #43413. If you are adapting this wrapper to another muck you will have to find the db# with plib smell, smell #help, look smell, or asking a helpstaffer. Bothering a helpstaffer is always the last resort, they're busy people. If you do have to ask a staffer ask them if it's set linkable or not. If it is you're set, if not you'll either have to convince a wizard to change it (unlikely) or write your own smell program to replace it (not high on my personal list).

Assuming that you now know the db# of smell.muf and that you have made yourself a parent room and moved all your rooms under it, this is what you must do:

Create an action called smell and attach it to your parent room:

@action smell=$TER

You can use the db# of your parent or the registered name you created (like the $TER I've used) in this command.

Link your new smell command to do-nothing.muf:

@link smell=$nothing

And finally the MPI wrapper itself. We're going to use the success message to wrap our information around the output of smell.

First we need to have this wrapper only go into effect if someone does smell here or just smell to get the scent of the room. For that we'll use an {if:} with an {or:} to give two possible 'true' results.

@succ smell={if:{or:{eq:{&arg},here},{eq:{strlen:{&arg}},0}},
{exec:here},{null:{muf:#43413,{&arg}}}}

I've artificially wrapped the line for clarity. The {if:} checks to see if the argument to the smell command was either here or nothing. To check for nothing we're comparing the length of the argument to 0 using {strlen:}.

If the argument was here or nothing then it will go to the rest of our MPI. If it was a player or object name then it will call the smell program with the {muf:} primitive and give it the argument like normal.

Now for the MPI to handle the here or nothing case:

@set smell=here:{lit: [ }{name:here}{lit: ] }
{prop:_room_scent,here}{null:{muf:#43413,here}}

The {lit:} primitives just print the strings inside as normal text. I've used them to bracket the name of the room (retrieved with the {name:} primitive) to make my custom smell output look like the output of smell.muf.

Next it will put in the scent of the room from the _room_scent property (used by smell.muf with an otherwise empty room).

And finally it will run smell.muf like normal to add in the scents of the people in the room.

The inverse problem to SPR's (adding the scents of the people to the scent of the room) is much more complex. Two problems come to mind immediately, first the version of smell.muf might only take one argument. In that case you will have to figure out how to loop a list of names through the {muf:} primitive. Second, and probably a lot easier to deal with, is a case where smell.muf does take multiple arguments, then all you have to do is figure out how to get a space delimited string of names out of {contents:here,player}.

 

Code Main

 

©1997-2001 Lynn A. Davis