Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Changing Link Text Based on Variables?

4 years ago
Is there a way to change the actual text of a link based on a variable, similar to the $PAGETEXT mehanic on page scripts? I could feasibly do it by creating separate links and putting variable limitations on them, but I was wondering if there was an easier or more streamlined way since that method would require creating a ton of links.

Changing Link Text Based on Variables?

4 years ago
The link feature is a little limited in the scripting ability here. So yes, probably the cleanest way is going to use additional links with variable limitations. I have to wonder how many options you have if this is a big deal (10?). If you really find it easier, you could work with conditionals in a script and use the $DEST feature (see here).

Changing Link Text Based on Variables?

4 years ago
205... Figured 200 IF/ELSE/THEN statements would be a lot easier than making links. I'll definitely check out that article though! And if it doesn't work out I can think of a few ways to get around it so I don't actually have to change the link text (and therefore bypass the issue entirely), but they wouldn't look as good. Thanks for the adivice!

Changing Link Text Based on Variables?

4 years ago
Instead of individual links to all the Persona thingies, you could've used one page with on page scripting to check and display all the ones you have along with their stats.

Of course you've already created all the separate pages so this may be a bit late....

Changing Link Text Based on Variables?

4 years ago
That's a good idea! I think I like having them have their own pages though for organizational purposes, plus I'll need to add the purchase options and link to them from other parts of the game besides the Compendium. I just figured I'd set up that part first so I can get the combat system working (that's probably going to be the most difficut part to script, especially for a newbie like myself). Thank you for the idea though, I might be able to use it in another part of my game :)

Changing Link Text Based on Variables?

4 years ago
On page text can be used in link text boxes I'm pretty sure.

Changing Link Text Based on Variables?

4 years ago

Yes, there is. Make sure you have advanced scripting turned on in your storygame. Suppose that you initially had a character make a choice between going "left" or going "right". If they went left, you set a variable called "LEFT" to 1. If they went right, you set a variable called "RIGHT" to 1. Now, a few pages later, you want the link to remember if they went left or right. Add this onto the script of the PAGE that the links you are referring to is on. (Not the script of the link). 

IF %LEFT = 1 THEN $LINKTEXT01 := "You chose left."
ELSE IF %RIGHT = 1 THEN $LINKTEXT01 := "You chose right."

This, of course, can be modified based on the names of your variables. Note that $LINKTEXT01 is indicating that I am modifying the text of the first link on my page. If you instead wanted to modify the second link, you would isntead use $LINKTEXT02 (and so on). 

Also, you don't need to use two separate variables. Say that you had only one variable, (%SCORE), and you want the text in the link to change depending on what the score is. You could write something (in the page script) like:

IF %SCORE = 1 THEN $LINKTEXT01 := "Your score is 1."

IF %SCORE = 2 THEN $LINKTEXT01 := "Your score is 2". 

Changing Link Text Based on Variables?

4 years ago
Thanks so much, this is exactly what I was looking for!

Changing Link Text Based on Variables?

4 years ago

No problem!