# Errors Before My Game Starts?

**URL:** <https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175>\
**Category:** ChoiceScript Help\
**Created:** [March 2, 2013, 5:34pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175 "2013-03-02T17:34:49Z")\
**Posts on this page:** 20\
**Page:** 1

<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:** [March 2, 2013, 5:34pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/1 "2013-03-02T17:34:49Z")

</div>

I began working on a new game (playing Life of a Wizard inspired me to get back to my attempts to write a ChoiceScript game) and I went to test what I’d done so far, and before anything shows up on the screen regarding my game, I get two error messages, the first saying, “Expected identifier, string or number,” the second saying, “window.nav” is null or not an object." What do those even mean?! No part of my game showed up at all, so I can’t believe it is something to do with the coding, as I have never had this issue and as far as I can tell, none of my coding was even reached before the error showed up. My Internet browser also will not run any completed “Choice of” or “Hosted” games from the site anymore, so maybe it doesn’t have anything to do with my coding?

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [March 2, 2013, 5:40pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/2 "2013-03-02T17:40:26Z")

</div>

Sounds like poor formatting in mygame.js to me, could you copy and paste its contents for me?

---

<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:** [March 2, 2013, 5:56pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/3 "2013-03-02T17:56:39Z")

</div>

// Specify the list of scenes here, separated by commas, with no final comma

nav = new SceneNavigator([  
“startup”  
,“gosub”  
,“ending”  
,“death”  
]);

// Specify the default starting stats here

stats = {  
name: “Unknown”  
,race: “Unknown”  
,gender: “Unknown”  
,sexuality: “None”  
,health: “100”  
,magic: “100”  
,arrows: “25”  
,birthplace: “Unknown”  
,home: “Unknown”  
,occupation: “None”  
,good: “50”  
,stoic: “50”  
,honorable: “50”  
,willpower: “0”  
,physicality: “0”  
,scheming: “0”  
,charming: “0”  
,observant: “0”  
,impulsive: “0”  
,clean: “0”  
,vain: “0”  
,geography: “0”  
,lore: “0”  
,agriculture: “0”  
,herbalism: “0”  
,artistic: “0”  
,smithing: “0”  
,nature: “0”  
,mag\_sense: “0”  
,hunting: “0”  
,cooking: “0”  
,weather: “0”  
,quick: “0”  
,wood: “0”  
,alchemy: “0”  
,leadership: “0”  
,resourceful: “0”  
,mel: “0”  
,ran: “0”  
,ste: “0”  
,thi: “0”  
,evo: “0”  
,ill: “0”  
,enc: “0”  
,tra: “0”  
,hea: “0”  
,div: “0”  
,nec: “0”  
,geo: “0”  
,gold: “0”  
,weap: “None”  
,const: “Healthy”  
,quirk: “None”  
,stand: “Lowly Citizen”  
,name1met: “No”  
,name1name: “None”  
,name1sex: “None”  
,name1romancable: “No”  
,name1relate: “None”  
,name1occu: “None”  
,name1hadsex: “No”  
,name1race: “Human”  
,name1combat: “None”  
,name2met: “No”  
,name2name: “None”  
,name2sex: “None”  
,name2romancable: “No”  
,name2relate: “None”  
,name2occu: “None”  
,name2hadsex: “No”  
,name2race: “Human”  
,name2combat: “None”  
,name3met: “No”  
,name3name: “None”  
,name3sex: “None”  
,name3romancable: “No”  
,name3relate: “None”  
,name3occu: “None”  
,name3hadsex: “No”  
,name3race: “Human”  
,name3combat: “None”  
,name4met: “No”  
,name4name: “None”  
,name4sex: “None”  
,name4romancable: “No”  
,name4relate: “None”  
,name4occu: “None”  
,name4hadsex: “No”  
,name4race: “Human”  
,name4combat: “None”  
,lordkilenaolromancable: “No”  
,lordkilenaolrelate: “None”  
,lordkilenaolhadsex: “No”  
,ladylinellaromancable: “No”  
,ladylinellarelate: “None”  
,ladylinellahadsex: “No”  
,woodedwitchromancable: “No”  
,woodedwitchrelate: “None”  
,woodedwitchhadsex: “No”  
,mountainmageromancable: “No”  
,mountainmagerelate: “None”  
,mountainmagehadsex: “No”  
,name1heshe: “he”  
,name2heshe: “he”  
,name3heshe: “he”  
,name4heshe: “he”  
,name1hisher: “his”  
,name2hisher: “his”  
,name3hisher: “his”  
,name4hisher: “his”  
,name1hishers: “his”  
,name2hishers: “his”  
,name3hishers: “his”  
,name4hishers: “his”  
,name1himher: “him”  
,name2himher: “him”  
,name3himher: “him”  
,name4himher: “him”  
};

// Specify the stats to use in debug mode

debugStats = {  
name: “Unknown”  
,race: “Unknown”  
,gender: “Unknown”  
,sexuality: “None”  
,health: “100”  
,magic: “100”  
,arrows: “25”  
,birthplace: “Unknown”  
,home: “Unknown”  
,occupation: “None”  
,good: “50”  
,stoic: “50”  
,honorable: “50”  
,willpower: “0”  
,physicality: “0”  
,scheming: “0”  
,charming: “0”  
,observant: “0”  
,impulsive: “0”  
,clean: “0”  
,vain: “0”  
,geography: “0”  
,lore: “0”  
,agriculture: “0”  
,herbalism: “0”  
,artistic: “0”  
,smithing: “0”  
,nature: “0”  
,mag\_sense: “0”  
,hunting: “0”  
,cooking: “0”  
,weather: “0”  
,quick: “0”  
,wood: “0”  
,alchemy: “0”  
,leadership: “0”  
,resourceful: “0”  
,mel: “0”  
,ran: “0”  
,ste: “0”  
,thi: “0”  
,evo: “0”  
,ill: “0”  
,enc: “0”  
,tra: “0”  
,hea: “0”  
,div: “0”  
,nec: “0”  
,geo: “0”  
,gold: “0”  
,weap: “None”  
,const: “Healthy”  
,quirk: “None”  
,stand: “Lowly Citizen”  
,name1met: “No”  
,name1name: “None”  
,name1sex: “None”  
,name1romancable: “No”  
,name1relate: “None”  
,name1occu: “None”  
,name1hadsex: “No”  
,name1race: “Human”  
,name1combat: “None”  
,name2met: “No”  
,name2name: “None”  
,name2sex: “None”  
,name2romancable: “No”  
,name2relate: “None”  
,name2occu: “None”  
,name2hadsex: “No”  
,name2race: “Human”  
,name2combat: “None”  
,name3met: “No”  
,name3name: “None”  
,name3sex: “None”  
,name3romancable: “No”  
,name3relate: “None”  
,name3occu: “None”  
,name3hadsex: “No”  
,name3race: “Human”  
,name3combat: “None”  
,name4met: “No”  
,name4name: “None”  
,name4sex: “None”  
,name4romancable: “No”  
,name4relate: “None”  
,name4occu: “None”  
,name4hadsex: “No”  
,name4race: “Human”  
,name4combat: “None”  
,lordkilenaolmet: “No”  
,lordkilenaolromancable: “No”  
,lordkilenaolrelate: “None”  
,lordkilenaolhadsex: “No”  
,lordkilenaoldiplomacy: “None”  
,ladylinellamet: “No”  
,ladylinellaromancable: “No”  
,ladylinellarelate: “None”  
,ladylinellahadsex: “No”  
,ladylinelladiplomacy: “None”  
,woodedwitchmet: “Np”  
,woodedwitchromancable: “No”  
,woodedwitchrelate: “None”  
,woodedwitchhadsex: “No”  
,woodedwitchdiplomacy: “None”  
,mountainmagemet: “No”  
,mountainmageromancable: “No”  
,mountainmagerelate: “None”  
,mountainmagehadsex: “No”  
,mountainmagediplomacy: “None”  
,name1heshe: “he”  
,name2heshe: “he”  
,name3heshe: “he”  
,name4heshe: “he”  
,name1hisher: “his”  
,name2hisher: “his”  
,name3hisher: “his”  
,name4hisher: “his”  
,name1hishers: “his”  
,name2hishers: “his”  
,name3hishers: “his”  
,name4hishers: “his”  
,name1himher: “him”  
,name2himher: “him”  
,name3himher: “him”  
,name4himher: “him”  
};

// or just use defaults  
// debugStats = stats

Thanks so much for the quick response! Also, I purposely removed some of the scenes from the navigator since I will be making them different from what starts out there anyway. I realize that there are some “strange” variables in there, but I am planning on adding some humorous “achievements” of a sort at the very end of the game.

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [March 2, 2013, 6:28pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/4 "2013-03-02T18:28:16Z")

</div>

Have following variables have been copied and pasted from somewhere (MS Word for example)? The quotation marks need changing, I’ve fixed the top one as an example:

,name1heshe: “he”

,name2heshe: “he”  
,name3heshe: “he”  
,name4heshe: “he”  
,name1hisher: “his”  
,name2hisher: “his”  
,name3hisher: “his”  
,name4hisher: “his”  
,name1hishers: “his”  
,name2hishers: “his”  
,name3hishers: “his”  
,name4hishers: “his”  
,name1himher: “him”  
,name2himher: “him”  
,name3himher: “him”  
,name4himher: “him”

Can you see the difference?

---

<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:** [March 2, 2013, 6:43pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/5 "2013-03-02T18:43:25Z")

</div>

Wow! Thanks SO much! That honestly NEVER would have occurred to me since I have copied and pasted from MS Word before and nothing bad happened! I can’t believe that I have never copied anything with quotation marks before! I’ll try it!

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [March 2, 2013, 6:50pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/6 "2013-03-02T18:50:03Z")

</div>

No problem, though it is advisable to write choicescript straight into a text editor like Notepad ++ (or just notepad) to avoid any additional problems like that.

---

<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:** [March 2, 2013, 6:55pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/7 "2013-03-02T18:55:15Z")

</div>

Alright, I thought that would fix it, but it didn’t. Do you see anything else wrong with it, by any chance? Also, on a different note, is it possible to have a \*choice within the stat page? If not, do you know of a different way to have more than one stat screen? Even though many of the variables above will not be displayed, there are still way too many to comfortably put on one stat screen.

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [March 2, 2013, 6:58pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/8 "2013-03-02T18:58:19Z")

</div>

You can have multiple stat screens through some ‘hacking’ and you can (now) use choices on stat screens to simulate multiple pages. The latter is the “supported” method, and is much easier to implement though 🙂

As for your issue, I actually copy and pasted your mygame variables into a local copy of CS and tested it myself, at first I got an error but after fixing all of them it worked flawlessly, are you sure you got them all?

This is my set (if you want to copy and paste):

> **[stats = {name: "Unknown" ,race: "Unknown" ,gender: "Unknown" ,sexuality: -...](https://pastebin.com/vsceViGR)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

---

<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:** [March 2, 2013, 7:02pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/9 "2013-03-02T19:02:32Z")

</div>

I thought I got them all, but it’s possible I missed a couple. I’ll just paste yours and see what happens! Thanks, and again for the stat screen 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:** [March 2, 2013, 7:10pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/10 "2013-03-02T19:10:00Z")

</div>

I tried it again, and it didn’t work. I am still getting the same error. What does window.nav mean, and what does it mean when I need a string or number identifier?

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [March 2, 2013, 7:16pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/11 "2013-03-02T19:16:17Z")

</div>

The “expected string, identifier etc” error basically means there’s a syntax error in your javascript, since the only file you should have edited that is javascript based is mygame.js - it means something is up with that.

The " problem WAS causing that error, but maybe something else is too, like a missing comma or a semi colon where a colon should be etc.

windows.nav is an “object”; I’m pretty sure it’s related to the other error in this case, the j/s engine is just crashing before it defines it and something else is trying to reference it.

Suggestion? Download a fresh copy of choicescript and copy and paste the mygame.js over yours, keep your other files (and backup your variable list of course).  
If that works, you know something is up with mygame.js at least.

---

<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:** [March 2, 2013, 7:18pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/12 "2013-03-02T19:18:57Z")

</div>

So if I get a perfectly new mygame and then paste the version of the variables into it that you edited, it should work then? I haven’t touched any other part of the mygame document.

Has there been a recent java update that I neglected to download so my j/s is out of date and that is what is causing it? Could that cause the error? I don’t even know anything about java, if you couldn’t tell that on your own… Lol, you could tell that on your own- who am I kidding?

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [March 2, 2013, 7:20pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/13 "2013-03-02T19:20:06Z")

</div>

I’m not saying it \*will\* work, but if it does, you know then where your problem lies.

---

<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:** [March 2, 2013, 7:27pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/14 "2013-03-02T19:27:30Z")

</div>

Well, I tried it… It still didn’t work. It worked when I tried opening the game with a completely untouched mygame, so I know that the problem is still with the stat listings. Thanks for all of your help. I’ll post back here if I still can’t figure it out on my own.

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [March 2, 2013, 7:38pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/15 "2013-03-02T19:38:38Z")

</div>

That’s a start at least! 🙂  
I’m sure you’ll manage, if you’re really stuck, I advise uploading it to dropbox or another online source so I can actually see it running - it’s a lot easier to debug that way.

---

<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:** [March 2, 2013, 7:42pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/16 "2013-03-02T19:42:21Z")

</div>

Well, since I know for a fact that the error is with the stats, I am now going through a new mygame and adding the stats to the document 5-10 at a time and then running the game after every few added so that if there is a problem, I can figure out exactly where it is. It is tedious, but when I read through them I didn’t see anything wrong, so it is probably less work to just retype them all out. SO FAR it is working and I am about fifteen stats in.

---

<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:** [March 2, 2013, 7:56pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/17 "2013-03-02T19:56:10Z")

</div>

WOOHOO!!! I found the error! It is running just fine as of right now! I’ll post again if I run into another problem, but for now thanks for all the help!

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [March 2, 2013, 7:58pm UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/18 "2013-03-02T19:58:17Z")

</div>

@Galador - Glad to hear it, and any time. Good luck with your game 🙂

---

<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:** [March 3, 2013, 5:40am UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/19 "2013-03-03T05:40:59Z")

</div>

Short question:  
Galador defines his variables as for example

,leadership: “0”

Wouldn’t that set the variable leadership equal to the string “0” - not to the number?

---

<div class="post-metadata">

**Author:** ![CJW](https://sea3.discourse-cdn.com/choiceofgames/user_avatar/forum.choiceofgames.com/cjw/32/111787_2.png) [@CJW](https://forum.choiceofgames.com/u/CJW)\
**Post date:** [March 3, 2013, 5:49am UTC](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175/20 "2013-03-03T05:49:34Z")

</div>

@loelet Correct, well spotted.  
@Galedor You may want to remedy that.

[Next page](https://forum.choiceofgames.com/t/errors-before-my-game-starts/1175.md?page=2)
