*** Run-time problem P41

Hi, I´m trying to use this example from the Inform Documentation https://ganelson.github.io/inform-website/book/RB_7_8.htmlbut I get this error: "*** Run-time problem P41: Attempt to match a snippet value which is currently invalid: words 0 to 3.

I am compiling in a Mac, in 6M62. Any ideas about how can I solve this?

PS: I have tried to install updated extensions for Quip-Based Conversation and Reactable to not avail.

Instead of asking the mayordomo to try doing something:
	repeat through Table of mayordomo's Commentary:
		if player's command includes topic entry:
			say "[commentary entry][paragraph break]";
			rule succeeds;
	say "'-No la sigo, señora.".



Answering someone that something is speech. 
Instead of speech when the noun is the mayordomo:
	repeat through Table of mayordomo's Commentary:
		if the topic understood includes topic entry:
			say "[commentary entry][paragraph break]";
			rule succeeds;
	say "'-No la sigo, señora.".







Table of mayordomo's Commentary 
topic	commentary
"abuela"	"-La calva nos permitía adquirir un estatus y participar en trabajos peligrosos.".


I tried this with 10.1 and 6M62 and got this, is that what you expected? I had to add The mayodomo is a man in the laboratory to make a thing to be the person, but that was it.

What did you type to get the RTP?

>mayordomo, jump

"-No la sigo, señora.

>mayordomo, heruh

"-No la sigo, señora.

>mayordomo, sprechen sie Deutsch?

"-No la sigo, señora.

>mayordomo, abuela

-La calva nos permitía adquirir un estatus y participar en trabajos peligrosos.

Thank you, Stephen but I get the following error when typing “mayordomo, abuela”.

I suppose there is another conflict with the rest of the code, but I was expecting to find some trick to solve it. I am at the verge of abandoning my project due to several errors I cannot fix.

Yeah, it must be some other rule causing the problem, I’m afraid.

Look at anything that uses “the topic understood” or anything similar (“the number understood”) as a first step.

1 Like

Thank you, Stephen

Do you know about the RULES testing command?

Type RULES, then play the bit producing the error. You should see what rules run immediately before and after it happens. This can help you identify the error.

-Wade

2 Likes

Thank you, I will check that to see if I can find where is the conflict with the rest of the code.

1 Like

Just watch out and be aware that run time problem reporting seems to be turned off a lot, and it will often appear well after the rule that caused it.

1 Like

I dunno, I think it’s pretty accurate, except where Inform Activities are concerned.

If RULES alone isn’t satisfying, you can use RULES ALL and be swamped by even more information :slight_smile:

For the original poster – there is also the equivalent ACTIONS command, to see what actions are running.

-Wade

2 Likes

That RTP can only come from a routine called SnippetIncludes(). It is used for conditions of the form if (snippet) includes (topic) as described in WWI 18.33.

The particular error is as described in the message: The snippet provided as an argument has an illegal range and is therefore invalid. It is illegal because the starting word number is zero, and the code expects the starting word number to be at least one (the first word in the player’s command).

In the example command that you provided which is causing the RTP, the starting word number should be 3. The correct response from the table is being printed by happenstance: The routine which tests the snippet is returning the result of the call to RunTimeProblem(), which is always true.

Is this the same project where you are using LanguageIsVerb()? It would not surprise me if there were some interference to the computation of the topic understood snippet that is specific to the needs of a Spanish-language project. If you have the patience to try to isolate the cause, I’m sure it can be fixed.

I would suggest adding the following to your code and let us know how it changes the output of the RTP:

To decide which number is (SN - snippet) as number:
	(- {SN} -).

To decide which number is consult-from:
	(- consult_from -).

To decide which number is consult-words:
	(- consult_words -).

After reading a command:
	say "after reading.";
	showme topic understood as number;
	showme player's command as number;
	showme consult-from;
	showme consult-words.

Before doing something:
	say "before doing.";
	showme topic understood as number;
	showme player's command as number;
	showme consult-from;
	showme consult-words.

EDIT: I’ve changed the code a little to ask for these values at two places during the parsing/action cycle.

3 Likes

Thank you for all your detailed input. I didn´t have the chance to test your proposed solution, but I will do. Between feeding bottle and changing diapers for my son, I tried this and the problem disappeared. I am not sure what I did, I just fumbled with the code and now it seems to be fine, or at least the Run time problem P41 vanished. Maybe it didn´t really solved the problem, but just in case, here it is:

Asking someone about something is speech. 
Telling someone about something is speech. 
Answering someone that something is speech. 
Asking someone for something is speech.
			
Instead of answering the mayordomo that:
	repeat through Table of mayordomo's Commentary:
		if player's command includes topic entry:
			say "[commentary entry][paragraph break]";
			rule succeeds;
	say "-No la sigo, señora".
			
Instead of asking the mayordomo to try doing something:
	repeat through Table of mayordomo's Commentary:
		if player's command includes topic entry:
			say "[commentary entry][paragraph break]";
			rule succeeds;
	say "-No la sigo, señora.".


	
Instead of asking the mayordomo about something:
	repeat through Table of mayordomo's Commentary:
		if player's command includes topic entry:
			say "[commentary entry][paragraph break]";
			rule succeeds;
	say "-No la sigo, señora.".	
			
Instead of telling the mayordomo about something:
	repeat through Table of mayordomo's Commentary:
		if player's command includes topic entry:
			say "[commentary entry][paragraph break]";
			rule succeeds;
	say "-No la sigo, señora.".



Asking someone about something is speech. 
Instead of speech when the noun is the mayordomo:
	repeat through Table of mayordomo's Commentary:
		if the topic understood includes topic entry:
			say "[commentary entry][paragraph break]";
			rule succeeds;
	say "-No la sigo, señora.".



Instead of speech when the noun is the mayordomo:
	repeat through Table of mayordomo's Commentary:
		if the topic understood includes topic entry:
			say "[commentary entry][paragraph break]";
			rule succeeds;
	say "-No la sigo, señora.".




Table of mayordomo's Commentary 
topic	commentary
"abuela"	"-La calva nos permitía adquirir un estatus y participar en trabajos peligrosos."
"matar"	"-Tiene usted un hábito de solucionar los problemas por la fuerza bruta muy inquietante, señora."
"mata al periodista"	"-Tiene usted un hábito de solucionar los problemas por la fuerza bruta muy inquietante, señora."
"mate al periodista" 	"-Tiene usted un hábito de solucionar los problemas por la fuerza bruta muy inquietante, señora."
"mata periodista"	"-Tiene usted un hábito de solucionar los problemas por la fuerza bruta muy inquietante, señora."
"matar periodista"	"-Tiene usted un hábito de solucionar los problemas por la fuerza bruta muy inquietante, señora."


Yeah, you’re right. I was thinking of a problem I had where the rule wasn’t shown - but that was because the rule selector (is that the word?) itself was the problem (Before doing something when second noun is part of a car is a bad idea).

1 Like