Throwing all through a window-door

Sometimes I would like to throw all my code out of the window, but today I would keep on on keeping on -as Courtney Barnett says- if anyone can help me to solve this.

I would like to define a special answer for the command “throwing all at/through the window”. I was trying this (in Spanish). I´ve tried this:

Understand "tira [todo] a /por/contra [something]" as throwing all at it. Throwing all at it is an action applying to all visible things and one thing.

…but it says " ‘Throwing all at it is an action applying to all visible things and one thing’ : but an action can only apply to things or to kinds of value, for instance: ‘photographing is an action applying to one visible thing’".

Anyone knows what´s the problem here? Thanks!

Some things to note:

  1. An action has the following pieces: actor (person doing the action), action name (a unique type of action in the model world), noun (the direct object for the action) and second noun (the indirect object for the action). The last two (noun and second noun) are known as “parameters” in parser code.

  2. When declaring a new action, the number of objects involved must match the number of parameters. In this case, you only really have one parameter because you are not specifying what is being thrown, so the correct declaration has one parameter. (This will map to the noun even though functionally it is the indirect object for the action.)

    Throwing all at is an action applying to one thing. [There is only one noun.]

  3. After declaring an action, you need to provide the grammar lines via Understand... as <action>. declarations. The word “it” should not be used unless the action has two parameters. Here you have one, so:

	Understand "todo" as "[todo]". [plus whatever else you want]
	Understand "tira [todo] a/por/contra [something]" as throwing all at. [note no space between "a" and "/por/contra"]
  1. Omitting “it” in the name of the declared action makes for easier-to-read rules:
	Instead of throwing all at Alice: [an example rule]
		say "Pobre Alice!"
  1. If you actually want the command to be treated as a serious attempt by the player to throw a group of in-game objects through the window, the setup will be different than what is shown above.

I think there are two things potentially going on here. First, when you’ve got an action that takes two nouns, the location of the “it” is important – I believe it needs to go before the final preposition. Here’s code from one of my earlier projects that works for a throwing it at/over action so you can see how it looks:

Throwing it over is an action applying to one carried thing and one visible thing.  
Understand "throw [carried thing] over/at/through/out of/the/-- [thing]" as throwing it over.  

The second thing is that the way to allow a player to feed multiple objects into an action at once doesn’t use “all” the way you’ve tried to – here’s the relevant bit of the docs. You need to replace the first grammar token with a plural (so here, “throw [carried things]” and go from there – this will let the player type THROW APPLE AND PEAR OUT WINDOW as well as THROW ALL OUT WINDOW (if you want this to be an all or nothing action, where the player has to THROW ALL rather than some subset of what they’ve got, you’ll probably need a check rule to compare the multiple-object list to the players inventory or something like that, but from your description I’m not sure if that’s what you’re trying to do).

Hope this is helpful! I’m of course not sure at all whether all this translates directly into Spanish, too, so the examples might not be useful but hopefully they point in a productive direction.

1 Like

I am very grateful for your detailed solution (and for all the extra help and corrections). What I was searching is something like that, an answer corresponding the context in order to block the action without discouraging the player to keep throwing some other things out of the window. And it works, but now I have to struggle with the conflicting message about things fitting the window or not. I will look into this studying how can I bypass the emerging conflict.

Thank you very much!! ^^

1 Like

Thank you very much, Mike. This other solution of yours it´s very helpful. I didn´t know that Inform worked that way so I will keep in mind that, and I will try the “carried things” for other commands to implement other commands.

This translates very well in Spanish. Thank you once again! :slight_smile:

1 Like