I have (finally and with lots of help from you folks) made my multiple object action for combining things work…
kitchen
You can see Bob and three apples here.
>combine 3 apples
You combined an apple, an apple and an apple and made an applesauce!
>look
kitchen
You can see an applesauce and Bob here.
… but it only works for the player. When I try to instruct an NPC to use it, the results are not right.
kitchen
You can see Bob and three apples here.
>bob, combine 3 apples
apple: apple: apple: >look
kitchen
You can see Bob and three apples here.
I tried looking in the documentation and the standard rules, but I haven’t figured it out yet.
There is a lot of stuff here, sorry it’s so much but this is a very complicated action. You will also need https://github.com/i7/extensions/blob/master/Brady%20Garvin/Object%20Kinds.i7x
Include Object Kinds by Brady Garvin.
Combining is an action applying to one thing. Understand "combine [things]" as combining.
The announce items from multiple object lists rule does nothing when combining.
Combining-valid-items is initially false.
Combining-items is initially false.
Combining-success is initially false.
Every turn while combining-valid-items is true or combining-items is true or combining-success is true:
now combining-valid-items is false;
now combining-items is false;
now combining-success is false;
Before combining: if combining-items is true, stop the action.
The combining action has a list of objects called L.
The combining action has a list of texts called text-L.
The combining action has a table name called combining-table.
Table of No-Combinations
components list result
{"nothing"} "nothing"
Setting action variables for combining:
now combining-table is table of no-combinations;
now L is the multiple object list;
repeat with text-shunt running through L:
add "[the singular of the object kind of text-shunt]" to text-L;
sort text-L;
Carry out combining when combining-valid-items is true (this is the combining main rule):
now combining-items is true;
repeat through combining-table:
let x be a list of texts;
now x is the components list entry;
sort x;
if text-L is x:
now combining-success is true;
repeat with y running through things in the prop-room:
if "[the singular of the object kind of y]" exactly matches the text "[result entry]", case-insensitively:
now y is in the location;
say "[The actor] combined [L with indefinite articles] and made [a y]!";
repeat with used running through L:
now used is in the prop-room;
break;
break;
Carry out combining (this is the combining invalid items rule):
if combining-success is false:
now combining-items is true;
The combining invalid items rule is listed last in the carry out combining rulebook.
Report combining something (this is the report combining failure rule):
if combining-success is false:
if combining-items is true:
say "The interaction between the cosmos and [regarding the actor][possessive] will is over-extended for producing that result in the current timeframe of [regarding the actor][possessive] existence.[paragraph break]";
otherwise:
if the multiple object list is empty:
say "A combination requires a minimum of two things. Note that using the plural form of a noun is not sufficient. You must specify the quantity in a specific syntax, as in 'combine 3 apples' or 'combine 2 apples and 1 pear,' not simply 'combine apples' or 'combine apples and pears.'";
otherwise:
say "[The actor] can't seem to find a useful way to combine [L with indefinite articles].[paragraph break]";
stop the action;
First every turn:
now combining-valid-items is false;
now combining-items is false;
now combining-success is false;
The prop-room is a room.
An applesauce is a kind of thing.
1 applesauce is in the prop-room.
The kitchen is a room.
The player is in the kitchen.
Bob is a person in the kitchen.
A persuasion rule:
persuasion succeeds;
An apple is a kind of thing.
3 apple are in the kitchen.
Check an actor combining (this is the combine apples rule):
repeat with x running through L:
if x is an apple:
now combining-valid-items is true;