WatchNon-threaded

Forums » Advanced Editor Forum » Read Thread

Talk about it. Ask for help on it. Compliment it.

Variable not working in $Pagetext script

4 months ago

So I have this thing where you try to get as much money as possible, and at the bottom of every page I have "Money: $%%MONEY%%'. (I didn't select the show up on every page thing because I wanted the dollar sign; if anyone knows how to have a consistent prefix for the variable, that would also be appreciated.) Now, on this page, if you go somewhere else and come back, I made the page say something else with $PAGETEXT, however, at the very bottom, where I said 'Money: $%MONEY' and previewed it, it just literally said: "Money: $%MONEY". I've also tried %%MONEY%%, %MONEY%, %%MONEY, but it doesn't seem to work.

I would upload a picture, but for some reason it's really hard to do that on this site, so I guess that's that.

Variable not working in $Pagetext script

4 months ago
Upload screenshots to imgur or to another site intended for image hosting. The size limit is here for a reason and really only intended for forum avatars and inventory icons.

And a link to the game would be useful as well.

Variable not working in $Pagetext script

4 months ago

I'm not sure for the game you mean the link to the reading thing or the editing thing, but anyway.

The imgur link

Storygame link

(Choose the 'Get rich' option, ground floor, south, change mind, then you'll see the problem I was talking about. Also maybe some feedback would be helpful, but I'll understand if there isn't any.)

Variable not working in $Pagetext script

4 months ago
Okay well just from the screenshot, $%MONEY will not do anything, that's not how displaying variables works. You'll want %%MONEY%%, or just set the variable to always show itself when you create it.

If there's a further issue in the game itself I'll have a look later when I can.

Variable not working in $Pagetext script

4 months ago
Oh, lol. Looking again, you've got the scripting box open and you're doing everything hilariously wrong. Take a look at articles on how $PAGETEXT works. Although I don't think it's needed for the simple money display since that would be handled written on page in the normal text box.

Variable not working in $Pagetext script

4 months ago

Concerning your previous comment, (as mentioned in my first comment), I have tried %%MONEY%%, among other things. I didn't make the variable always show itself, because then it would be: Money: 1, instead of the Money : $1 that I wanted (if there is a way to make it always have the dollar sign before the value, that would be nice to know).

I've also read the scripting articles, but I'm not quite sure what I'm doing "hilariously wrong." Thanks for you help so far, by the way.

Variable not working in $Pagetext script

4 months ago
%%MONEY%% directly in the box with the normal game text will show the variable amount. The examples you had were something different. You can add in any way of framing the amount you like, but you need %%MONEY%% to make it show up in the first place.

What you were showing in the screenshot didn't look correctly formatted for $PAGETEXT (see here: https://chooseyourstory.com/help/articles/article.aspx?ArticleId=65) but for your specific problem the issue seems to be that you're literally telling it to display "Money: $%%MONEY%%" as part of the text.

I just took a quick look so I might be missing something, maybe someone else can straighten this out completely. But another thing you might want to check is that all your scripts are in plain text. I notice your apostrophes are getting replaced with special characters by the RTE, so it may be doing the same with quotation marks.

Variable not working in $Pagetext script

4 months ago

Hmm, ok, I've tried putting %%MONEY%% outside the quotation marks, but that gave me an error. I'm not sure where the RTE special characters thing is, but I'll look in to it further. Maybe I've bitten off more than I could chew for my first storygame.

Well, thanks for your help and stuff. I really like how helpful people are on this site.

Variable not working in $Pagetext script

4 months ago
If you're using the RTE, you should probably turn that off.

Variable not working in $Pagetext script

4 months ago

Do you mean turn it off for the entire storygame, or turn it off for the script?

 

Edit: Also, is it better to use the extension?

Variable not working in $Pagetext script

4 months ago
Turn it off for the entire world, if you can. The issue with RTE, as mizal implied, is that it messes with many, many special characters. And that applies if you have the editor on the site on, or even if you copy from something else (like Word). While it can be helpful if you are doing very basic things, like just writing, I feel like it does more harm than good if you're trying to do anything else.

Variable not working in $Pagetext script

4 months ago
Ok, thanks, I've disabled RTE for everything (though now my special characters are a mess...). However, pertaining my original question, the %%MONEY%% thing still doesn't work. Also, I am using the extension, but I'm not sure if the normal box is better.


















Thanks for you help.

Variable not working in $Pagetext script

4 months ago
I cannot see your pages and code (mizal can). This should work if you actually have a variable named MONEY: 1. Create a link to a new page. 2. Edit that new page text (Where it says, "This is a new page") 3. Leave that text there, just press enter and put in the %%MONEY%% bit. 4. Save, exit, and test it. When you get to that page, you should see the value of the variable. 5. Edit and update to your heart's content.

Variable not working in $Pagetext script

4 months ago
The thing is, I made it so the first time you go in a room, it gives you all the info. Then, the next time you enter, it says something else. I did this with $Pagetext (here is the bottom of the script: https://imgur.com/a/rJNSbvr), however the %%MONEY%% literally prints as "%%MONEY%%". What I'm planning to do is to just select the "show on every screen" thing for the variable.

Two questions: 1. Is there a way to put a prefix before the score (such as Money: $[money]) (which is why I used "Money: $%%MONEY%% on every page instead of the show on every screen thing)? 2. Is there a way to add decimals to variables? Because I tried to add, say, a quarter to the total amount, but it doesn't let me add 0.25.

Otherwise, I guess that's it for this thread, thanks for all your help (and mizal).

Variable not working in $Pagetext script

4 months ago
Oh.

You're in $PAGETEXT.

Yeah, that's completely different. Try putting a space between the dollar sign and the percent sign?

Variable not working in $Pagetext script

4 months ago
Hmm, I tried, but it just printed $ %%MONEY%%. It's okay, though, since I've decided to just display it on every page regardless of the dollar sign. Thanks for everyone's help.

Variable not working in $Pagetext script

4 months ago
You can't use on-page scripting in a script box, only directly on a page itself.

To show money on a page with a dollar sign, just do it like this:

Money: $%%Money%%

And variables all round, so there are no decimals.

Variable not working in $Pagetext script

4 months ago
Oh...right, okay, thanks. So I'm guessing there's no way to actually make $Pagetext say '$ [actual money]'. Ok, thanks for telling me, I guess I learned something today.

Variable not working in $Pagetext script

4 months ago

If you have $PAGETEXT := $PAGETEXT + "Money:  " + %MONEY that should work.

Variable not working in $Pagetext script

4 months ago
You, my friend, are a genius. Can't believe this took me almost a week to figure it out, thanks!