Command prompt doesn't change value (I6 / I7 mix)

While updating the ‘Command Prompt on Cue’ extension for 6L02 (relevant code), I’ve had to change a text variable that was mapped to I6 to a pure I7 variable, because it would otherwise fails to change the prompt.

This is apparently because the desired prompt value would match that to which the ‘saved optional command prompt’ is initially set.

Test case below – it should change the prompt to “!!!” first, and to "— " second but only changes to "— ".

Toggle is a truth state that varies.

The saved optional command prompt is some text that varies.
The saved optional command prompt variable translates into I6 as "saved_optional_prompt".

Include (-
Global saved_optional_prompt = (+ "!!!" +);
-) after "Definitions.i6t".

When play begins:
	now the command prompt is ">>> ".

Last for reading a command:
	now the saved optional command prompt is the command prompt;
	if toggle is false:
		now the command prompt is "!!!"; 
	otherwise:
		now the command prompt is "--- "; 	
	say "([command prompt])";
	continue the action.


First after reading a command:
	now the command prompt is the saved optional command prompt.

After waiting for two turns:
	now toggle is true.


Prompting is a room. 

test me with "z / z / z".

If, however, you make ‘the saved optional command prompt’ in the example above a pure I7 variable, it works fine.

Is that a bug ? A reference counting issue ? Something expected ?

I think it is a reference counting error having to do with the original global definition. If you change the global line to

Global saved_optional_prompt = EMPTY_TEXT_VALUE;

…it works.

I will file this.

Yeah, I tried that before finally changing the I6 variable to a pure I7 variable.

When you initialize it that way, it still breaks when you try to set the command prompt to “”, as was done in the original extension code.

I guess that’s not surprising. You could initialize it to (+ “bogus-string-that-never-occurs” +), but using a pure I7 variable is simpler all around.

EDIT-ADD: inform7.com/mantis/view.php?id=1279