[i7][solved] implementing a probe command (taking samples)

Hi, I tried myself at a new action “probing it”, but ran into an error (again). Sorry if I’m spamming too many questions to the forum :unamused:

Here the minimal code with a small test scene:

[code][ define use X and use X with Y commands: ]
Understand “use [something]” as using.
Understand “use [something] with [something]” as using with.
Understand “use [something] on [something]” as using with.

Using is an action applying to one thing.
Using with is an action applying to two things.

[ define a new probe X command, for scientifically probing (taking a sample) ]
Understand the command “probe” as something new.
Understand “probe [something]” as probing it.
Probing it is an action applying to one thing.
Check probing it:
if player does not carry probing device version 1:
say “You don’t know how to probe that. You need some device which allows you to do that.”;
otherwise:
if the noun is not thingforprobing:
say “You don’t think this is something you should be probing.”.
report probing it:
say “You probe [the noun].”.
carry out probing it:
do nothing.

[ a small test scene: ]
A thing can be thingforprobing.
the bathroom is a room. “Hello!”.
water is a thing in the bathroom. water is a thingforprobing.
Probing device version 1 is a thing.

[ redirecting use of probing device to the probing action ]
instead of using probing device version 1 on water:
try probing water.[/code]
The resulting compiler error (regarding the very last source code line) is the following:

Again I have no idea why this happens… why would it not recognise and allow me to redirect to the new action?

For some reason your code keeps giving me a translating-the-source failure, so I can’t check this, but I think the issue is that you’re misusing ‘it’ in your action definitions.

The proper formation is:

  • no noun, no ‘it’: jumping is an action applying to nothing
  • one noun, no ‘it’: vaulting is an action applying to one thing
  • two nouns, ‘it’ refers to first noun vaulting it with is an action applying to two things

So the action’s name should be ‘probing’, not ‘probing it’ throughout. And the using action should be ‘using it with’.

Oh thanks for explaining :slight_smile:
I tried to apply that in my latest test iteration:

[code][ define use X and use X with Y commands: ]
Understand “use [something]” as using.
Understand “use [something] with [something]” as using it with.
Understand “use [something] on [something]” as using it with.

Using is an action applying to one thing.
Using it with is an action applying to two things.

[ define a new probe X command, for scientifically probing (taking a sample) ]
Understand the command “probe” as something new.
Understand “probe [something]” as probing.
Probing is an action applying to one thing.
Check probing:
if player does not carry probing device version 1:
say “You don’t know how to probe that. You need some device which allows you to do that.”;
otherwise:
if the noun is not thingforprobing:
say “You don’t think this is something you should be probing.”.
report probing:
say “You probe [the noun].”.
carry out probing:
do nothing.

[ a small test scene: ]
A thing can be thingforprobing.
the bathroom is a room. “Hello!”.
water is a thing in the bathroom. water is a thingforprobing.
Probing device version 1 is a thing.

[ redirecting use of probing device to the probing action ]
instead of using probing device version 1 on water:
try probing water.[/code]
However, when I click the “Play” button of gnome inform… it just says compilation failed. No error given. Huh?

The crash seems to be caused by the redefinition of ‘using’. Using is already in the standard library so you don’t have to create an action for it. Removing the ‘understand “use [something]”’ and ‘Using is an action…’ lines. Using it with can stay.

After that; it will give you a rundown of the remaining errors.

One of the other issues: The action is called ‘using it with’. The ‘understand “use [something] on [something]”’ line allows the player to use ‘on’, but not you - you still have to use ‘with’.

Another one: Many times ‘the’ is not optional. ‘If player does not carry probing device’ is one of those times. ‘If the player does not carry the probing device’ works.

No it isn’t.

In nearly every case, “the” is optional. This is unusual. I think it’s because “probing” could refer to either an object or an action. “The probing” can’t refer to the action, so I7 doesn’t get confused.

This is the problem. It shouldn’t crash I7, of course, but if you fix this everything should work right.

If using isn’t in the standard rules, then why does commenting it out make this not crash the compiler, and why did I think it was in there? It’s not in the index, though… now I’m just worried.

The the seems to be required on ‘the player’ as well for this to compile.

When the compiler crashes, it’s always something that shouldn’t happen regardless of what’s in the author’s or the standard library’s code. In other words compiler crashing is not an intended response to a clash between the story code and the standard library.

I suspect that if the word “using” is causing the crash (and it doesn’t happen with the exact same code with another verb) the problem has something to do with “using” being a (deprecated) keyword in the language (“if using American dialect: …”)

I tested this example with “using” changed to a different word, and it didn’t affect the crashing behavior.

But when I changed “probing device” to “probing-device”, it didn’t crash. That’s why I pointed at that.

When I comment out the definition of the using action, it doesn’t compile; but it doesn’t crash. Hence why I thought the crash was perhaps do to a redefinition of the action (I’ve seen the redefinition of a To say phrase make it crash before) It’s apparently not one specific thing causing it to crash but the combination of them.

I renamed my probing device to probing-device with printed name probing device and understanding “probing device” as probing-device - voilà, it works! Thanks everyone