Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

How do I display variables?

11 years ago

I've just started, and this is a completely noob question: how do I call or display a variable?

Like if SCORE is 0, and I want to display, SCORE, what do I write on the page?

Do I need to write any code to start and end scripts?

 

I've read all the help guides, and I've some idea on how to manipulate variables, but I can't seem to get the variables to show up on the page in the first place.

 

EDIT: ok I've figured out how to display variables by writing %%VARIABLE%%.

 

Now, how do I manipulate it on the page? can I write %VARIABLE := %Variable +1 ?

 

EDIT2:

I tried this:

BEGIN

%SCORE = %SCORE + 1

END

SCORE = %%SCORE%%.

 

it doesn't work

 

EDIT3: Set everything to advance, found the global scripts page. %VARIABLE and $PAGETEXT is working.

How do I display variables?

11 years ago

%%SCORE%% is the same variable as %SCORE, it's just the way you'd write it on a page.

 

So on your actual page (not in the script), you'd put:

Your score is: %%SCORE%%.

To get something like this (assuming the value of SCORE is 8):

Your score is: 8.

 

%SCORE is used to change the variable in scripts.

%%SCORE%% is used to show the variable on pages.

You do not change the variables on pages, only in scripts, which are executed before pages are loaded, so the changes you made are shown on the page (assuming you show the variable on that page).

Each page has it's own page script, it looks like a := to the left of the title of the page.

How do I display variables?

11 years ago

You want [variable] to be displayed only on some pages, right? Otherwise you could just tick the option to display [variable].

 

Agree with killa.