How to use On-Page Variable Tricks

by BerkaZerka

<< All Articles | Print

How to use On-Page Variable Tricks

The following discusses the use of the On-Page Variable Code (it literally goes right on the Page in the Story Editor, as opposed to Scripting, which goes into the Scripting Boxes).

The On-Page Variable Code is used to show a Variable Value on a Page by bracketing it in double Percent Marks - for example, the Value of the %HEALTH Variable can be shown on a Page by typing %%HEALTH%% right on the page (in the Editor it will read '%%HEALTH%%', but in the Reader, a number Value will be displayed instead).

So, if you want a Page to show a Player their Character’s Health, you would add to a Page something like:
Current Health: %%HEALTH%%

In the Reader it would show up as (assuming a Health of 100):
Current Health: 100

---

With that in mind, you can also do the same On-Page-Coding with Conditions, such as < > = !=...

The Formula looks like this (where 100 is the Variable Numeric Value):
%%VARIABLE%=%100%TEXT%%

---

So, if I want %STRENGTH to show different levels, depending on the current value, I can add words instead of just showing numbers (using this) -

%%STRENGTH%<%3%Weak%%%%STRENGTH%=%3%Below Average%%%%STRENGTH%=%4%Below Average%%%%STRENGTH%=%5%Average%%%%STRENGTH%=%6%Average%%%%STRENGTH%=%7%Exceptional%%%%STRENGTH%=%8%Exceprional%%%%STRENGTH%>%8%Super%%

Broken up - this is actually this -

%%STRENGTH%<%3%Weak%%
%%STRENGTH%=%3%Below Average%%
%%STRENGTH%=%4%Below Average%%
%%STRENGTH%=%5%Average%%
%%STRENGTH%=%6%Average%%
%%STRENGTH%=%7%Exceptional%%
%%STRENGTH%=%8%Exceptional%%
%%STRENGTH%>%8%Super%%

Note you cannot use ^p (Paragraph Returns/Line Breaks) in the code, but you can use any Text, such as -

%PIE%!=%0%"Pie!" he screamed with joy - "you brought Pie!" Then pulling out a long, knife, Geophery slices the Pie up into eight equal pieces and begins to divvy them out...%

---

In all cases, if the Variable Condition is met, then the TEXT is displayed. If the Conditions are not met, then nothing is displayed and no space is taken up on the Page by the invisible code when viewed with the Reader (Except for a blank Line Break wherever you have the Code).

---

This being said, here are some huge On-Page Variable Codes that you might find useful:

1> Something to allow for different names in a game:
%%NAME%=%1%Bob%%%%NAME%=%2%Marlow%%%%NAME%=%3%Jill%%%%NAME%=%4%Cassandra%%

2> Here is what you need for a 1 to 8 Character Name in your game. Keep in mind that you need to put this GIANT BLOCK of SCRIPT in every place you want the Name to appear...
%%DIGIT1%=%1%A%%%%DIGIT1%=%2%B%%%%DIGIT1%=%3%C%%%%DIGIT1%=%4%D%%%%DIGIT1%=%5%E%%%%DIGIT1%=%6%F%%%%DIGIT1%=%7%G%%%%DIGIT1%=%8%H%%%%DIGIT1%=%9%I%%%%DIGIT1%=%10%J%%%%DIGIT1%=%11%K%%%%DIGIT1%=%12%L%%%%DIGIT1%=%13%M%%%%DIGIT1%=%14%N%%%%DIGIT1%=%15%O%%%%DIGIT1%=%16%P%%%%DIGIT1%=%17%Q%%%%DIGIT1%=%18%R%%%%DIGIT1%=%19%S%%%%DIGIT1%=%20%T%%%%DIGIT1%=%21%U%%%%DIGIT1%=%22%V%%%%DIGIT1%=%23%W%%%%DIGIT1%=%24%X%%%%DIGIT1%=%25%Y%%%%DIGIT1%=%26%Z%%%%DIGIT2%=%1%A%%%%DIGIT2%=%2%B%%%%DIGIT2%=%3%C%%%%DIGIT2%=%4%D%%%%DIGIT2%=%5%E%%%%DIGIT2%=%6%F%%%%DIGIT2%=%7%G%%%%DIGIT2%=%8%H%%%%DIGIT2%=%9%I%%%%DIGIT2%=%10%J%%%%DIGIT2%=%11%K%%%%DIGIT2%=%12%L%%%%DIGIT2%=%13%M%%%%DIGIT2%=%14%N%%%%DIGIT2%=%15%O%%%%DIGIT2%=%16%P%%%%DIGIT2%=%17%Q%%%%DIGIT2%=%18%R%%%%DIGIT2%=%19%S%%%%DIGIT2%=%20%T%%%%DIGIT2%=%21%U%%%%DIGIT2%=%22%V%%%%DIGIT2%=%23%W%%%%DIGIT2%=%24%X%%%%DIGIT2%=%25%Y%%%%DIGIT2%=%26%Z%%%%DIGIT3%=%1%A%%%%DIGIT3%=%2%B%%%%DIGIT3%=%3%C%%%%DIGIT3%=%4%D%%%%DIGIT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