Is it possible to write links and replace labels from a Javascript function?
KaiSD
04 Aug 2019, 17:53I have two questions:
- Is it possible to write working squiffy links from JS code without doing it manually?
squiffy.ui.write('[Part2](part2)')
doesn't work
squiffy.ui.write('<a class="squiffy-link link-section" data-section=part2 role="link" tabindex="0">Part2</a>')
works, but it's kinda ugly. - Is it possible to replace a label from JS code?
As above, it is possible to do it manually, but I hope to find a more elegant way to do it.
![](https://i.imgur.com/6mfIIbhb.gif)
Bluevoss
05 Aug 2019, 00:24I'm not quite sure what you are asking. Do you want to change links based on external events? That I can do (in squiffy) but not globally.
![](https://i.imgur.com/6mfIIbhb.gif)
Bluevoss
05 Aug 2019, 16:40This is a crude way to do it, by passing flags down to the squiffy engine to light up section links. Not sure its what you were really looking for....
[[init]]:
set("flag1",true); //this represents setting a flag based on game logic.
{if flag1:[[special door]]}
[[normal door]]
[[special door]]:
This is a special place.
[[normal door]]:
This is a normal place.