Mygame.js issues? Maybe?


#1

This is most likely the most stupid thing anyone has ever asked on here, but here’s my question:

I was looking through the forums for a way to set a name for your character with a text box, and most methods said something about needing to use mygame.js . I’ve tried to open up mygame.js before, but it always comes up with the same error message:

Line: 1
Char: 1
Error: ‘SceneNavigator’ is undefined
Code: 800A1391
Source: Microsoft JScript runtime error

Every topic I looked into about this was someone asking, another person telling them to install Notepad++, and then it worked. I’ve tried installing Notepad++, but the file still won’t open.
For some reason, when I try to be sneaky and drag the mygame.js file into a new Notepad++ file, it shows up as just this:

nav = new SceneNavigator([“startup”]);
stats = {};

and that’s it. From what I’ve seen, there should be lots more in the file than just that, and I’m scared to try to edit it without knowing if this should be happening or not.

In the end, I’m left with a few questions:
How do I get it to work?
If it’s already working, then why is it different?

Also, in regards to the naming thing, do you need to use mygame.js for it, or is there a way to just use scenes (startup, I imagine) to do it? Thanks!


#2

Choicescript changed. You no longer need to edit mygame.js to do anything.

You can just place the following in startup.

*create name “none”

And then anywhere else (as long as it comes after the create)

*choice
    #Alan
        *set name "Alan"
        *goto next
    #Bob
        *set name "Bob
        *goto next

#3

@FairyGodfeather Thank you! And then you’d just change (set, technically) the variable whenever in the game that the text box pops up, right?

Also, is there any need to be concerned about my strange mygame.js file, or should I just leave it?


#4

You can just leave mygame.js.

To allow the reader to input their own name in a text box (as opposed to selecting pre-set options like Alan and Bob), use: http://choicescriptdev.wikia.com/wiki/Input_text

And no, you shouldn’t need to set a variable again (unless it’s changed). To display a variable like “name” so the reader sees what it’s been set to, use:


#5

I’d suggest using an unaltered version of mygame.js. Download choicescript again (or just grab a new copy of that file). Just in case it messes stuff up.

If you haven’t already I’d suggest reading the code of some of the existing games. I found it helped me get a feel for how they do things.

Choice of the Dragon’s nice and simple. https://www.choiceofgames.com/dragon/scenes/startup.txt