I’ve made a start on the problem of asking multiple actors to do something, brought up by Endosphere here. The solution is awkward at the level of interaction; instead of just typing in “poet and waldo, north” or “all robots, north,” I have the player type “folks, north”; the game then asks who they want to do that. And there are other problems, after the spoiler-tagged code.
[spoiler][code]“Multiple Requests” by Matt Weiner
[Allows the player to make requests of multiple agents at once, using a two-part command. First the player types “folks, do something”; then the game asks exactly who should do it.]
Part I - Folks
[We need to set up the invisible omnipresent agent, folks, who receives all multirequests.]
Dummybackdrop is a privately-named backdrop. Dummybackdrop is everywhere. A person called folks is part of dummybackdrop. [So folks is everywhere.]
Rule for deciding whether all includes folks: it does not. Rule for deciding whether all includes Dummybackdrop: it does not. [we don’t want folks or dummybackdrop ever to show up in the list of actors asked, or in anything else, really]
A robot is a kind of person. Understand “robot” as a robot. Understand “robots” as the plural of a robot. [Not strictly part of folks’ definition, but…]
Instead of doing something when folks is the noun or folks is the second noun: say “‘Folks’ is used only to ask multiple agents to do something. Currently available folks are: [list of visible robots].” [Of course this assumes that you can ask robots to do things, and no one else. In a fuller implementation this would invoke a list of visible people you can ask to do stuff…]
After deciding the scope of folks:
repeat with avatar running through visible things:
place avatar in scope. [otherwise folks won’t be able to do much, because most things aren’t in scope for an actor who’s part of a backdrop, I don’t think]
[After deciding the scope of the player:
repeat with avatar running through on-stage robots:
place avatar in scope;
place folks in scope. [this rule would be used if we wanted to allow youto command robots from anywhere]]
Part II - Multi-Requests
Folks-action is a stored action that varies.
Before folks doing something (this is the redirect folks’ action rule):
now folks-action is the current action;
change the command prompt to “Who do you want to do that?”;
rule succeeds. [We need the rule to succeed so we don’t get an “unsuccessful attempt by folks” rule.]
The redirect folks’ action rule is listed first in the before rulebook. [It needs to happen before absolutely anything else gets in the way.]
Gathering the actors is an action applying to one visible thing.
Understand “[things]” as gathering the actors when the command prompt is “Who do you want to do that?”. [So it accepts a list of actors without any verb.]
Carry out gathering the actors:
now the command prompt is “>”;
if the noun is not a person:
say “You can’t ask [the noun] to do anything.”; [this should probably be a library message]
convert to request of the noun to perform the action name part of folks-action with the noun part of folks-action and the second noun part of folks-action.
[And you can’t do anything else when you’re supposed to be gathering the actors.]
Instead of doing anything other than gathering the actors when the command prompt is “Who do you want to do that?”:
say “That isn’t a list of actors.”; [This is a really awful error message.]
now the command prompt is “>”.
Rule for printing a parser error when the command prompt is “Who do you want to do that?”:
say “That isn’t a list of actors.”;
now the command prompt is “>”.
Part III - Scenario
The Command Center is a room.
A persuasion rule: persuasion succeeds.
Auda, Iris, Sensa, Waldo, Whiz, and Poet are robots in the command center.
A marble is in the command center. The box is a container in the command center.
A leaflet is a kind of thing. Six leaflets are in the command center.
A room called the Weather Monitors is west of the command center.
A room called the Transit Monitors is south of the command center.
A room called the Hydroponics Monitors is east of the command center.
Instead of an actor kissing Iris:
say “Iris slaps [the actor].”;
Instead of Waldo kissing Iris:
say “Iris says, ‘oh you!’”;
Test me with “folks, kiss iris/poet and waldo/ auda, get marble/ folks, put marble in box/all robots/whiz, get marble/folks, put marble in box/all robots/auda, get leaflet/iris, get leaflet/poet, get leaflet/folks, put leaflet in box/auda and iris and poet and sensa/folks, drop leaflet/all robots”.[/code][/spoiler]
OK, some problems that are particularly obvious if you type “actions” before testing:
The actions are sequential rather than simultaneous, and that can have weird effects. You noticed how all the robots succeeded in putting the marble in the box? That’s because, after Auda took the marble, the rest all silently picked it up and put it back in the box. That’s not great.
Choice of identical objects is even less great. When you ask all the robots to pick up a leaflet, they all try to pick up the same leaflet. So only one succeeds. I don’t know that this is entirely my fault – I think Inform should default to asking someone to pick up something not held by another person, if possible – but it’s there. Then, of course, when some of them have leaflets and you ask them all to put the leaflet in the box, the first one puts her leaflet in the box, and the rest pick up that very leaflet and put it back in the box, even if they have one of their own. And if you ask them all to drop a leaflet, the robots after the first one try to drop the same leaflet even if they’ve got one of their own. Again, I think that’s partly a bad decision by Inform (how can a request to drop something not default to something held by the actor?), but it’s still not great. [EDIT: No wait, this is entirely my fault. Folks-action selects a leaflet as a noun, and then my convert to request forces every robot to act on that same leaflet. I definitely need some trickery if I want this to work better.]
Text handling seems pretty messed up. If you try “folks, say yes to iris/auda and poet”, then Auda and Poet wind up answering Iris that “et”. But if you try “folks, say yes to iris/all robots” they answer Iris that “yes,” as they ought. Some parts of strings seem to be getting overwritten by other parts of strings in a way that they oughtn’t.
This still uses the “person, foo” syntax. I hate that syntax. Also, the two-part command stuff is not at all elegant. (It was inspired by Scott Adams’s method for getting two nouns and a verb out of a two-word parser.)
But it does execute some multiple requests, and maybe it’ll inspire someone (or even me) to get something better going. And it didn’t even require any I6!