I’m chatting with the local wolf and I think I have an idea on how to make the scripting work in the least painful manner.
Why not have scripts behave like bots? It already opens a lot of possibilities for those who wish to add some interactivity. Here’s an MVP:
There’s a new syntax for bot commands: !bot stuff goes here
. The bang is a required prefix, bot is the name of the bot, and everything past it is passed onto the bot verbatim. It would be pretty easy on the client side as it’s just a glorified message
.
The users will be able to register the bot name for their bot characters. I’d envision this to be gated initially, just like creating puppets is gated. It’s a realm-wide thing so it’s reasonable to have an admin command to assign bot names.
Functionality wise, when the user has a command e.g. inv
registered to a bot, whenever someone does !inv look Alice
the bot character in question receives a botrequestmessage
that includes:
- command name (
inv
) - command args (
look Alice
) - sender character id
- sender character’s originating room
The bot then should be able to reply to the user with a botreplymessage
. It will be displayed in the UI just like messages do but without the username writes
prefix, distinguising them as bot messages in the chrome title instead.
This already allows for interactivity within a room, as users will be able to see customized actions based on what they do. But to make it better, the botreplymessage
could be also sent to the room. Privacy-wise, it must be the room of the character the request came from, and it could expire just like the summons expire. It would still display with a similar chrome to distinguish it as a bot-generated message but it will allow publicly-visible actions. It pretty much covers 70% of what people would care about.
To get to 90%, the bot should be able to force-teleport requesters. With instance rooms that allows for endless flexibility.
All that is generally much easier done than the full-brown scripting as it leaves the complex bits to the bot owners. Mucklet side it’s just a couple new commands that don’t differ much from messages.
edit: but far, what if there’s a dozen bots wanting to use a look
or use
or pay
command?
Yeah, bummer, is it first come first served? Without knowing how to distinguish on the rest of the arguments it’d be extremely hard to make it work.
Luckily, there’s a solution – delegate! If you give out a very broad bot verb (like use
), the bot author must do their best to accommodate its widest use (not unlike builders deciding which areas get the top level treatment). For that to work, you’ll need a botforwardmessage
that one bot (registered for the use
command) will send to another bot (that knows how to handle the use that lever
command specifically. By sending it via a dedicated command you transfer all the permissions to get the room details / reply along.