goto instead of link

I tried a few syntax but have not worked yet.

Based on an atrribute xyz which = 3, I want to goto a section, but I do not want the user to click a link.
like ```

{if xyz=3:[[link]]}

the above will make the user click [[link]]
I would rather the program just take him there


You can do that using a javascript part on the page. It will look something like:

    if (squiffy.get("xyz") == 3) {
        squiffy.story.go("link");
    }

If you've not used JS in Squiffy before, note that it goes before all text in the section, and must have 4 spaces at the start of each line.


Also worth noting that the text for the current page won't appear at all… it will skip straight to the link. But any other JS on this page will still run after displaying the text for the linked page. If you want to display this page's text before being redirected, you'd have to do that manually. Something like:

    if (squiffy.get("xyz") == 3) {
        squiffy.ui.write(squiffy.story.section.text);
        squiffy.story.go("link");
    }

(off the top of my head… I may have got some of the variable names wrong, because I've not got Squiffy on my new computer yet)


when I put that in

if (squiffy.get("xyz") == 3) {
squiffy.story.go("link");
}

it simply prints this
if (squiffy.get("xyz") == 3) null

like its text


never mind, it works fine. My error was I had one line of text before it. Thanks


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

Support

Forums