Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Using Variables To Effect Dialogue

2 years ago
How would I have variables determine what the dialogue is? I was informed on this at one point, but I can't remember how to do it at all now..

Using Variables To Effect Dialogue

2 years ago

This article covers it:  https://chooseyourstory.com/help/articles/article.aspx?ArticleId=3850

If you want the altered dialogue to be in the links, you'll have to make them visible or not visible depending on the variable.

Using Variables To Effect Dialogue

2 years ago
On page variables are the easiest way to change a few lines of text here and there:

https://chooseyourstory.com/help/articles/article.aspx?ArticleId=3850

It's basically just

%%VARIABLE%=%1%YOUR TEXT%%

Which is just a way to say 'if variable equals [whatever] then [display this text]'

Simple to use for altering lines of dialogue but you can mash multiple of those into blocks if you want to toggle several things in a sentence.

Using Variables To Effect Dialogue

2 years ago
And Gryphon beat me to it.

Using Variables To Effect Dialogue

2 years ago
Thank you.

Using Variables To Effect Dialogue

8 months ago
So as to not make a new thread I might as well ask here. If I want large chunks of the page to be different depending on certain variables, is there an easier way of doing it then just creating multiples of :

%%Variable%=%3%Paragraph version 1 first paragraph%%%%Variable%=%4%Paragraph version 2 first paragraph%%

%%Variable%=%3%Paragraph version 1 second paragraph%%%%Variable%=%4%Paragraph version 2 second paragraph%%

%%Variable%=%3%Paragraph version 1 third paragraph%%%%Variable%=%4%Paragraph version 2 third paragraph%%

Like so, for each separate paragraph? Since this only seems to work up to 1 paragraph. And you know, this seems to work fine, just wanting to know if there's a cleaner way to do it?

Using Variables To Effect Dialogue

8 months ago

Yeah had the same issue, I think I solved it back then by making them separate pages, because that would be more time efficiënt.

Using Variables To Effect Dialogue

8 months ago
If you're changing most of the text, why not just make a new page?

Using Variables To Effect Dialogue

8 months ago
I mean sure I'd thought of that, but since about 30% or so is still the same I gave this a go as it is the exact situation at the start, just how it develops changes based on certain things, and I thought it would flow more naturally ... I don't know. It's not a huge issue, just wanted to know if it was doable.

Using Variables To Effect Dialogue

8 months ago

On-Page Scripting Paragraphs

Putting a newline character (pressing enter) breaks the on page script, but you can just substitute them with HTML break characters instead. <br>

Add more or less to get the desired spacing (I use 2).

If you're using the Rich Text Editor be sure you are adding it as HTML (does RTE still have a source button? Click it if it does).


Pagetext & Page Script

Another thing that can give similar results is using $PAGETEXT, which isn't on-page scripting, but goes on the page script (haven't tried with link scripts, don't think it'd work there).

i.e.,
$PAGETEXT := "Added at start. " + $PAGETEXT
$PAGETEXT := $PAGETEXT + "<br>Added at end."

Starting Page Text:
This is a new page.

OUTPUT:
Added at start. This is a new page.
Added at end.

:= means assign to, while = alone is for comparison. I know I forget the : sometimes, which breaks things.

Because it is in page script, you can add variable conditionals before $PAGETEXT changes.

i.e.,
IF %BLANC = 0 THEN
$PAGETEXT := "He is dead."

From what I recall, you can use newline characters here (without HTML) but you do need to escape the double quotations. & q u o t ; = ". (Drop the spaces between & q u o t ;, because I don't know how to have it not be read as HTML but written in correct form and am too lazy to google it).

i.e.,
$PAGETEXT := "& q u o t;Watch out!& q u o t; he yells." + $PAGETEXT
NOT ""Watch out!" he yells"

I'm sure you can see how this can be tedious, but if there is minimal or no dialogue, it can be worth considering.


Tips and Tricks

Replacing spaces with breaks (for on-page scripting) or quotations with their entity code (for page scripts) makes proofreading harder, so I advise writing normally (but clearly marked) in another writing software. This can also act as a backup. (Word has a search and replace feature, for example, which makes replacing quotations easy). But do whatever works for you.

Do be aware that text added through page scripts doesn't start on the page, so isn't counted towards the length calculations. If you write the whole story this way it'll be marked as 0 words, which is funny. Considering you're probably using this for similar but different permutations of the same scene, I find it evens out, where it lets you avoid artificial bloat to the word count (from copy pasting many similar pages, which is another cruder option). Depends on how you structure things.

Using Variables To Effect Dialogue

2 years ago
This is exactly what I needed, brilliant. I knew there had to be a way to do this.