Error - Help!


#1

I’m getting an error and I can’t figure out why.

This is the error, which shows up when I try to access my stat screen:
{message:"Result of expression \‘variable.toLowerCase\’ [undefined] is not a function. ",line:543,sourceId:354648424,sourceURL: “file:///Users/Sienna/Desktop/GAME/scene.js”,expressionBeginOffset: 17252,expressionCaretOffset:17272,expressionEndOffset:17274,name:“TypeError”}

This is the code for the stat screen. And yes, I’ve set the variable charm in mygame.js. It equals 5.
`
*temp skill
*set skill 0
Skills:
*line_break
*if (charm > 0)
*set skill {charm}
Charm:
*gosub skill_level
*finish
*finish

*label skill_level
*if (skill > 0) and (skill < 10)
Novitiate
*return
*if (skill >= 10) and (skill < 20)
Novice
*return
*if (skill >= 20) and (skill < 30)
Amateur
*return
*if (skill >= 30) and (skill < 40)
Apprentice
*return
*if (skill >= 40) and (skill < 50)
Adept
*return
*if (skill >= 50) and (skill < 60)
Journeyman
*return
*if (skill >= 60) and (skill < 70)
Specialist
*return
*if (skill >= 70) and (skill < 80)
Expert
*return
*if (skill >= 80) and (skill < 90)
Guru
*return
*if (skill >= 90) and (skill < 100)
Master
*return
*if (skill = 100)
Grandmaster
*return
*return`

Help please!


#2

Line 4, “{charm}” I do not think the {} are supposed to be there.

(A bit more difficult to find the error when it points you to a .js file, isn’t it?)

Edit:
'Cause in the example in the advanced help files (example below):
*set honesty 30 *set virtue "honesty" *set score {virtue} Your ${virtue} score is ${score}
The curly parenthesis are to set “score” to the value of “honesty”.
So: line four of that example could be written as:
*set score honesty
without changing the output. (It would change the nature of the four lines, but that is a separate matter.)

Which, assuming I’m correct in my guesses, that means “*set skill {charm}” isn’t like writing “*set skill #”. I think the error is that it ends up treating the # as a variable when you type {charm} with charm equaling a number, and therefore tries to pull out what the variable has been set to.


#3

I was just about to post that I had figured out the problem came from that line, but didn’t know why… thanks for helping, that worked.

So I guess the {} are specifically for ref variables then? Like if I said:
*set skill “charm”
then I could say:
*set skill_value {skill}
which would make skill_value = charm? With no errors?