Errors where no errors before

Suddenly, my game has stopped compiling and has two errors that are intefering. I must have compiled this thing a couple of hundred times and the compiler has never had a problem with the code that it now doesn’t like. They are run-time errors.

The specific message is “*** Run-time problem P10: Since nothing is not allowed the property “button-text”, it is against the rules to try to use it.” But I cannot find where I have declared nothing to have this property.

Has anyone experienced this before? I can’t be running short of memory. But I haven’t made any large changes to the game, specifically not the two pieces that are not compiling now.

If I release the game for testing it plays, I don’t run into the run-time errors. Any suggestions are appreciated!

That is a run-time error message, so presumably your game is, in fact, compiling.

This error means that your code is trying to retrieve the property button-text from the nothing object. In general, this happens when you try to retrieve that property from a variable that is unexpectedly set to nothing.

The quickest way to find the issue is to look at the various parts of your code where the button-text property is used. You can get a lot of mileage out of the showme statement (see WWI 11.4 The showme phrase; not the same as the >SHOWME debugging command). For example, if your code includes something like:

let B be... [some description of buttons];
say "The button is labeled [button-text of B].";

you can add something like:

let B be... [some description of buttons];
showme B;
say "The button is labeled [button-text of B].";

Then when your code is running, it will print out what the program thinks B means at that point.

If the attempt to access button-text is happening in a rule preamble, it will be tougher to find. If that’s the case, post back with specific details.

The fact that these don’t occur when releasing for testing may be significant. Do you have any code that is in a section marked not for release?

1 Like

Probably it’s hitting the same errors, but the code that generates the “Run-time problem” error is compiled out.

The point here is that a small change elsewhere in the code can cause these errors, if it leads to executing a rule in a circumstance that wasn’t happening before.

Look for the rule that’s causing this, like otisdog said. Perhaps a rule that mentions “the button-text of the noun” or “the button-text of T”. Then think about why the noun (or T, or whatever) might be nothing.

2 Likes

I isolated and bracketed text that I had added and somehow it was causing the problem:

When play begins (this is the run property checks at the start of play rule):
	repeat with item running through things:
		if description of the item is "":
			say "[item] has no description."

I didn’t have any problem running this a while ago but I do now. Peculiar.

Maybe something about the “printed name” of things that refers to button-text?

1 Like

Maybe try adding a line to see if it will show you which thing it’s getting stuck on?

When play begins (this is the run property checks at the start of play rule):
	repeat with item running through things:
		say "The current item is [item]. ";
		if description of the item is "":
			say "[item] has no description."