# Mygame.js file won't open

**URL:** <https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235>\
**Category:** ChoiceScript Help\
**Created:** [April 3, 2013, 7:13pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235 "2013-04-03T19:13:33Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![computermouse123](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@computermouse123](https://forum.choiceofgames.com/u/computermouse123)\
**Post date:** [April 3, 2013, 7:13pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/1 "2013-04-03T19:13:33Z")

</div>

So, I want to edit the variables, and to do that I have to open the mygame.js file. But this message keeps on coming up:  
Line: 23  
Char: 1  
Error: ‘SceneNavigator’ is undefined  
Code: 800A1391  
Source: Microsoft JScript runtime error

Has anyone come across this and been able to fix it? And if so, please tell me how.

---

<div class="post-metadata">

**Author:** ![2Ton](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/2ton/32/786_2.png) [@2Ton](https://forum.choiceofgames.com/u/2Ton)\
**Post date:** [April 3, 2013, 7:18pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/2 "2013-04-03T19:18:43Z")

</div>

Yah I had it before, what you do is download notepad ++

[http://notepad-plus-plus.org/](http://notepad-plus-plus.org/)

then after its installed edit it the document with notepad

---

<div class="post-metadata">

**Author:** ![computermouse123](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@computermouse123](https://forum.choiceofgames.com/u/computermouse123)\
**Post date:** [April 3, 2013, 7:24pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/3 "2013-04-03T19:24:14Z")

</div>

Now here’s another problem: after opening it in Notepad++, I can’t figure out how to add variables. I know I sound really new at this, but that’s because I am ^^;

---

<div class="post-metadata">

**Author:** ![RETowers](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/retowers/32/21477_2.png) [@RETowers](https://forum.choiceofgames.com/u/RETowers)\
**Post date:** [April 3, 2013, 7:29pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/4 "2013-04-03T19:29:43Z")

</div>

First, you’ll probably want to start with the [tutorial](http://choicescriptdev.wikia.com/wiki/A_Basic_Tutorial) on the wiki: I believe [this](http://choicescriptdev.wikia.com/wiki/Mygame.js) is probably the page you want to look at though.

> **[A Basic Tutorial](https://choicescriptdev.fandom.com/wiki/A_Basic_Tutorial)**
>
> Welcome to A Basic Tutorial, and indeed, to the wonderful (if sometimes wacky!) world of ChoiceScript Game Development. There are a number of basics concepts that are necessary to understand in learning, using and discussing ChoiceScript, and this...

  

> **[Mygame.js](https://choicescriptdev.fandom.com/wiki/Mygame.js)**
>
> This article is aimed at beginners to ChoiceScript. However, if you have not already done so then the best place to start would be with the very first article in this Introduction To ChoiceScript Game Development series of linked articles: A Basic...

---

<div class="post-metadata">

**Author:** ![Galador](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@Galador](https://forum.choiceofgames.com/u/Galador)\
**Post date:** [April 3, 2013, 7:30pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/5 "2013-04-03T19:30:30Z")

</div>

Just follow the format that is already given to you as examples. Go to a new line underneath the last variable (or get rid of the example variables) and put four spaces, a comma, the name of the variable you want to make, a colon, another space, and either a number or a word to set the starting value for the stat. When that is finished, go to the next line and repeat for your next variable. I hope that answers your question!

---

<div class="post-metadata">

**Author:** ![Galador](https://avatars.discourse-cdn.com/v4/letter/g/90db22/32.png) [@Galador](https://forum.choiceofgames.com/u/Galador)\
**Post date:** [April 3, 2013, 7:31pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/6 "2013-04-03T19:31:30Z")

</div>

Just follow the format that is already given to you as examples. Go to a new line underneath the last variable (or get rid of the example variables) and put four spaces, a comma, the name of the variable you want to make, a colon, another space, and either a number or a word to set the starting value for the stat. When that is finished, go to the next line and repeat for your next variable. I hope that answers your question!

---

<div class="post-metadata">

**Author:** ![2Ton](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/2ton/32/786_2.png) [@2Ton](https://forum.choiceofgames.com/u/2Ton)\
**Post date:** [April 3, 2013, 7:34pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/7 "2013-04-03T19:34:11Z")

</div>

Oh, np no worries, I was in your shoes once, and I did the exact same thing. this is like deja vu its just im in the shoes of the other guy.

Well okay here your gonna see something like this

```

stats = {
    leadership: 50
    ,strength: 50
   
};

debugStats = {

};

```

You just go below strength and put a comma then put in the stat then you could put a number, true or false, or a name here ill give you examples of each

```

stats = {
    leadership: 50
    ,strength: 50
    ,name: "2Ton"
    ,sleeping: false
    ,money: 0
   
};

debugStats = {

};

```

the debug stats you dont need to touch, its just there to be debug copy over your stats so putting anything inside of it would be useless but dont take it out its needed

---

<div class="post-metadata">

**Author:** ![computermouse123](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@computermouse123](https://forum.choiceofgames.com/u/computermouse123)\
**Post date:** [April 4, 2013, 5:57pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/8 "2013-04-04T17:57:32Z")

</div>

Thanks for trying to help, but it’s still not working ☹ I don’t know what I’m doing wrong, each time I open ‘index’ after editing the variables it says ‘invalid character’. This is what my formatting looks like (just as a test):

stats = {  
cats: 50  
,shoes: 50  
};

It still refuses to work :’(

---

<div class="post-metadata">

**Author:** ![computermouse123](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@computermouse123](https://forum.choiceofgames.com/u/computermouse123)\
**Post date:** [April 4, 2013, 5:58pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/9 "2013-04-04T17:58:40Z")

</div>

And sorry if it doesn’t look like there are any spaces indenting “cats” and “shoes” up there ^. There are, but my iPad doesn’t want to show them.

---

<div class="post-metadata">

**Author:** ![2Ton](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/2ton/32/786_2.png) [@2Ton](https://forum.choiceofgames.com/u/2Ton)\
**Post date:** [April 4, 2013, 6:04pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/10 "2013-04-04T18:04:38Z")

</div>

That looks right… but there may be something in the file that is screwing it up, Can you send the file to me?

---

<div class="post-metadata">

**Author:** ![computermouse123](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@computermouse123](https://forum.choiceofgames.com/u/computermouse123)\
**Post date:** [April 4, 2013, 6:09pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/11 "2013-04-04T18:09:13Z")

</div>

Okay, now I’ve got another problem ^^; But don’t worry, I think I’m getting closer. Now as long as I add the strength and leadership variables, I’m not getting any errors. But when I add other variables on to it, they don’t show up in the index.

---

<div class="post-metadata">

**Author:** ![2Ton](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/2ton/32/786_2.png) [@2Ton](https://forum.choiceofgames.com/u/2Ton)\
**Post date:** [April 4, 2013, 6:16pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/12 "2013-04-04T18:16:11Z")

</div>

Oh yah dont capitalize stats, thats for future references.

Anyway, I think I see your problem… I misunderstood it at first… this is what you wanna do…

You can erase the strength and leadership and put it the way you had it, THEN you go to your scenes folder and clock on choicescript\_stats

then erase the leadership and strength from that and ass the stats you put in

---

<div class="post-metadata">

**Author:** ![Ioelet](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/ioelet/32/929_2.png) [@Ioelet](https://forum.choiceofgames.com/u/Ioelet)\
**Post date:** [April 4, 2013, 7:09pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/13 "2013-04-04T19:09:44Z")

</div>

“invalid character” could be a result of copy and paste. I realized that sometimes word converts your symbols like ",-;.\_: into something that looks similar but is not the same (just for style, I guess). If you copy and paste those symbols into mygame.js it can’t interprete them as code but as some kind of strange unknown symbols.

Make sure your : are really :, your " are " and so on…

---

<div class="post-metadata">

**Author:** ![computermouse123](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@computermouse123](https://forum.choiceofgames.com/u/computermouse123)\
**Post date:** [April 4, 2013, 7:52pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/14 "2013-04-04T19:52:16Z")

</div>

Thanks, I finally got it to work!

---

<div class="post-metadata">

**Author:** ![2Ton](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/2ton/32/786_2.png) [@2Ton](https://forum.choiceofgames.com/u/2Ton)\
**Post date:** [April 4, 2013, 8:07pm UTC](https://forum.choiceofgames.com/t/mygame-js-file-wont-open/1235/15 "2013-04-04T20:07:33Z")

</div>

Glad to hear, if you need anything else dont be afraid to ask
