Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Hyperlinks between passages using variables or custom colors

I think I sometimes make things too hard for myself instead of just writing multiple choices... oh well, that's how you learn, right?  So, got a bit further and now I wanted something I thought might be simple..
Character has a bunch of text, and then comes up on two options
[[This is a regular option they could take|Passage1]]
[[This is a 'special' passage' marked in purple|Passage1]]
So what I thought would work was either
(set: $customColor to (colour: #9900FF))
$customColor[This text does look correct so color works fine]

Character has a bunch of text, and then comes up on two options
[[This is a regular option they could take|Passage1]]
[[$customColor[This is a 'special' passage' marked in purple]|Passage1]]
or
(set: $customColor to (colour: #9900FF))
$customColor[This text does look correct so color works fine]
(set: $customColoredText to $customColor["This is a 'special' passage' marked in purple"])
Thought this would show up but it doesn't actually show: $customColoredText

(set: $customColoredText to"Though this custom variable links up fine.. but without custom color")

Character has a bunch of text, and then comes up on two options
[[This is a regular option they could take|Passage1]]
[[$customColoredText|Passage1]]
Is there a non-CSS way to set a link to a specific color (just to keep it consistent with where the color is defined at the top of the game), or do I have to create a matching CSS div?

Comments

  • If you use your web-browser's debug tools to look at the HTML generated for the first lines of your second example:

    (set: $customColor to (colour: #9900FF))
    $customColor[This text does look correct so color works fine]

    becomes....

    <tw-hook class="">
    <span class="" style="color:#9900ff">This text does look correct so color works fine</span>
    </tw-hook>
    So if you ignore the tw-hook tag you will see that the output of an applied (colour:) macro is just some in-line CSS.

    After some quick tests trying things like the (text-colour:) and (link:) macros I was not able to find a solution that just used Harlowe macros, but someone else may be able to.
  • Ahaha!! I did it!
    (set: $customColor to (colour: #9900FF))
    Character has a bunch of text, and then comes up on two options
    [[This is a regular option they could take->Passage1]]
    |purple>[$customColor[This is a special option]]

    (click: ?purple)[(goto: "Passage1")]
    For the ways you were doing it: I think that the link style being applied on top of any custom styling should either be a bug or a feature change request? That's what appears to be happening, at least. I'm not well-versed enough in CSS style hierarchy to know why.
  • Fantastic!  Thank you both, that totally works, love it! :D  (and brilliant solution)
    I'm not quite sure why that 2nd bracket is there after 'option'?  It works but I'll need to look a bit deeper to understand it :)
  • The second bracket is there because I put a hook within a hook; one is the hook being colored, the other is the hook being made a link. With visual-aid linebreaks and spacing it's like this:
    |purple>[
    $customColor[This is a special option]
    ]
  • Ah fantastic! I wasn't seeing that opening bracket for some reason (brackets and parenthesis are still throwing me a bit, I'll get comfortable with them eventually) - makes sense now, much thanks again! :) 
Sign In or Register to comment.