Hey! So this has been very enlightening, and am glad this is a Topic one can pull up for reference as I too wish to create some new travel actions in TADS while sticking with TADS rather than LITE. I think Dreyab’s LITE example mentioned earlier does a great job at how one would accomplish this on that platform.
I try to replicate working code in order to ensure I know how it works. I also think that a basic template for creating a new Travel Action would be greatly beneficial I just cant seem to get the mechanics down. Now I’ve run into a problem, I’ve used this code to try and make a LEAP command, instead of CRAWL. But every time I try to (Leap) it quits the game and points me at this
/* create an instance of the desired action class */
action = actionClass.createActionInstance();
So i think both TadsLite and Tads code on this page has somewhat confuzzled me, even though its good to have both in the same topics for easier reference. I was hoping to get it fleshed out so it can be of best benefit to the readers(and meself of course)
This is the code I’m using, Basically trying to leap off of a ledge in sOutp and land in the location ssOutp.
[code]sOutp: OutdoorRoom ‘south outpost’ ‘South Outpost Location’
'The location you find yourself in is ’
north = cPost
east = seOutp
west = swOutp
south = endLedge
;
endLedge: TravelBarrier
canTravelerPass(actor, connector)
{
return gActionIs(Leap);
}
explainTravelBarrier(actor, connector)
{
"The ledge drops off suddenly, you'll need to <b>LEAP</b> in order to make it down. ";
}
;[/code]
Then I did a copy/alteration of the Crawl-Code to basically incorporate Leap. which ought to work, I think.
[code]DefineAction(Leap, TravelAction)
execAction()
{
local conn;
if ((conn = getConnector()) != nil)
{
replaceAction(LeapVia, conn);
}
else
{
mainReport(&cannotGoThatWayMsg);
}
}
;
VerbRule(Leap)
‘leap’ singleDir
: LeapAction
verbPhrase = ‘leap/leaping’ + dirMatch.dir.name
;
DefineTAction(leapVia)
getCurrentObjects = []
;
modify TravelConnector
{
dobjFor(leapVia)
{
preCond()
{
return gActor.getTraveler(self).travelerPreCond(self)
+ gActor.location.roomTravelPreCond()
+ connectorTravelPreCond();
}
verify()
{
}
check()
{
local t = gActor.getTraveler(self);
local dest;
dest = getDestination(t.location, t);
gActor.checkDarkTravel(dest, self);
checkTravelBarriers(dest);
}
action()
{
local t = gActor.getTraveler(self);
local dest;
dest = getDestination(t.location, t);
gActor.travelTo(dest, self, connectorBack(t, dest));
}
}
}
;[/code]
I think I’m pretty close, but could use help to figure out how to spark this to life. Currently, South says I can’t go that way(Instead of the ledge scroll) LEAP says it doesn’t understand the command(Maybe we should have it say, “Leap which direction?”) and LEAP S keeps crashing the game and telling me I need to make a new instance of the ActionClass.
Any assistance would be of great benefit, and I’ll try and make sure there’s a finished template at the end of this which has the basics down, and pointing to where the (Crawl/Leap) code is, which can be changed to (Phase-through/roll/squeeze for maneuvering, or DART through for example if a winged character was flying and was trying to expertly fly through a tightly enclosed space for example.