I’m trying to change the default message when the player attempts to smash something, but running into problems. First of all, I tried
[code]“test” by David Whyld
Cell is a room. “A room.”
Chair is in Cell. “A chair.”
Instead of smashing chair, say “No.”[/code]
but this won’t compile at all and tells me that
So then I added
[code]“test” by David Whyld
Cell is a room. “A room.”
Chair is in Cell. “A chair.”
Understand the command “smashing” as something new. Understand “smash [something]” as smashing. Smashing is an action applying to one thing.
Instead of smashing chair, say “No.”[/code]
which compiles, but when attempting to smash the chair, I’m told
I’m sure what I’m doing wrong is something really basic but I can’t seem to figure out what it might be.
You almost got it, but in your improved version, you slipped up by having “smashing” as the command, rather than just “smash”.
Blecki
June 25, 2013, 11:04am
3
The action you want is ‘attacking’, which will catch a variety of verbs including ‘smash’.
Your last example doesn’t work because you’ve understood “smashing” as a new command but then defined grammar for “smash”. So the old smash grammar still holds. Smashing is an adjective anyway.
Thanks. I knew it would be something really obvious like that.
Now works like a treat
The “actions” in-game command is useful for stuff like this. If you compile a game with a chair and type
Actions
it will list every action that you’re trying. So when you go on to type
Smash chair
it’ll print “[attacking the chair]” before giving you the “Violence isn’t the answer” response. So that tells you that the action name is attacking.
The “Commands A-Z” part of the index can also tell you this.
Ooh, handy. I only knew about “rules on/off,” which spews out a lot more (but is helpful for more detailed errors.) It’s good to have different levels of scope.