# First time writing with choicescript. Scripting error

**URL:** <https://forum.choiceofgames.com/t/first-time-writing-with-choicescript-scripting-error/553>\
**Category:** ChoiceScript Help\
**Created:** [June 19, 2012, 4:51pm UTC](https://forum.choiceofgames.com/t/first-time-writing-with-choicescript-scripting-error/553 "2012-06-19T16:51:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dno256](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/dno256/32/671_2.png) [@dno256](https://forum.choiceofgames.com/u/dno256)\
**Post date:** [June 19, 2012, 4:51pm UTC](https://forum.choiceofgames.com/t/first-time-writing-with-choicescript-scripting-error/553/1 "2012-06-19T16:51:09Z")

</div>

I got started with choicescript yesterday, and after spending some time I have got a very small “Demo” together. But when I try to open it in Index, I get an error saying scripting error. Here’s the code. I can’t spot where the error seems the be:

\*Create Strenght  
\*Create Creativity  
\*Create Year  
\*Create Survival Skills  
\*Create Wilderness Knowledge  
\*Set Wilderness Knowledge 0  
\*Set Survival Skills 10  
\*Set Year 0  
\*Set Sanity 100  
\*Set Engineering 10  
\*Set Strenght 10  
\*Set Creativity 10

Ah summmer! The time for vacation. When you got on the plane to Athens this morning you just wish you weren’t going alone.  
You were first reluctant to go without her, but she didn’t think you’d have any fun alone in your apartement by yourself, so she said you go a week in advance.  
But once you got on the plane, you saw that she’d ordered a nice first-class ticket for you. Maybe things wasn’t all that bad after all?  
You can survive a week without your girlfriend.

In boredom you take out your ticket. What name is written on it?  
\*Choice  
# John  
\*Set name “John”  
\*Goto Occupation  
# Daniel  
\*Set name “Daniel”  
\*Goto Occupation  
# Donald  
\*Set name “Donald”  
\*Goto Occupation  
#None of these are written on the ticket  
Oh! What name is then?

```
	\*input_text name

```

\*Label Occupation  
Not exactly the name you would’ve chosen for yourself, but your mother was always a quirky one. Now that you’ve already opened your wallet you decide to  
double check that you have your other cards with you. Ah! Your from work. What was your occupation again?  
\*Choice  
#Painter  
\*Set Occupation “Painter”  
\*Set Creativity %+40  
\*Goto PainterHobby  
#Navy Seals Soldier  
\*Set Occupation “Soldier”  
\*Set Strenght %+30  
\*Set Survival Skills %+30  
\*Goto SoldierHobby  
#Carpenter  
\*Set Occupation “Carpenter”  
\*Set Creativity %+15  
\*Set Engineering %+30  
\*Goto CarpenterHobby  
#Video game Designer  
\*Set Occupation “Video game Designer”  
\*Set Creativity %+15  
\*Set Survival Skills %+15  
\*Set Engineering %+15  
\*Goto GameHobby

Thank you for any help.

---

<div class="post-metadata">

**Author:** ![Vendetta](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/vendetta/32/533_2.png) [@Vendetta](https://forum.choiceofgames.com/u/Vendetta)\
**Post date:** [June 19, 2012, 5:19pm UTC](https://forum.choiceofgames.com/t/first-time-writing-with-choicescript-scripting-error/553/2 "2012-06-19T17:19:48Z")

</div>

Don’t use Capital Letters on any commands, label names or variable names, e.g.

it should be  
\*label occupation  
not  
\*Label Occupation  
etc.

---

<div class="post-metadata">

**Author:** ![dno256](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/dno256/32/671_2.png) [@dno256](https://forum.choiceofgames.com/u/dno256)\
**Post date:** [June 19, 2012, 5:25pm UTC](https://forum.choiceofgames.com/t/first-time-writing-with-choicescript-scripting-error/553/3 "2012-06-19T17:25:56Z")

</div>

Ah thank you so much

---

<div class="post-metadata">

**Author:** ![dno256](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/dno256/32/671_2.png) [@dno256](https://forum.choiceofgames.com/u/dno256)\
**Post date:** [June 19, 2012, 5:33pm UTC](https://forum.choiceofgames.com/t/first-time-writing-with-choicescript-scripting-error/553/4 "2012-06-19T17:33:24Z")

</div>

Removed all of the capital letters. Still getting Script Error. My Internet Explorer doesn’t work so I can’t figure out exactly what’s wrong.

---

<div class="post-metadata">

**Author:** ![Vendetta](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/vendetta/32/533_2.png) [@Vendetta](https://forum.choiceofgames.com/u/Vendetta)\
**Post date:** [June 19, 2012, 5:33pm UTC](https://forum.choiceofgames.com/t/first-time-writing-with-choicescript-scripting-error/553/5 "2012-06-19T17:33:57Z")

</div>

Some other basic guidelines:

-no spaces allowed in label names or variable names, so use either:

wildernessknowledge  
or  
wilderness\_knowledge

-generally best to avoid \*create and instead define your variables in mygame.js file. If you look in the example provided you’ll see the required layout–just replace those with your own, remembering not to use capitals or spaces in the names. You can define as many different variables as you need (and will then always have the full list there to refer to).

Without being able to use IE (the only browser properly displaying error messages) it’s pretty much impossible to develop a CS game.

---

<div class="post-metadata">

**Author:** ![dno256](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/dno256/32/671_2.png) [@dno256](https://forum.choiceofgames.com/u/dno256)\
**Post date:** [June 19, 2012, 6:55pm UTC](https://forum.choiceofgames.com/t/first-time-writing-with-choicescript-scripting-error/553/6 "2012-06-19T18:55:03Z")

</div>

Okay. Finally after much googling got IE to work. Fixed all of the above. Now I get an error that says: “Cannot get the value for setStartingStatsClone: Object is zero or undefined”

I just don’t get it Thank you for helping 🙂

---

<div class="post-metadata">

**Author:** ![eposic](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/eposic/32/198508_2.png) [@eposic](https://forum.choiceofgames.com/u/eposic)\
**Post date:** [June 20, 2012, 3:40am UTC](https://forum.choiceofgames.com/t/first-time-writing-with-choicescript-scripting-error/553/7 "2012-06-20T03:40:51Z")

</div>

@dno256, in the code you posted, in addition to what @Vendetta has already pointed out, you needed to create variables for sanity, engineering, name, and occupation. If you don’t have those declared in your mygame.js file or in \*create commands, then you’ll get a script error from that. Not sure what that “setStartingStatsClone” problem is, but it sounds like it might have something to do with your stats variable in mygame.js. If you have any error in the mygame.js file, your browser will not recognize any of the code in it as valid, which could cause all sorts of problems in the base CS interpreter code that is expecting it to be there. Maybe you could post your mygame.js code as well.

---

<div class="post-metadata">

**Author:** ![atlaloire](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/atlaloire/32/198588_2.png) [@atlaloire](https://forum.choiceofgames.com/u/atlaloire)\
**Post date:** [March 1, 2013, 1:02pm UTC](https://forum.choiceofgames.com/t/first-time-writing-with-choicescript-scripting-error/553/8 "2013-03-01T13:02:28Z")

</div>

So I got this same error, the error popped on the first variable which had no problem, turned out I forgot to set a variable. I just claimed it like ,strength: and left it there, so check to make sure you set all your variables to something, even if its 0 or “”

---

<div class="post-metadata">

**Author:** ![FairyGodfeather](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/fairygodfeather/32/16709_2.png) [@FairyGodfeather](https://forum.choiceofgames.com/u/FairyGodfeather)\
**Post date:** [March 1, 2013, 1:14pm UTC](https://forum.choiceofgames.com/t/first-time-writing-with-choicescript-scripting-error/553/9 "2013-03-01T13:14:37Z")

</div>

Oops. Didn’t note the huge time difference between the original post and Atlaloire’s. Atlaloire, you may have been better starting a new topic.
