Non-threaded

Forums » Advanced Editor Forum » Read Thread

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

Code in page script

4 years ago
So... I've come up with a code for the character's name, and I'm editing the page script so that different text pops up depending on different events that happen in the game... And have quickly discovered that if you put the code for the character's name in the page script, it just shows up as... Well... Code.

Don't suppose there's any way to fix this? >.<

Code in page script

4 years ago
I’m guessing you used the code with the on page variable checking if each character is each letter of the alphabet (%%CHAR1%=%1%A%%%%CHAR1%=%2%B%%... all the way to %CHAR8 or whatever), and not just given the reader the option between a few different names. I’ve written a long story like this, and it’s a HUGE pain and source of numerous typos, especially when page script is used. I’m sure there is a way of doing this, but the way I’m thinking of is so horrendously long winded that multiple page texts depending on different variables would require a disgusting amount of effort for a small amount of personalisation.

I recommend minimising use of page script if you can and where you do use it just try to phrase things so the name of the character isn’t used. It was bad enough writing multiple options just for male or female dear god...

But who knows, maybe Brad’s wizardry can save you.

Code in page script

4 years ago
I guess I could always just have different pages for each scenario. Shouldn't take too much longer. ^_^

Code in page script

4 years ago
BD has js for advanced names which, if tweaked properly, I believe could save you a lot of trouble. @BradinDvorak

Code in page script

4 years ago

Yeah, though it needs a bit of setup. It requires a global page script and a page for the player to enter their name.

Global Page Script

This script sets it up so that the name is at max 12 letters long; can only contain letters, accented letters, dashes, and apostrophes; is automatically capitalized; and replaces every instance of $$NAME$$ on the page.

$PAGETEXT := "<script src='https://cdn.jsdelivr.net/gh/BradinDvorak/CYS-plugins@d58d4e8a1431a76bd2c30a7e9ebef9c6626b6212/multivariables/multivariables.min.js'></script>
<script>
var multiVariable = new MultiVariable();

multiVariable.add({
  filter: 'NAME_INTERNATIONAL',
  input: 'playerName',
  length: 12,
  prefix: 'NAME',
  replace: '$$NAME$$',
  transform: 'NAME'
});
</script>" + $PAGETEXT

Name Input Page

All this page needs in its HTML is an input element with the appropriate id.

<p>What is your name?</p>
<input id="playerName" type="text">

The page also needs a single "accept/continue" link with a link script to prevent the player from continuing with an empty name.

IF %NAME0 = 0 THEN $DEST := @NONE

On any following page, you just put "$$NAME$$" wherever you want the name to appear.

Code in page script

4 years ago
Is this the power of Js!? I need to get on that shit...

Code in page script

4 years ago
PoF part 1 has a list of names to choose from.

You just outed yourself as not having read PoF yet. I bet you're so embarrassed right now, and you should be.

Code in page script

4 years ago
I’m horrified