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:
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
-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.
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”
@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.
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 “”