Hello! I am fairly new to Tads, but I’m getting the hang of it. I’m currently attempting to create a simple watering action in relation to a plant. The code functions properly, but then I add
if(gDobj == Pothos)
to the mix, and suddenly it stops working. I assume that I made an error somewhere along creating the new action, but I’m not sure where. I’d like a gDobj function added to the code so that I can add more plants to the watering action later down the road. I also attempted a dobjFor(Water) string beneath the Pothos object so that I didn’t have to use gDobj, but that did not function either. Here is my code:
DefineIAction(Water)
execAction()
{
if(WaterCan.isHeldBy(me))
{
if(gDobj == Pothos)
{
if(Pothos.CurrentSaturation == 'Dry')
{
" You saturate the soil with the watering can. ";
Pothos.CurrentSaturation = 'Wet';
Water.awardPoints();
StartPothosMoist(); //*My fuse for plant drying out, appears to work*//
exit;
}
else if(Pothos.CurrentSaturation != 'Dry')
{
" This plant does not need water at this time. ";
exit;
}
}
}
else if(!WaterCan.isHeldBy(me))
{
" You need a watering can to do this. ";
exit;
}
}
Water : Achievement { +5 "Points. <.p> You've watered a plant. " }
;
VerbRule(Water)
('water' | 'saturate' | 'douse') singleDobj
: WaterAction
verbPhrase = 'water/watering (what)'
;