Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Variable Display

7 years ago

So I know that if you want to show a variable on a page you put %%VARIABLE%%, but what if I want it to show the number of the variable, plus one?

I made it so that on a story, when you turn twelve months old(when variable MONTHS goes above 11), it will bring you to a page saying "You are _ years old!", but instead of a blank, it will say your age. When you click "Back to the Story", the variables update, and MONTHS will be reset to zero, and YEARS will have 1 added to it.

I can't put %%YEARS%% in the blank, because then it will say "0 years old" when you turn one year old.

Variable Display

7 years ago

Just do it in a page script.

$PAGETEXT := "<p>You are " + %YEARS + 1 + " years old.</p>"

Variable Display

7 years ago

Somehow this post caused the text below it to change...

Variable Display

7 years ago

Sheesh. One missed slash and this happens.

Variable Display

7 years ago

So I put that on the "You are one year older" page's script? And everything there, or do I get rid of something...?

Variable Display

7 years ago

Yeah. That should be it.

Variable Display

7 years ago

Thank you!

Variable Display

7 years ago

Um, now it's pretty much this: %%YEARS%%1

It's just putting one at the end of the number.

Variable Display

7 years ago

So it does. Guess I went a little too minimalist. All you need are some parentheses.

$PAGETEXT := "<p>You are " + (%YEARS + 1) + " years old.</p>"

Variable Display

7 years ago

Okay. I'll try that.

EDIT: Yep, that worked, thanks!