Hi. I could find no easy way to have words as variables. My method was very long, and I basically copied the code, and pasted it into a page script wherever I wanted the custom word to appear. Hopefully you can make sense of what I'm talking about here:
I wanted the player to be able to enter the name of their character. I chose a 10 letter long name limit, and made 10 variables, letter1, letter2, etc.
I then had a page where they could create their name. It consisted of a link that was 'I'm finished', and then one link for each letter of the alphabet. The links all diected back to the same page, except the 'I'm finished' link that entered the rest of the game.
The script for the page did this:
IF %LETTER1 = 1 THEN $PAGETEXT := $PAGETEXT + "A"
IF %LETTER1 = 2 THEN $PAGETEXT := $PAGETEXT + "B"
and so on through the alphabet for Letter1. I made letter1 display a capital letter, for the start of their name.
I had a variable called %CURRENT which was the current letter. For example, the first letter, or the second letter. When the player clicked on one of the links on the page it would assign the letter they clicked to the current variable. So if %CURRENT was 5, and they clicked on a D, then the script for the D choice would say
IF %CURRENT = 1 THEN %LETTER1 := "D"
IF %CURRENT = 2 THEN %LETTER2 := "D"
and so on, through the 10 possible letters the player can select for the word.
Then it adds +1 to %CURRENT, so that when the page is redrawn, and they click a letter again, the current letter variable is the next letter in the word.
Then I made a set of A to Z's for letter2, letter3, and so on, displaying a lower case letter.
Using $PAGETEXT := $PAGETEXT + "text" simply adds text to the last position on the screen.
So I would display the page text up to the point the person's name is mentioned, then have the 10 letter check against A to Z to write the person's name, then use pagetext = pagetext + and write the rest of the page's text. That way, the name appears on the screen as a regular part of the text.
I don't know if this is anything like the script you have written. It's certainly more than two lines long. As far as I know, there's simply no way to assign actual text to a variable using scripting - only assigning numbers. To display player entered text, you have to work it a letter at a time using numeric variables.