Just went through a clumsy, drawn out exercise to implement immobilizing a character. Since it was a verb-by-verb slog, figured I’d ask if anyone else found a more elegant way than brute force. Or if not, offer it up to posterity to save time for someone later. The scenario is being tied up, and maybe gagged. Here is my code:
modify Actor
gagged = nil
immobilized = nil
reachableWhileBound = [] // can override on instantiation or set programmatically
cantMoveMsg = '{You/he} {are} unable to move and cannot. '
cantTalkMsg = '{You/he} {are} unable to speak and cannot. '
beforeAction() {
if ((gActor == self) && immobilized) failCheckImmobilized();
if ((gActor == self) && gagged) failCheckGagged();
inherited;
}
failCheckImmobilized() {
// these actions are ok, especially system actions
// see below for >EXAMINE
//
if ((!gActionIn(Again, Inventory, ListenTo, Look, Sleep, Smell, Wait, System, SenseImplicit))
// conversation ok if only bound
//
&& (!gActionIn(AskVague, TalkTo, TellVague, Yell, ConvTopicT, ConvI))
// uncomment if want to be able to feel bindings or whatever
// could add 'Untie' or other actions here also
//
// && (!gActionIn(Feel) || (reachableWhileBound.indexOf(gDobj) == nil))
// assuming inventory still on actor, and restraints prevent self examine
// would need to make more elaborate if environment is complex
//
&& (!gActionIs(Examine) || gDobj.isIn(self)))
failCheck(cantMoveMsg);
}
// prevent conversation if gagged
//
failCheckGagged() {
if (gActionIn(AskVague, TalkTo, TellVague, Yell, ConvTopicT, ConvI))
failCheck(cantTalkMsg);
}
Obviously, would need to inventory game-specific verbs to add to lists as appropriate. This has been tested let’s say a medium amount, so hoping I’ve wrung out the corner cases.