Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Variables + weird text colors in page script

13 years ago
I can't figure out how to display variables in $PAGETEXT - related page scripts! %%VARIABLENAME%% used to work, but I guess something messed up while things on the site were being updated. I looked back at a different storygame which successfully displayed variables with the global page script, and when I checked said script, somehow part of that script became " $PAGETEXT := $PAGETEXT + "Your HP: "+%PLYRHP+" / "+%PLYRMAXHP ". And neither of those work, either! (By the way, I can't preview the story to see if these work in the story proper, even though everything's there and there shouldn't be any errors, but that's neither here nor there, and either way I'm not too interested in playing through it right now.) Secondly, I've been fiddling with text colors. They work fine in the normal page text, but put them in the page script and it does whatever the heck it wants with them. When I type 'white' or '#ffffff', text becomes cyan. When I type 'black', it becomes dark green. Basically whatever color code I use, it becomes one color that totally isn't it, except, oddly, #000000, which just looks black. What's going on? Does this belong in the Bugs section!?

Variables + weird text colors in page script

13 years ago

 Wouldn't this: $PAGETEXT := $PAGETEXT + "Your HP: "+%PLYRHP+" / "+%PLYRMAXHP "

Actually be This: ?
 $PAGETEXT := $PAGETEXT + "Your HP: %%PLYRHP%% / %%PLYRMAXHP%%"

Variables + weird text colors in page script

13 years ago
I believe that I typed it in as %%PLYRHP%%, etc., but it somehow got corrupted. Not that putting '%%' around the variable name is working with my latest project's page scripts, either. By the sound of it, showing variables through the page script still works for you, so...this is just confusing.

Variables + weird text colors in page script

13 years ago

Try this (using your own variables of course). It works for me in this context:

$PAGETEXT := $PAGETEXT + "Test Spoon = " + %SPOONED
 

Yours ?:

$PAGETEXT := $PAGETEXT + "Your HP: " + %PLYRHP + " / " + %PLYRMAXHP

Variables + weird text colors in page script

13 years ago
AAAAAAAAAH!! I found out what one of my problems was! I was including variables within the quotes in my latest storygame, so of course they weren't showing up the right way. Thanks, BerkaZerka! But there's still the matter of weird text colors, because I swear I put in the hex code '#ffffff' and my text turned cyan.

Variables + weird text colors in page script

13 years ago

For colored text in Scripts, try rbg code instead. I note it works fine for text, but cannot color variables, like you can on the text editor itself.

THIS WORKS (for the text, but not the variable (note changing double quotes around color to single quotes):

$PAGETEXT := $PAGETEXT + "<span style='color: rgb(0, 255, 0);'> Test Spoon = </span>" + %SPOONED


THIS DOES NOT WORK, because while it works for text, it changes the variable to text:

$PAGETEXT := $PAGETEXT + "<span style='color: rgb(0, 255, 0);'>GREEN COLOR: %%SPOONED%%</span>"

Variables + weird text colors in page script

13 years ago
PERFECT!! Thanks again, because now all of my present scripting problems have been solved.