Need help with varying results.

Zerosu
I have a particular passage set up to display different text depending on whether or not they have seen another passage previously. That in itself works fine. The problem is that the penalty intended to only take effect for one variant of the passage will take effect no matter what. I imagine the answer is incredibly obvious, but I can't think of a solution.

{if seen protagvision: The clouds have completely covered the sky once more. You can't see the moon now}{else:You give the reflection another look.

You stare up at the sky, and the moon stares back down at you.

Literally.

A massive, blood red eye glares down at you from the heavens. The moon has an eye.

You hadn't noticed it before, as the sky had been cloudier. But now there was a break in the clouds. You begin to shudder uncontrollably, your heart pounding heavily in your chest. Fortunately, the moment passes as the moon returns to being covered by clouds, and you let out a breath you hadn't known you were holding.

You decide to stop looking up at night

@dec Sanity 20

}.


This is the way I have it set up right now.

bgbg
I don't know if it would work with your game, but one way to do this would be to make two passages for the two variants, and then send the player to one or the other depending on whether they've seen the first one before.


@set score=100

Current score is {score}.

[[Start.]](Look)


[[Look]]:

[[Look at the Moon.]]({if seen Moon-Variation-1:Moon-Variation-2}{else:Moon-Variation-1})

[[Moon-Variation-1]]:
@dec score 20

The first version of the passage. Current score is {score}.

Go back to [[Look]].


[[Moon-Variation-2]]:
The second version of the passage. Current score is {score}.

Go back to [[Look]].


I think you can also use JavaScript to make things conditional. This code is from Alex (I don't know JavaScript).


[Set flag] or, don't set flag and just go to the [[next]] section.

[Set flag]:
@set flag
OK.

[[next]]:
if (get("flag")) {
set ("other", true)
}
{if flag:Flag is set}{else:Flag is not set.}

{if flag:Other is set}{else:Other is not set.}

Zerosu
Thanks. It's working now. Now, onto dealing with even more split paths.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums