Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Random Text?

7 years ago

Is there a way to either:

1) Have an item bring you to either PageA, PageB, or PageC(using letters as examples, page that it brings you to, of these three, is random)

or

2) Have one page that displays either TextA, TextB, or TextC(using letters as examples, text being displayed, of these three, is random)

And is there a way to make it stay that way every time you click item/go to that page? An example to make it easier:

Changing: 

Jack opens a book. It is blank. But, if Jack had been to *specific page*, he would have seen writing in the corner.

Not Changing:

Jack opens the book to a random page. Every time he opens it, it brings him to a different page(obviously, since it's random)

Random Text?

7 years ago

Make a variable (e.g. %RAND) to store the randomly generated number.

1) Use an item script to take the player to the page with the id 1, 2 or 3:

%RAND := 1D3

IF %RAND = 1 THEN $DEST := @P1

IF %RAND = 2 THEN $DEST := @P2

IF %RAND = 3 THEN $DEST := @P3

2a) Use an item script to randomize the variable:

%RAND := 1D3

2b) Then, use on-page coding to alter the text on a single page:

%%RAND%=%1%TextA%%%%RAND%=%2%TextB%%%%RAND%=%3%TextC%%

Random Text?

7 years ago

And what about the "Changing" part?

Random Text?

7 years ago

Are you saying that the text is only randomized once so that the player can only ever see that text in a playthrough?

Random Text?

7 years ago

Meaning the first time it is random, but through the rest of the storygame, it always shows whatever the random one chosen was.

Another example:

Randomly chooses characters 1, 2, 3 or 4 to show on the page. Every time the reader goes back to that page, it shows that character.

If it randomly chose character 3, then it would show character 3 every time, but number 2. Or if it randomly chose character 2, then it would show character 2 every time, but not character 4.

Random Text?

7 years ago

Okay. All you'd need to do is make sure the %RAND variable starts at zero and replace "%RAND := 1D3" with "IF %RAND = 0 THEN %RAND := 1D3".

And you probably should name it something other than "%RAND" if you're doing any other sort of randomization, for clarity's sake.

Random Text?

7 years ago

Thank you for your help!