After an hiatus, I restart my sharing of useful TADS3 routines & tricks:
If some Imp want to railroad a PC (that is, forcing him/her/it/whatever to follow a fixed path thru the map, without deviation, but allowing him/her/etc. to interact with the content of the “stations”) I have creatively cooked this nifty test scene:
// testing the [SPOILER] mechanism in the lf corridor
mwtest: Scene//, EventList
startsWhen = (gLocation == corrN)
endsWhen = (gLocation == corrS)
recurring = nil
whenStarting() {"Testing the [SPOILER] ...";}
whenEnding() {"Testing done. Has worked ???";}
eachTurn() {
if(gActionIs(Travel) && gAction.direction != southDir) {
gActor.getOutermostRoom.lookAroundWithin();
}
}
//preAction(lst) {}
//eventList = []
beforeAction () {
if(gActionIs(Travel) && gAction.direction != southDir) {
"you can only press onward south";
exit;
}
}
finishOff(howEnded) {"That's all, folks !";}
; //mwtest
In the testbed above, the player chan move only in the south direction, but if he/she/&c. wants to examine, take & mess in general with the locations along the path, he can do (and I suspect that is a more elegant solution re. the various *BeforeAction
and *PreAction
)
For more meandering tracks, one needs to check also the PC’s current location and set accordingly the allowed/disallowed directions, but in my current case, there’s only one curve (east) in my railroad…
Best regards from Italy,
dott. Piergiorgio.