How can you change the color of a visited link?

Twine Version: 2.3.14
Story Format: Chapbook

I see there are ways to do this in Sugarcube and Harlowe – can’t find anything for Chapbook. Right now I want to change the visited link color in one passage only, but assuming someone knows how to do this, I’m sure there is a global solution too for the whole story. Thanks in advance for any step by step help – I’m a non-programmer user and new to using the Forum.

1 Like

Does the link need to remain a link with the color-change after it’s visited? If not, you could swap an unvisited link with similar non-link text in the color you want using if/else to test if it’s been visited?

Interesting idea, thanks — but yes I need the links to remain. Essentially they are a “table of contents” of all the passages, so the reader can see what she has read and what she hasn’t (if the links can change color after the linked passage has been visited).

But in any case @HanonO can you tell me how one determines (using variables?) whether a passage has been visited or not? Would every passage need to have its own unique variable (e.g., VisitedPassage23: true) to refer to elsewhere with a conditional statement? In that case to implement your solution I would need to put “if/else” statements surrounding every link in my “table of contents”?

So I am familiar with AXMA and it uses the format:

<<if visited() eq 1>>
This is your first time.
<<else>>
You've been here before.
<<endif>>

[has this passage been visited before? empty brackets defaults to current passage]

or

<<if visited('Magic Fountain') gt 3>>
[has the ‘Magic Fountain’ passage been visited more than three times?]

Code for your Twine flavor will vary, but It looks like there is a “visited” function in Chapbook… {passage.visits} will be set to the number the specified passage has been seen by the player.

From the Cookbook:

:: StoryTitle
Chapbook: Passage Visits

:: Start

[[Another Passage]]

:: Another Passage
How many times has the current passage been visited? {passage.visits}

[[Start]]

So yes…unless there’s a tricky way an actual Twine regular can suggest, you will have to decorate your ToC with if/else statements to do this type of thing. It’s not uncommon.

I am not good with CSS, so I don’t know if there’s a way in Chapbook to change the styling for just one page.

Thanks so much! I do hope some “Twine regular” who’s experienced with Chapbook will weigh in so I can figure out how to apply this, e.g. how to refer to the {passage.visits} function in one passage from a different passage. Like [if ({passage.visits} of ‘Passage X’) > 0, then . . . else . . . ] etc. Unless there’s an easier way to do what I’m hoping to do.

1 Like

Hey Richard! I really enjoyed experiencing the remastered edition of Figurski, I hope it sets a standard for reapproaches to the accessibility of Eastgate releases. Excited to hear you’re working with Twine. Welcome to the forum!

Thanks for the warm welcome @kaemi!, and comments about Figurski.