Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

How do I modify text with scripts & variables?

8 days ago
Dumb question, I know. I am working on my entry for Surana's contest and I wanted to take the opportunity to learn variables. Unfortunately the "Working with Variables" article will not load for me. I've checked the other variable articles, but I think I'm missing some key piece of information.

Specifically, I want to script that what characters say changes depending on what variables you have.

Large sections of the site seem to be down for me, but hoping I can learn scripting fast enough to get this done.

How do I modify text with scripts & variables?

8 days ago
The article How to use On-Page Variable Tricks by BerkaZerka has the most accessible explanation. Displaying a variable you created is as simple as writing %%HEALTH%% or %%MONEY%% which displays the integer value stored in the variable. You may write an on-page variable condition like this: %%MONEY%=%100%TEXT%% This effectively reads as an if statement: if (money = 100) { text } You can also use other conditions like greater than >, less than <, not !=, etc. Based on this idea, you can string together a full on-page variable condition statement with multiple checks that can change the text depending on a given variable value. %%MONEY%<%100%You can't buy the gun.%%%%MONEY%=%100%You can buy the gun.%%%%MONEY%>%100%You can buy the gun and have some money to spare.%%

How do I modify text with scripts & variables?

8 days ago
Thanks for the reply! I was just reading that, but it's not working. It's just spitting out the code in preview.

I tried to use both the "script" page, and the public page. Neither are working. I keep getting the error "could not save script due to errors: did not recognize '%%'

How do I modify text with scripts & variables?

8 days ago
Oh I responded to your DM but didn't see this, didn't realize you were looking for on page variables. You do need to set variables and scripting to Advanced in the game features first though.

How do I modify text with scripts & variables?

8 days ago
I did that like a few minutes before you saw this, but it still hasn't worked.

How do I modify text with scripts & variables?

8 days ago
You wouldn't use that on the script page anyway, on page texting goes right in the normal text box.

How do I modify text with scripts & variables?

8 days ago
And are you able to view the article on On Page variables?

How do I modify text with scripts & variables?

8 days ago
Yeah, I'm reading it right now. I've tried the on-page scripting but it doesn't work. It just comes up as the code on the page itself. I'll send you a sneak peek link rn.

How do I modify text with scripts & variables?

8 days ago
Try removing the paragraph breaks as the first thing.

How do I modify text with scripts & variables?

8 days ago
No paragraph breaks!

How do I modify text with scripts & variables?

8 days ago
%%SUS%=%1%Perhaps if you present yourself as someone of use, this man will stop being surly with you. You attempt to steady your shaky hands and ignore the muscle aches, but you compose yourself.

“I happen to be a locksmith,” you say, managing a too-big smile.”I can check on the mechanic in your till!” you say.
The man gives you a suspicious look. His hands go to a dagger sheathe at his side. “You junkies think you’re so clever! Do you think you can trick me?” he growls, voice low. “Get the hell out of my sight!” he barks. You slither away before he stabs you.%%


This is the page I'm looking at anyway, just test it out with the first text block only.

How do I modify text with scripts & variables?

8 days ago
Still not working.

How do I modify text with scripts & variables?

8 days ago
You still need to close it out with %%, I didn't mean for you to remove that part too.


%% at the beginning of the text by itself means nothing to the editor.

How do I modify text with scripts & variables?

8 days ago
It works without paragraphs! I am trying to keep paragraph formatting, though. I am unsure how to do that.

How do I modify text with scripts & variables?

8 days ago
Use the same script for additional text blocks. Or try html.

How do I modify text with scripts & variables?

8 days ago
Alright! So how do I add different page choices depending on the stats?

How do I modify text with scripts & variables?

8 days ago
You just add all the links/choices onto the page as usual, and you set link restrictions on each one depending on the variable conditions that must be met.

How do I modify text with scripts & variables?

8 days ago
With keeping paragraph breaks, this is probably easier to do by manipulating the $PAGETEXT variable.

This article has a short section talking about how $PAGETEXT can be used.

How do I modify text with scripts & variables?

8 days ago
You are just going to confuse him even more!

How do I modify text with scripts & variables?

8 days ago
Factual. I'm not the most astute.

How do I modify text with scripts & variables?

8 days ago
I wish that article was a mandatory read for like 90% of these scripting questions.

How do I modify text with scripts & variables?

6 days ago
I've read through that article a few times. My dumbass doesn't really understand how to use $PAGETEXT, even after reading through Page Text Editing and the various other scripting articles. I'm still not understanding why different scripts require different symbols why does $PAGETEXT require a $ and not a %?

How do I modify text with scripts & variables?

6 days ago
$PAGETEXT is a system variable. They explain the difference in the Intermediate Scripting article.

How do I modify text with scripts & variables?

6 days ago
I see that there is a difference between user variables and system variables. User variables are defined by me, while system variables are defined how exactly? I don't see the distinction between these two. How does $PAGETEXT functionally differ from on-page variables?

How do I modify text with scripts & variables?

6 days ago
$PAGETEXT is a system variable, meaning that every story has that variable defined. When the page is loaded for the reader, the global, link and page scripts are processed in order.

You can use this by adding text to the $PAGETEXT buffer by doing something along the lines of $PAGETEXT:=$PAGETEXT + "<p>Adding this paragraph</p>". This would add that paragraph block to the bottom of whatever else is in $PAGETEXT.

How do I modify text with scripts & variables?

6 days ago
I am learning scripts and variables, it is not easy, but it is good when it works !!

Based on articles, $ is for scripts coded into the site's system. You can use $ to put items in your reader's inventory without them clicking it ! I think, when changing the page text, $ is for items and % is for variables.

How do I modify text with scripts & variables?

6 days ago
$PAGETEXT is literally the text on the page. There's multiple ways to do most things in the editor, and certain situations where it would make more sense to use $PAGETEXT than other options. (I'm pretty sure it can be manipulated globally for one thing.)

I don't know if it would be the most convenient thing for what you're trying to do right now, but there's really just four major ways to do things with variables and I think the whole concept would be less daunting for you once you get a handle on them and actually inderstand what your options are as far as changing a number and having the game react.

How do I modify text with scripts & variables?

5 days ago
Thank you, I will check it.

How do I modify text with scripts & variables?

5 days ago
3iguy with the wrong account, or a bot?

How do I modify text with scripts & variables?

6 days ago
I haven't done anything with item states, but in the page script just use the sample text from the article Gryphon linked and then change it and the variable to match yours.