Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Diverging Story Through Variables

7 years ago

Hey I'm wondering, is there a way of making a link bring you to two separate pages depending on variables? The situation I'm thinking of is you're asking someone for help. E.g:

You click the link "Ask Arthur for Help".

If your 'Relationship with Arthur' variable is below 70, it brings you to a page saying he refuses.

If your 'Relationship with Arthur' variable is above 70, it brings you to a page saying he agrees.

Diverging Story Through Variables

7 years ago

In the link script, check the value of the variable and use $DEST := @P12, or whatever the number of the page is.

I'll be at a computer soon and can explain in more detail if you need it. There's an article that goes into this though.

Post these kinds of questions in the Advanced Editor section from now on, btw.

Diverging Story Through Variables

7 years ago

Couple of ways. They function a little differently, but the result is basically the same.

  1. Without scripting
    1. Make two "Ask Arthur for Help" links
    2. Set one link's destination to the refusal page and the other to the agreement page
    3. Open the link restriction window (the stop sign left of every link) and go to the variable restrictions tab
    4. In the row for the relationship variable, for refusal set the type to "<" and the value to "70" and for agreement set the type to ">=" and the value to "70"
  2. With scripting
    1. Make one "Ask Arthur for Help" link (destination can be whatever)
    2. Make note of the page id for the refusal and agreement pages (the number in [] square brackets left of the page name)
    3. Open the link script window (the := symbol left of every link)
    4. Enter IF %RELATIONSHIP < 70 THEN $DEST := @P1 ELSE $DEST = @P2
    5. Replace the "1" in @P1 with the refusal page's id, the 2 in @P2 with the agreement page's id, and the variable name with the correct one as well

Diverging Story Through Variables

7 years ago

Thanks for the help! :)