Replacing "You can't go that way."

I feel like this is the most obvious question in the world, so I apologize if it’s been asked a million times before, but I’ve done a fair amount of googling and searching within this forum and I haven’t been able to find quite what I need.

All I want to do is change the wording of the default “You can’t go that way.” message. I don’t want to change anything about the circumstances under which it appears; I just want it phrased differently. I thought I could do this with:

Instead of going nowhere, say "something something."

But that has additional undesired effects, i.e. if the player tries to go through a closed door, he just gets “something something” instead of automatically trying to open it or getting a message that there’s a door in the way.

I then thought I could use Custom Library Messages to replace the message itself, but its documentation suggested that it’s overkill for what I want to do and I should probably just use the more lightweight extension “Default Messages,” which I looked up and found that it’s no longer supported and has been replaced by “English,” which had no documentation. When I got to the point where the Inform 7 documentation was telling me I should make a copy of English and put it into place using I6 template hacking, I figured I should probably take a step back and see what the forum suggests is actually the best way to do this.

The simplest thing to do, I think, would be to replace the can’t go that way rule.

Here’s the original thing in the Standard Rules:

Check an actor going (this is the can't go that way rule):
  if the room gone to is nothing:
    if the door gone through is nothing, stop the action with library message going action number 2 for the room gone from;
stop the action with library message going action number 6 for the door gone through;

I think it’s Default Messages by David Fisher that’s out of date; if you want to go the extension route instead of just replacing the you can’t go that way rule, you could use Default Messages by Ron Newcomb.

ETA 2: I also think that the “English” extension that the document for David Fisher’s extension mentions isn’t the current extension, but one that will be in an Inform Release Yet To Come.

Ah, how very confusing. Thanks; Default Messages by Ron Newcomb looks like it will do what I need if I don’t end up just replacing the rule.

Which rulebook is the can’t go that way rule in, or more importantly, how can I find out that information for myself?

[Edit: I managed to find out by telling the Inform IDE to unlist it for me.]

I tried replacing it with:

Check an actor going (this is the revised can't go that way rule): if the room gone to is nothing: if the door gone through is nothing: say "something something."; stop the action; stop the action with library message going action number 6 for the door gone through;
… but now I just get

whenever I try to go anywhere. So I think I’m probably just going to give up and use Default Messages.

The bottom line (“stop the action with library message…”) should be one tab stop deeper; as it is, it triggers whenever you try to go in any direction (unless “something something” has triggered, stopping the action).

Yeah, sorry, I just typed that out from a different computer rather than copy/pasting, which of course messed up the tabs. (I generally use begin/end rather than tabs, for just this sort of reason.)

Try this.

[code]“Test”

Check going (this is the new can’t go that way rule):
if the room gone to is nothing, say “You channel your will power to summon a path in that direction. Sadly, nothing happens: you can’t go that way.” instead.

The new can’t go that way rule is listed instead of the can’t go that way rule in the check going rulebook.

The Testing Room is A Room. The testing door is a door. The Testing Door is north of The Testing Room.

Test me with “n / s”.[/code]

Replacing the standard is the most efficient way of changing the message here. The standard rule is a little more complex in order to give a different message when there is a door leading to nowhere rather than just a blank connection. I’ve actually done this replacement in games I’ve written as I find that the default message is not very helpful, although I replace this message with an exit listing so the player knows which exits are valid.

I find that it’s easier to see when something begins and something ends using the begin/end syntax.

As a C++ programmer who has barely any experience with Python… I prefer the Pythonesque syntax because “begin” and “end” are just too long and ugly.

On topic: You don’t need to replace the rule if you use the extension. They are alternative ways of doing (basically) the same thing.

Agreed.

I know, but the extension also includes a lot of other stuff I don’t need, and I’m trying to be economical here. (Yes, I realize that’s a somewhat ridiculous thing to worry about when writing a text adventure in this day and age.)

Actually, I am quite familiar with C++ programming which is where my preference for the begin/end syntax originates from.

Actually, if you’re looking to write a game in z-code rather than glulx then it is something you might want to consider. If you just want to replace the default message with another simple message and you don’t mind pushing into glulx then using the extension is probably best. However, if you want to stick to z-code or display a complex message (such as an exit listing) then I’d suggest replacing the default rule.

Hope this helps.

I’m not sure what changed, but I’m now getting nine copies of the ‘[** Programming error: tried to test “has” or “hasnt” of nothing **]’ message every time I use the “gonear” testing command. I can’t tell where it’s coming from – I turned on rules and actions, but the errors appear immediately after entering the command, before any of the rules messages are printed. Commenting out all the stuff where I replaced that rule doesn’t seem to make any difference either. It doesn’t happen when I go in a direction the normal way, just gonear.

Any ideas?

Never mind, I found it. It was totally unrelated. (I had changed a piece of scenery into a backdrop, but I had a rule to understand some stuff as it when in the location of it, which I guess confused it because backdrops aren’t in a location.)

I took a look at the underlying I6, and I agree with your assessment, although I’m very much not an I6 guru.
I would expect this to happen if the noun was any of the following:

  • Neither a (kind of) thing nor a (kind of) room
  • A backdrop

IMHO there ought to be a check for GONEAR’ing one of those. As-is, it doesn’t even do XTestMove (and PlayerTo doesn’t appear to have much in the way of error handling). Maybe there’s a good reason for skipping XTestMove, but since it allows you to ABSTRACT ME TO whatever, it can’t be that big a deal (yes, I know you’re not supposed to ABSTRACT the player object, but frankly it’s a lot more flexible than GONEAR (which is probably why you’re not supposed to do it)).

EDIT: Scratch that, I don’t know what I’m talking about. It’s probably to do with your understand line.

In the words of Firesign Theater, how can you be in two places at once when you’re not anywhere at all?

Robert Rothman