Overriding "south" or "se" commands.

Hi,

i’d like to override commands such as “e” or “up”. I want to avoid to write new instead rules, and use new “Understand…” statements instead. I already tried:

Understand “[direction]” as walking when the player is in a transition room.

with no success.

Can you post a larger bit of code? That might make it easier to understand whether the problem is with your “when” clause or something else. (One thing I’d try, looking just at what you’ve posted, is changing “when the player is in” to “if the location is.”)

Also, you probably want to intercept things like “go east” as well.

[code]Walking is an action applying to one visible thing.
[Understand the command “walk” as something new.] [commented out because i need that the command"walk" is understood as “go” when the player is in a “normal room” which is implemented by default. See the going action]
Understand “walk” as walking when the player is in a transition room.

Carry out walking:
[it is assumed that we are in a transition room][Indeed the walking action is called by the command “walk/walk [direction]” which is understood as the command “go” when the player is in a normal room]
unless the noun is the nowhere direction:
change the current direction of the player to the noun;
change the speed of the player to 1.2 m/s;
else:
say “Où veux tu aller ?”;

[STOPPING (walking)]

Stopping is an action applying to nothing.
Understand “stop” as stopping;
Carry out stopping when the player is in a transition room:
change the speed of the player to 0 m/s;
[TODO enregistrer un ae qui si le jouer s’est arrêté plus de 3 minutes, le force à préciser la direction lorsqu’il va vouloir bouger]

[GOING]
Understand “go” as walking when the player is in a transition room.
Understand “go [direction]” as walking when the player is in a transition room.
Understand “[direction]” as walking when the player is in a transition room. [doesn’t work][/code]

There is also a rulebook listed in the Glulx Timed Activity Rulebook that
a) updates the position of the player (a length) in the location when the location is a transition room.
b) tries the going action when the player reaches the limits of the transition room.

Thus if I want b to work i should not write a rule like
Instead of going when the actor is in a transition room
otherwise i wouldn’t be able to reproduce the behavior of the going action when the actor is in a transition room.

P.S.: this is all about real time
this is just a draft

I’ve just tried to add
Understand the command “[direction]” as something new
to my code and it has no effect.

There is no lines matching
Understand the command “[direction]”…
or
Understand “[direction]”…
in the standard rules
so my guess is that’s it’s parsed unconventionally, at the parser level or something. I haven’t been able to locate it.

It seems that the only thing walking does is changing the speed of the player: it’s still a matter of going from one room to another in the specified direction, only the player is faster in a transition room.

One way to achieve that result might be by adding check and carry out rules to the existing going action, something along these lines:

[code]Check an actor going (this is the walk faster in transition rooms rule):
if the room gone from is a transition room:
now the speed of the player is 1.2 m/s.

Carry out going (this is the slowing down after transition rule):
if the room gone to is not a transition room:
now the speed of the player is 0.6 m/s.[/code]

‘Room gone from’ and ‘room gone to’ are variables declared for the going action by the Standard Rules.

I haven’t actually tested any of this, so I won’t vouch for its feasibility; but, if it works, it might save you from having to override one of the more complicated actions defined in the Standard Rules (an attempt of course not unlikely to give rise to loads of bugs).

That’s how it looks to me, too – I’m pretty far out of my depth here, anyway.

I changed your code a little so I could get it to compile to z-code on my Inform, and I noticed that “walk north” didn’t seem to be responding properly either. It should set you walking north, it seems, but for me it got “Où veux tu aller ?” I changed the relevant paragraph to this:

Carry out walking a direction (called the destination): [it is assumed that we are in a transition room][Indeed the walking action is called by the command "walk/walk [direction]" which is understood as the command "go" when the player is in a normal room] if the destination is a direction: change the current direction of the player to the noun; change the speed of the player to 1; say "Going [current direction of the player] at [the speed of the player] m/s."; else: say "Où veux tu aller ?";

and it worked, though it never falls through to “Où veux tu aller ?”; it looks like that can be fixed with this, though:

Rule for supplying a missing noun when walking: say "Où veux tu aller ?".

Anyway, this is all very much trial-and-error hackery on my part.

Felse, in my current design your solution wouldn’t work as each decisecond the Real Time Engine (huh huh curls mustache) updates then checks the position of the player within the transition room. If it ever happens that the player is out of the transition room’s bounds, then it “try going (current direction of the player)”. Consequently, as the player is still in a transition room it would call “Carry out going when the player is in a transition room rule” (or rather the instead of going… rule) whereas we to go through the standard going action.

Now that i’m re-reading your post it seems you haven’t understood what i’m trying to achieve. I’d like to make a real time IF. I decided that the simpler way to achieve this is to create unidimensional rooms the player would use to go from crossroads to crossroads. Thus when you’re in a transition room, the going action, that immediately moves the actor from a room to another should not be accessible to the player. It is instead replaced by the walking action, that will lead the player to one of the rooms end. The engine takes care of making the actor go from one room to another.

Also matt, the piece of code i shared wasn’t functional. I do have a “Rule for supplying a missing noun when walking”, but i pruned it off my source code after copy/pasting it here so as keep things simple.
And yes, my system requires Glulx (gluxl?) to work.

Cool about the “rule for supplying a missing noun” – I realized it wasn’t functional and figured you needed glulx for the real-time stuff as well as the pace. I just added a room or two to test it, and noticed that “walk north” and “go north” weren’t working as intended. They’re working for you? (It may be that I’m using an old version of Inform.)

This is probably an inane reply, but if I understand you correctly, you might try something like I did for abolishing compass directions (even though I know that the way I did it is messy and probably in a to-be-avoided list).

After reading a command (this is the no compass rule): if the player's command matches "s/south/n/north/east/e/w/west/nw/northwest/ne/northeast/sw/southwest/se/southeast", say "You have no use for compasses." instead; if the player's command matches "go s/south/n/north/east/e/w/west/nw/northwest/ne/northeast/sw/southwest/se/southeast", say "You have no use for compasses." instead; if the player's command matches "go to s/south/n/north/east/e/w/west/nw/northwest/ne/northeast/sw/southwest/se/southeast", say "You have no use for compasses." instead; if the player's command matches "go to the s/south/n/north/east/e/w/west/nw/northwest/ne/northeast/sw/southwest/se/southeast", say "You have no use for compasses." instead; if the player's command matches "north east/west/-east/-west", say "You have no use for compasses." instead; if the player's command matches "south east/west/-east/-west", say "You have no use for compasses." instead.

With these, I have abolished the player’s ability to use compass directions, but internally I can still use them - they just need different trigger-words, which worked a beaut with Aaron Reed’s keyword extension. It’s as good a starting point as any.

To be honest, I got lost very quickly in this thread, but I think I adressed (or tried to) the issue in the first post… if not, apologies.

Thanks peter i’ve been able to build something that fixes my problem

After reading a command when the player is in a transition room:
	if the player's command matches "[direction]":
		change the text of the player's command to "walk [player's command]";

you can actually use [direction] instead of “s/south/n/north…”.

I’m still wondering how the direction commands are implemented in the Standard Rules…

Ah, I see. In my particular case I couldn’t use [direction], I think - I believe it was because I was using stuff like <Understand “shore” as west when the location is At Sea>, in which case the [direction] keyword was too efficient for my purposes. Still, that’s certainly a great deal more elegant than what i came up with, and I’ll keep it in mind for future reference, so thanks. :slight_smile:

The direction commands are parsed directly (at I6 level) in the paragraph “Parser Letter B” in “Parser.i6t”. If the first word is not a verb, the parser takes it for a direction (before checking whether some is being addressed). The current action and all the related variables are set to the action ##Go which is the counterpart of the going action.

ah thanks that explains everything then.