With apologies of what is probably a really simple question, is there a way of defining alternative words for going in a direction, for example “crawl west” and still be able to trap a crawl command? Thanks.
See WWI 17.2 New commands for old grammar.
Understand "crawl [direction]" as going.
Understand the command "crawl" as "go".
The difference is that the second version will automatically inherit all of the same grammar as the word “go”, so that, for example, >CRAWL ALCOVE would result in trying to enter the alcove.
Thanks for your time and your help, that moves things on a bit.
What I should have asked more clearly is whether there is a way to recognise the input as “crawl [direction]” and respond to it as if it was a new action. I was looking for something like “Crawling is an action applying to a direction.” (which I know isn’t valid) so that I could then test the direction, the location going to or from and so on, and prevent unnecessary crawling. The scenario is that I only want the player to crawl between specific locations and nowhere else. Sorry that wasn’t clear from the original question. Thanks.
You can just define crawling as an action applying to one visible thing, then use the Understand statement as @otistdog laid out above. Then you can write rules for the new crawling action - your carry our rule will probably involve “try going the noun” to actually move the player.
(Since you’re not inheriting the full “go” grammar you might want to also customize responses in cases where the player does stuff like just types “crawl”)
Generalising, what you want is an “horizontal”, so to speak, version of CLIMB, I’m correct ?
Best regards from Italy,
When you say trapping, I assume you mean “I’d like to reserve crawling for specific areas?”
To follow up on @DeusIrae’s suggestion … here is roughly what code I’d use. Take/reject what you like. I never compiled it. You’d need to add
understand "crawl [one visible thing]" as crawlthinging if you want to CRAWL (INTO) SCENERY or even CRAWL (INTO) (specific room name).
But I think getting CRAWL [DIRECTION] would be best to start. One potential issue with “one visible thing” syntax is that you might get disambiguation requests of two similarly-named things in very different rooms.
a room can be crawlable. a room is usually not crawlable. crawling is an action applying to one direction. Understand "crawl [direction]" as crawling. carry out crawling: let go-room be the room noun of the location of player; if go-room is not crawlable: say "No need to crawl [noun][if go-room is visited] to [go-room]. You can just walk [noun]."; try going noun instead; [crawling logic for crawlable e.g. if the player carries more than two things, say "You can't crawl carrying that much. Get rid of some items first!" instead; ]
Thanks @Piergiorgio_d_errico yes that’s pretty much it.
Hi @aschultz that’s great. I’ll have a play with it when I get home later. Very grateful.
You generally want such a definition anyway. Even if you don’t want to support CRAWL SCENERY, it’s better to display an appropriate error. (Maybe even “Try CRAWL DIRECTION.”) If you fail to recognize it entirely, the parser will say “That noun did not make sense in this context,” which is generic and unenlightening.
You don’t need to say “visible” in an understand line, by the way. It’s assumed and it just slows down the parser.
Understand "crawl [something]" as ...
This doesn’t actually work. Gotta be “one visible thing”.
Thank you everyone and now including @zarf . This is where I’ve ended up. I’m sure there is a more elegant way to deal with this but it compiles and does what I wanted. I’ve stolen @aschultz crawlable room (thanks) to limit crawling to a couple of locations. I’ve added an additional action to make it clear that a direction is required. Without this, I’m sure the message “what do you want me to crawl” could have been replaced with “where do you want me to crawl” but I couldn’t find a way to replace the default easily. Elsewhere I’ve stopped the play “going” where I want them to crawl. The Thorn Gap is a secret door that must be open.
Precrawling is an action applying to nothing. Understand "crawl" as precrawling. Check precrawling: say "In which direction do you want me to crawl?" instead. Crawling is an action applying to one visible thing. Understand "crawl [something]" as crawling. Check crawling: If the location is not crawlable: say "This is not the sort of place to grovel in the dirt." instead; If the location is F5: If the noun is west: if Thorn Gap is closed: say "The thorns stop you crawling that way." instead; else: Say "You drop to your knees and wriggle through the thorns to find yourself in ..."; move the player to F6; say "You stand up and brush off the dirt." instead; say "There is no need to crawl in that direction." instead; If the location is F6: If the noun is east: If Thorn Gap is closed: say "The thorns stop you crawling out of the stockade." instead; else: say "You drop to your knees and wriggle through the thorns to find yourself in ..."; move the player to F5; say "You stand up and brush off the dirt." instead; say "There is no need to crawl in that direction." instead.