I’m trying to use a CollectiveGroup to handle an action with a count and I’m obviously missing something.
Below is a simple but complete (as in compile-able) example. In it the player gets three pebbles. The game defines the new verb “stack”.
What I want, in this example, is for the player to be able to do something like “stack 3 pebbles”. The player has three pebbles, but the game reports “You don’t see that many pebbles here.” I assume that’s because the CollectiveGroup is handling the action (which I want), but then because there’s only one CollectiveGroup it throws an error because the command has a count.
Without the CollectiveGroup it works, but produces a line of output for each individual pebble, which I don’t want: I want to be able to handle the action in the CollectiveGroup and display a summary of stacking however many pebbles in total, rather than displaying a message for each individual one added to the stack.
Of course the game logic in the example doesn’t actually do anything, I’m just trying to figure out the parsing problem here.
I assume I’m missing something obvious here, but I haven’t been able to figure it out from the documentation.
#charset "us-ascii"
#include <adv3.h>
#include <en_us.h>
DefineTAction(Stack);
VerbRule(Stack) 'stack' dobjList : StackAction
verbPhrase = 'stack/stacking (what)'
;
modify Thing
dobjFor(Stack) {
verify() {
illogical('{You/he} can\'t stack {that dobj/him}. ');
}
}
;
pebble: Thing 'round pebble*pebbles' 'round pebble'
"A round pebble. "
isEquivalent = true
collectiveGroups = [ pebbleCollective ]
listWith = [ pebbleList ]
dobjFor(Stack) {
verify() {}
action() { say('Individual stack. '); }
}
;
pebbleList: ListGroupEquivalent
;
pebbleCollective: CollectiveGroup 'bunch pebble*pebbles' 'bunch of pebbles'
"A bunch of pebbles. "
isPlural = true
isCollectiveAction(action, whichObj) { return(true); }
isCollectiveQuant(np, reqNum) {
return((reqNum == nil) || (reqNum > 1));
}
dobjFor(Stack) {
verify() {}
action() { say('Collective stack. '); }
}
;
startRoom: Room 'Featureless Void'
"This is a room, more or less. "
;
me: Actor
location = startRoom
;
+ pebble;
+ pebble;
+ pebble;
versionInfo: GameID
name = 'sample'
byline = 'nobody'
authorEmail = 'nobody <foo@bar.com>'
desc = '[This space intentionally left blank]'
version = '1.0'
IFID = '12345'
;
gameMain: GameMainDef
initialPlayerChar = me
;