That would be this topic. The issue, as mentioned, is how to do it.
In Fuzzball MUCK, locks on exits (usually not rooms per-se) are a feature of the environment and can take a combination of characters and properties on them, with boolean operators.
@lock <object> = <key>
Locks to a specific key(s). can be specified as or #, or as me' or
here’. Boolean expressions are allowed, using & (and), | (or), ! (not), and parentheses ((
and )') for grouping. To lock to a player, prefix their name with
*’ (ex. *Igor). A key may be a player, an object, or `property:value’.
Characters don’t have arbitrary configurable properties here, but they do have IDs. And the latest room scripting updates offer means to lock an exit - even an example!
Some caveats, though: you need to be a pioneer, subscriber or builder to install a script - the first two at least must [temporarily] have ownership of it. The example also doesn’t lock out or allow specific users - that’d require a script testing the character ID within onExitUse of this and cancelling the event if it did or didn’t match depending on what you wanted.
That script could be simplified to call Room.listenExit(exitId)
in onActivate()
, cutting out the other script and messaging. Or it could lock multiple exits in the room to multiple owners; then you get into array handling. It could be made configurable like the listen script I wrote, rather than hardcoded - that’d be harder but a more sensible approach long-term.
export function onActivate(): void {
let exit = Room.getExit("EXIT_KEYWORD")
if (exit) Room.listenExit(exit.id)
}
export function onExitUse(addr: string, exitIntercept: ExitIntercept): void {
if ('CHARACTER_ID' == exitIntercept.charId) {
exitIntercept.cancel("The door seems to be locked.")
} else {
exitIntercept.useExit()
}
}
There is a problem in that as far as I am aware you cannot determine whether a character is being puppeted by someone via Room.getChar(id)
, only via an event (where it’s displayed). On some MUCKs a flag or property can be set to deny puppets access to an room/exit.
There also seem to be a slight issue determining the exit ID, in that list exits
does not give the exit ID, while get exit X
gives me Access denied
, even when I own the room.
This might be a bug because help get exit
suggests it should be possible:
get exit
<Keyword>
Get info about a visible exit in the room.
Room owners may also get info on hidden or inactive exits.
Perhaps there is an issue with the code added to handle the new type of exits.
Also a bug, at least in my understanding: following characters aren’t tested against the lock. This might be desired or at least acceptable behaviour for a bedroom lock, but probably not an area lock - rather, it should check all parties (since you could make a puppet bring you in, unless it checked, or create/use a secondary character to do it, or ask/trick someone else).