Edit 2: Solved my own problem!
I added a “type” property to the Powder class. See new Doer below. I wanted the PC to use the SmellDesc to guess which powder was which. Once they pour it into the cabinet. The true powder name is revealed.
Doer 'pour Powder in funnel'
execAction(c){
local powder = mugwortPowder.isIn(gPlayerChar) ? mugwortPowder: permafrostPowder.isIn(gPlayerChar) ? permafrostPowder : volcanoAsh;
"You pour the <<powder.name>> into the funnel. ";
powder.moveInto(potionCabinet);
potionCabinet.hasPowder = true;
potionCabinet.powderName = powder.type; //This is the actual name of the powder.
}
where = cabinetRoom;
;
****
Hello, I have a Powder class and a Pouch class. The Powder objects are hidden in the Pouch objects. I would like the Powder objects to be poured out of the pouch. I tried writing a Doer for this, but the action isn’t working as expected. As always, thank you for any help.
EDIT: I changed the Doer and the powder is now in the cabinet. The issue is I don’t know which powder. I need to know which powder because it has to match a recipe found elsewhere.
Doer 'pour Powder in funnel'
execAction(c){
local powder = mugwortPowder.isIn(gPlayerChar) ? mugwortPowder: permafrostPowder.isIn(gPlayerChar) ? permafrostPowder : volcanoAsh;
"You pour the <<powder.name>> into the funnel. ";
powder.moveInto(potionCabinet);
potionCabinet.hasPowder = true;
}
where = cabinetRoom;
;
pouch1: Pouch 'tan +'
"The tan pouch contains a grey powder with a faint, mineral-rich scent. "
hiddenIn=[permafrostPowder]
;
permafrostPowder: Powder 'grey +'
"An stinky, organic smelling grey powder. "
smellDesc="The powder has a salty, prehistoric odor about it. "
type='permafrost powder'
;
pouch2: Pouch 'brown +'
"The brown pouch contains a dark, fine but gritty powder with a familiar scent. "
hiddenIn=[volcanoAsh]
;
volcanoAsh: Powder 'dark +'
"A dark, fine but gritty powder. The aroma is reminiscent of campfires. "
smellDesc="The ashy powder has a molten earth and charred wood odor. "
type='volcano ash'
;
pouch3: Pouch 'white +'
"The white pouch contains a strong smelling, fine, dark green powder. "
hiddenIn=[mugwortPowder]
;
mugwortPowder: Powder 'green +'
"A green powder with an earthy aroma. "
smellDesc="The powder has a pleasant, and musky albeit medicinal fragrance. "
type = 'mugwort powder'
;
pouchGroup: CollectiveGroup 'pouches' @niche
"The pouches are made from animal hides. One is brown, one is tan, and one is bleached white. "
;
//Pouch class
class Pouch: Container 'pouch' @niche
isListed = nil
bulk = 1
dobjFor(Take) {
action() {
inherited();
"You lift <<theName>> from the shelf. ";
isListed = true;
}
}
collectiveGroups = [pouchGroup]
;
powderGroup: CollectiveGroup 'powders'
"Powders ground from various elements. "
;
//Powder class
class Powder: Thing 'powder'
isPourable = true
collectiveGroups = [powderGroup]
;