Syntax Error on Dreamweaver


#1

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:
*stat_chart
text Name
*line_break
opposed_pair brutality
Compassion
Wisdom

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


#2

You need quotation marks around the unknown for the name.


#3

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


#4

You need a comma , before brutality as well.


#5

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

Add as many variables as you need this way.


#6

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


#7

Yeah you still need quotes on Unnamed


#8

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?


#9

You only need that for the stat chart here look at this http://www.choiceofgames.com/make-your-own-games/customizing-the-choicescript-stats-screen/


#10

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:

*stat_chart
text Name
text Age
*line_break
opposed_pair Compassion
Wisdom


#11

Can I see the exact code you’re using


#12

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


#13

I did put the quotation marks in mygame.js.


#14

@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).


#15

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


#16

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’.


#17

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


#18

That is automatic.