0 votes
by (120 points)
I tried to open a bug report but the repository appears to have been deleted so I'm not sure where to submit a report? Sorry in advance.

I'm trying to make a simple stat system that changes depending on which paths you take throughout the story. When I loaded into my game to test this, I found the debug viewer was incredibly unhelpful because it would not take a stat below 1 when hitting the undo button. I thought the problem was with my code but when I quickly wrote in my own debug viewer, that would display the correct variables (and correct variable redactions if someone hit undo.) I didn't think to try this until two hours after encountering this problem with the tools provided in harlowe, and I wasted 2 hours chasing a problem that did not exist because the thing at the bottom of the screen that's supposed to be helping me would not display variables at their actual current numeric value.

Example of what I mean:

https://i.imgur.com/xZtHau7.png

https://i.imgur.com/DGnuBWR.png

https://i.imgur.com/LWh9hap.png

https://i.imgur.com/XB7P1FD.png

2 Answers

0 votes
by (68.6k points)

Harlowe's repository is where it's always been: https://bitbucket.org/_L_/harlowe.

You may be confusing the Twine 2 repository, which somewhat recently moved from Bitbucket to GitHub (https://github.com/klembot/twinejs), with Harlowe's.  Each of the story formats have their own repositories separate from Twine's.

0 votes
by (159k points)
Without examples of the content of the relevant passages and a description of the path you took through each of them to reach the outputs within your images it is very hard to determine why your outputs differ from the debug view's.
by (120 points)
testing variables

[[choice]]

(set: $phs to 0, $int to 0, $hrt to 0)

------

Your physical strength is $phs
Your intellect is $int
Your compassion is $hrt
[[phs]]
[[int]]
[[hrt]]

-------

(set: $phs to it + 1)
Your physical strength is $phs
Your intellect is $int
Your compassion is $hrt
//int and hrt are identical to this

Does this help?

The comment code at the bottom is not there in the script, I just added it to the snippet for brevity.

Also the lines are to separate pages, but that's the order I took. The actual code works, it's only the debug tools that read it wrong when I undo my changes in testing.

Also, sorry, didn't know that every frontend had its own repo. I guess because different people work on them?

by (159k points)

@Mushrooms
You have found a bug in the 'variables' section of Harlowe's tw-debugger implementation, it seems like it only updates the shown value of variables that are actually changed within the current passage.

I strongly suggest you create a new Issue informing the developer on the Harlowe project's repository, because the developer may not see this question on this site.

Possible cause:

Harlowe uses a hierarchical object (1) to store Variable History and it contains both the current and previous states of all currently known story variables, each level within that hierarchy only stores values for story variables that where directly referenced (via (set:) macros) within the associated passage.

eg. The current state objects for each of your passage would look like the following:

first passage:		{phs: 0, int: 0, hrt: 0}
'choice' passage:	{}
'phs' passage:		{phs: 1}

... you will note that the 'choice' passage's current state object doesn't contain any values.

So when you Undo from the 'phs' passage back to the 'choice' passage then tw-debugger code seems to believe that nothing has changed so it doesn't update the shown values.

One way to temporarily get around this issue within the tw-debugger is to directly reference the related story variable(s) within your 'choice' passage like so...

(set: $phs to $phs)\
Your physical strength is $phs
Your intellect is $int
Your compassion is $hrt
[[phs]]
[[int]]
[[hrt]]

...which will cause the current state objects change to..

first passage:		{phs: 0, int: 0, hrt: 0}
'choice' passage:	{phs: 0}
'phs' passage:		{phs: 1}

...which in turn will cause the value of $phs in the 'variables' section to be updated.

(1)  Hierarchical Variables History Object: Each time a Passage Transition occurs Harlowe creates a new variables state object, it then (converts and) assigns the old variables state object as the prototype of the new object. The structures of each of your passages would look something like the following,

a. The Variables object when the first passage is shown

variables = {
	phs: 0,
	int: 0,
	hrt: 0
}

b. The Variables object when your 'choice' passage is shown

variables = {
	prototype: {
		phs: 0,
		int: 0,
		hrt: 0
	}
}

c. The Variables object when your 'phs' passage is shown

variables = {
	phs: 1,
	prototype: {
		prototype: {
			phs: 0,
			int: 0,
			hrt: 0
		}
	}
}

 

by (120 points)

@greyelf

Thanks, I created an issue linking back here (really did not want to retype all of that at 2:30AM), on some further testing it really doesn't look like I'm doing anything wrong so I guess it really is a bug. 

...