Syntax Error on Dreamweaver


Here I show how really fresh I am at coding.

I am currently using Dreamweaver to read and write mygame.js. While trying to write in the default and debug value of stats, I keep getting a syntax error. Always, it will be just one line.

So this is fine:
stats = {
brutality: 50
,Wisdom: 50

But if I do this, I get a syntax error:
stats = {
Name: Unnamed
brutality: 50
,Wisdom: 50

In choicescript_stats.txt, it looks like this:
text Name
opposed_pair brutality

On another note, how do I create a new stat variable?


You need quotation marks around the unknown for the name.


I am getting an “Expected '}” message and “unable to get value of the property ‘setStartingStatsClone’: object is null” or undefined.


You need a comma , before brutality as well.


stats = {
Name: Unnamed
,brutality: 50
,Wisdom: 50
,another_variable: true
,another_still: “Hello”

Add as many variables as you need this way.


Now I’m getting a message which says the variable “name” is not existent.


Yeah you still need quotes on Unnamed


And now it tells me that it needs to start with a “text”, “percent”, or “opposed_pair”.

That’s only needed for the txt file, right?


You only need that for the stat chart here look at this


The strange thing is that when I put quotation marks, just as you suggested, it tells me that it’s a non-existent variable. It also points out a line 2, which makes me suspect it’s the stat chart.

Here’s how my start chart look:

text Name
text Age
opposed_pair Compassion


Can I see the exact code you’re using


ScarletGeisha, you need the quotation marks in your mygame.js file. Don’t put quotation marks in the stats file.


I did put the quotation marks in mygame.js.


@ScarletGeisha When copying things into the forum, put < code> on the line before and < /code> on the line after (removing the spaces of course). That will preserve the spacing before the text (which is rather vital).

Your mygame.js file should look like this:
stats = {name:"unnamed",brutality: 50 ,wisdom: 50 };

  1. Note the fact that the ‘n’ on name is not capitalized. Variables are capitalization sensitive (IIRC). So don’t capitalize your variables in the mygame.js file.
  2. Note the “quotation” marks around Unnamed. This tells ChoiceScript that “Unnamed” is not supposed to be another variable.
  3. Note the comma before “brutality”. This tells ChoiceScript that this is a new variable.

Your stat chart should look like this:
*stat_chart text Name text Age *line_break*stat_chartopposed_pair Compassion Wisdom
Note the spacing. That is necessary for everything to work right. Also, note that commands will not work inside of a stat chart (IIRC), so drop out of the stat chart, add your commands, and use a second stat chart.

If you’re still having troubles, make sure to post everything you have in the file, along with the specific error (IIRC the error sometimes comes out garbled, so try different internet browsers if it is).


Now that solves the problem! Thank you Toa, Andy, and Reaeroa for helping me with this.


Your welcome. Also note that if you capitalize the first letter of a variable which contains text when actually using it, it will capitalize the first letter of the text. Using the above ‘{name}' comes out 'unnamed' while '{Name}’ comes out ‘Unnamed’.


By the way, how do I bold the text in the stat chart?


That is automatic.