Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

How Do You Show Variables On A Single Page?

13 years ago

 

Hi, I was wondering if anyone could help me or point me in the right direction to someone that can. I don't know jack about scripting, so I'm not seeing how to do what I'd like.
 
I want to be able to have a page that I can link to at each ending of my game that shows %SCORE and few other variables (sort of a 'this is what you accomplished' page – like madglee’s breakdown pages in 'Mommy, Can I Go Out and Kill Tonight?').
 
I only want these variables to show on this single page (not on all the pages, as you can 'check' in the variable section in the story editor).
 
All I've figured out so far (reading the help files) is that you use <script></script> to run script, but I don't have a clue what to put in between the two – I presume you use it with the ‘source’ button when editing a page.
 
I have tried <script>%SCORE </script> but can see it doing anything...
 
What's the language I need to use to do what I'd like?
 
Thanks for any help or direction anyone can give --
 
 
BZ
 

How Do You Show Variables On A Single Page?

13 years ago

*can't see it doing anything...

How Do You Show Variables On A Single Page?

13 years ago

If you want to display the value of a variable on a page, all you have to do is write %%VARIABLENAME%% where you want the number to be. For example, let's say the variable GOLD was 5. If you wanted to put that on your page, you would write:

Gold: %%GOLD%%

And that would show up as:

Gold: 5

Does that make sense?

How Do You Show Variables On A Single Page?

13 years ago

Ah - two %'s. It makes sense, thanks, I'm going to go check it out now!

 

BZ

How Do You Show Variables On A Single Page?

13 years ago

 

Sweet, it works!
 
My confusion (and I think it’s worth pointing out), is that I expected to see the values displayed in the story editor – when they actually show up in the story itself.
 
This was immensely helpful, thanks
 
BZ

How Do You Show Variables On A Single Page?

13 years ago

One more question: How do I display the value of a variable using mathmatical expressions -

 

For example, If I want to show %%SCORE%% * 5 (score times five)?

 

BZ

How Do You Show Variables On A Single Page?

13 years ago

Well I can think of two different ways...

A) Create a seperate variable and make it equal to SCORE*5, and display that one.

B) Or change the value of SCORE to equal SCORE*5 if you're not going to use score again.

 

This would be done in the page's script by doing:

a) %APPLE :=  (%SCORE * 5)

b)  %SCORE := ( %SCORE * 5)

 

Then just display the right variable on the page.

How Do You Show Variables On A Single Page?

13 years ago

(As far as I am aware you can't do in-line expressions like you want to without actually changing the variable, but I could be wrong)

How Do You Show Variables On A Single Page?

13 years ago

This is great stuff, thanks again

 

BZ