Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Randomizing

10 years ago

How do I make a link go to a completely random page using scripts? Either that or one of multiple set pages?

Randomizing

10 years ago

For example:

%RANDVAR := 1D2

IF %RANDVAR = 1 THEN $DEST = @P04

IF %RANDVAR = 2 THEN $DEST = @P05

 

Randvar represents a random variable. Obviously, the 1D2 will be replaced with the dice roll of your preference. You would then use IF-THEN statements to adjust the destination of the link to the pages you want.

Randomizing

10 years ago

So I put this in my link script?

Randomizing

10 years ago

Yep.

Randomizing

10 years ago

Yes.

Randomizing

10 years ago

Thanks.

Randomizing

10 years ago

You're welcome. If you need any more help, just let me know. :)

Randomizing

10 years ago

%RANDVAR := 1D2

IF %RANDVAR = 1 THEN $DEST = @P04

IF %RANDVAR = 2 THEN $DEST = @P05

Remember that it's actually @P4 instead of @P04. You don't need the zero, and I'm not sure whether it'll mess up the code or not if you put it there, but you definitely don't need it there. 

Randomizing

10 years ago

It won't mess it up, and I feel that it helps organization when you start getting into double digits. I don't want to accidently put @P4 when I mean @P41. If I put @P04, I'll know that that page is the page I want and that I didn't just mistype.