[** Programming error: tried to read (something) **]

This one is befuddling me. I compile with no errors and everything seems to work fine. However, if I type hint (which I’ve defined as the action getting help), it displays:

[** Programming error: tried to read (something) **]

followed by my hint text. No other command does this, but every hint does.

I have no idea what this message means or what is causing it, making it very difficult to debug the problem. I can post the code for getting help, if needed, but I was hoping someone might know what this error means and what can cause it.

Was it maybe

[** Programming error: tried to find the “.” of (something) **]

?

There was discussion of that here: Cryptic runtime error message

It’s an error that comes from the glulx VM itself. Somewhere there’s code that expects some value to be the address of an object, but whatever it is isn’t really the address of an object. And then it tries to do a property lookup on it.

Edited: oops, never mind.

accel_error("[** Programming error: tried to read (something) **]");

is a different glulx message.

Please do.

1 Like

I don’t know specifically what you need, so here’s my entire hint system:

Chapter 1 - Getting Help

Getting help is an action applying to nothing. Understand "hint" and "help" as getting help.

Enabling help is an action applying to nothing. Understand "hints on", "turn hints on", "turn on hints", "help on", "turn help on", and "turn on help" as enabling help.

Disabling help is an action applying to nothing. Understand "hints off", "turn hints off", "turn off hints", "help off", "turn help off", and "turn off help" as disabling help.

A setmode is a kind of value. The setmodes are enabled and disabled. Help status is a setmode that varies. Help status is disabled.

Instead of enabling help when help status is enabled:
	say "Hints are already ON."
	
Instead of disabling help when help status is disabled:
	say "Hints are already OFF."

Check enabling help for the first time:
	say "Turning hints ON will cause the HINT command to provide hints that could potentially spoil parts of the game.[line break][line break]Are you sure you want to turn hints ON? >";
	unless player consents:
		say "Hints are currently OFF." instead.
		
Carry out enabling help:
	say "Hints are now ON. The HINT command will provide hints that are specific to the situation.";
	now help status is enabled;
	now the player is spoiled.

Carry out disabling help:
	say "Hints are now OFF. The HINT command will provide only general hints.";
	now help status is disabled.

Check getting help for the first time:
	if help status is disabled:
		say "Hints are OFF, which means that the HINT command will provide only general hints. Type HINTS ON to allow the HINT command to provide hints that are specific to the situation." instead.

Carry out getting help when help status is disabled:
	say "[one of]Try looking at things, including things that are mentioned in the description of the room[or]Many commands can be abbreviated, such as L for LOOK and INV or I for INVENTORY[or]In many cases you can leave out unnecessary words, such as typing LOOK [italic type]thing[roman type] instead of LOOK AT [italic type]thing[roman type] and NORTH instead of GO NORTH[or]Things with text on them can be READ, which may provide more info than just LOOKing at them. Some things can only be READ, if you're holding them[or]Don't forget to check your INVENTORY, which may contain useful things that you're already carrying[or]Some actions can only be done if you're carrying a specific thing that is needed[or]If you can't find something, try LOOKing IN, LOOKing ON, or LOOKing UNDER things[or]SEARCHing things can something reveal hidden items[or]There are multiple possible endings, both for success and failure[or]Successful endings are rated from 0/5 to 5/5, with 5/5 being the best ending. Failures are always 0/5.[or]Turning ON hints prevents the ending ratings from being shown[or]If hints are ON, a hint which ends with the phrase 'might not have been a good idea' means that you've done something that makes it impossible to finish the game[then at random]."

Carry out getting help when help status is enabled:
	if a detonator (called bomb) is part of the Sidewise machine beta and the Sidewise machine alpha is not destroyed:
		say "Destroying this Sidewise machine before the one in your universe might not have been a good idea.";
	else if the dimension of the universe is beta and the dimension of the remote is alpha and the Sidewise machine alpha is destroyed:
		say "Leaving the remote control behind might not have been a good idea.";
	else if the dimension of the universe is alpha and the dimension of the remote is beta and the Sidewise machine beta is destroyed:
		say "Leaving the remote control behind might not have been a good idea.";
	else if the dimension of the universe is not gamma and the remote control is in the Clearing and the portable Sidewise device is broken:
		say "Leaving the remote control in the Clearing might not have been a good idea.";
	else if the portable Sidewise machine is broken and a detonator (called bomb) is not tried:
		say "Breaking the portable Sidewise machine might not have been a good idea.";
	else if chip 889B is broken and a detonator (called bomb) is not tried:
		say "Breaking chip 889B might not have been a good idea.";
	else if the VCR is broken and the Project Sidewise video tape is tried and digital safe is locked:
		say "Breaking the VCR might not have been a good idea.";
	else if the magnetism of the Project Sidewise video tape is erased and the digital safe is locked:
		say "Picking up the powerful magnet while carrying the Project Sidewise video tape might not have been a good idea.";
	else if the Project Sidewise video tape is broken and the digital safe is locked:
		say "Destroying the Project Sidewise video tape might not have been a good idea.";
	else if the remote control is broken:
		say "Breaking the remote control might not have been a good idea.";
	else if the circuit board is broken and the circuit board is part of the Sidewise machine alpha:
		say "Breaking the circuit board while it was attached to the Sidewise machine might not have been a good idea.";
	else if the Sidewise machine alpha is broken:
		say "Breaking the Sidewise machine might not have been a good idea.";
	else if the air vent is broken and the Xion crystal alpha is broken:
		say "Breaking the vent might not have been a good idea.";
	else if the Xion crystal beta is broken:
		say "Destroying the Xion crystal might not have been a good idea.";
	else if Project Sidewise door alpha is tried and player is not carrying the strange gadget and the strange gadget is not in Project Sidewise alpha:
		say "Shifting here without a way past the Yellow security door might not have been a good idea.";
	else if the torch is broken and the Xion crystal alpha is off-stage:
		say "Destroying the torch might not have been a good idea.";
	else if the toolkit is broken and chip 889B is not part of the portable Sidewise device:
		say "Destroying the toolkit might not have been a good idea.";
	else if the toolkit is broken and the circuit board is part of the Sidewise machine alpha:
		say "Destroying the toolkit might not have been a good idea.";	
	else if the stray dog is in the hallway east beta and the steak is in the oubliette:
		say "Eating the steak might not have been a good idea.";
	else if the strange gadget is broken and Project Sidewise door alpha is closed:
		say "Destroying the strange gadget might not have been a good idea.";
	else if the floppy drive is broken:
		say "Breaking the floppy drive might not have been a good idea.";	
	else if the old style computer is broken:
		say "Breaking the old style computer might not have been a good idea.";	
	else if the Sidewise machine beta is broken:
		say "Breaking the Sidewise machine might not have been a good idea.";		
	else if the magnetism of the floppy disk is erased:
		say "Picking up the powerful magnet while carrying the floppy disk might not have been a good idea.";
	else if the floppy disk is broken:
		say "Destroying the floppy disk might not have been a good idea.";
	else if the Xion crystal beta is broken:
		say "Destroying the Xion crystal might not have been a good idea.";
	else if the digital watch is broken and the phase of the Sidewise machine alpha is unstable:
		say "Destroying the digital watch might not have been a good idea.";
	else if the Dense Forest is tried and the player is not in the Hidden Garden and the player is not in the Clearing:
		say "You need to try the portable Sidewise device from somewhere futher north.";	
	else if the portable Sidewise machine is complete and the remote control is inactive:
		say "You need to find someplace that is further away from the Sidewise machine.";	
	else if the portable Sidewise device is not in the digital safe and the portable Sidewise device is incomplete:
		say "You need to find out what's missing from the portable Sidewise device and how to complete it.";
	else if the Conference Room beta door is tried:
		say "You need to find a different way to get into the Conference Room.";
	else if the Project Sidewise video tape is not off-stage and the Shazaam video tape is off-stage:
		say "You need to find a way to play the Project Sidewise video tape.";	
	else if the digital safe is tried and the digital safe is locked and the Project Sidewise video tape is off-stage:
		say "You need to find a 6-digit code to unlock the safe.";	
	else if the Research door beta is xtried and the Research beta door is not open:
		say "You'll need to try something other than prying, if you want to open the Research door.";
	else if the player is in the Storage Room alpha and the vent is tried:
		say "You need a way to see inside the dark vent.";
	else if the player is in the Conference Room alpha and the sticky note is tried and the toolkit is off-stage:
		say "Perhaps the tookit is under or behind something.";
	else if the Project Sidewise door alpha is tried:
		say "You will need some other way of getting past the Yellow security door.";
	else if the dog is in the hallway east beta and the dog is hopeful:
		say "Perhaps the dog would be interested in something else. He seems hungry.";
	else if the dog is in the hallway east beta and the dog is nervous:
		say "Perhaps the dog is too hungry to let you pet him.";
	else if the dog is in the hallway east beta and the dog is afraid:
		say "Perhaps a kinder approach to getting past the stray dog would be more effective.";
	else if the dog is tried and the dog is in the hallway east beta:
		say "You need to find a way to get past the stray dog.";	
	else if the storage room door beta is tried and the storage room door beta is not open:
		say "You'll need more leverage, if you want to open the Storage Room door.";	
	else if the digital watch is in BroomTek Entrance alpha and the phase of the Sidewise machine alpha is unstable:
		say "You should probably be wearing the digital watch before you go inside.";
	else if the phase of the Sidewise machine alpha is unstable:
		say "All you need to do right now is start your new job.";
	otherwise:
		say "You need to figure out where you are, how you got here, and how to get back."

All of the hints seem to work correctly, except I get the “[** Programming error: tried to read (something) **]” message before each hint is printed, but only when hints are ON. When hints are OFF, I’m getting the general hints with no error message.

Based on that, I’m assuming I did something in that last section that’s causing the problem, but I can’t figure out what it is.

Hm. As noted in the other thread, this kind of error usually means that you’re referring to an invalid object. Say, you’re operating on an object variable (like noun) which is currently nothing.

I don’t see anything in your code which looks like you’re doing that. It’s hard to tell for sure without knowing what variables you’ve defined.

You might want to stick a line

say "(Starting help check...)";

…at the top of the long “getting help” rule. That would at least verify that the error occurs inside that rule.

1 Like

not sure it would cause this error rather than a compiler error, but this

else if the Research door beta is xtried and the Research beta door is not open:

looks like a typo?

1 Like

If that’s not the problem and zarf’s suggestion confirms it’s the getting help rule that’s throwing the error, I would start progressively commenting out blocks of statements in that rule to narrow down where it’s coming from.

1 Like

not sure it would cause this error rather than a compiler error, but this

else if the Research door beta is xtried and the Research beta door is not open:

looks like a typo?

Actually xtried is a legitimate property of doors. To get my help system to work properly I added tried and untried, but then I ran into a situation where I needed a way to know if they tried two different things and I couldn’t thing of a name, so I just used xtried.

I think the/another issue @drpeterbatesuk might have been flagging is there are two slightly different names for the door there (“research door beta” and “research beta door”)?

1 Like

I think the/another issue @drpeterbatesuk might have been flagging is there are two slightly different names for the door there (“research door beta” and “research beta door”)?

That is a typo, thanks. That doesn’t appear to be what’s causing the problem though.

1 Like

Your suggestion of commenting out blocks helped me determine that this is the offending test:

	else if the Dense Forest is tried and the player is not in the Hidden Garden and the player is not in the Clearing:
		say "You need to try the portable Sidewise device from somewhere further north.";

If I comment it out, the message goes away. If I uncomment it, the message comes back.

I’m wondering if the problem is “if the Dense Forest is tried”. I defined the property as:

A thing is either xtried, tried, or untried. A thing is usually untried.

which I thought should work on a room (Dense Forest), so when the player goes to the Dense Forest, I do this:

now the Dense Forest is tried.

so I can test it in help. Do rooms not inherit properties from things? Is there a better way to determine if the player has been in the Dense Forest, even if they’re no longer there?

Sorry, I’m an Inform 7 noob and this is my first big game.

A room isn’t a thing- I wonder if that’s the problem?

Try

An object is either xtried, tried, or untried. An object is usually untried.
2 Likes

No, is the answer. Rooms, things, regions and directions are all kinds of object.
All other objects (doors, containers, people etc.) are kinds or subkinds of thing.

1 Like

A room isn’t a thing- I wonder if that’s the problem?

I’m pretty sure that was it. I still get things and objects mixed up.

The solution was actually very simple. After doing some more reading, I discovered the visited property of rooms, which is what I was actually trying do in my own klutzy way.

Much thanks everyone for the help (again)!

1 Like

Inform does track whether a room has been visited by default (the unvisited/visited property) in case that makes life easier.

Edit: oops, just too late!

1 Like

If the Dense Forest is visited

Edit ditto!

2 Likes