What is a "Main" and how do I define it?


#1

I’ve started making COG game but every time I play through it to see if everything’s working, a message always pops up on the first page saying “The main is not defined.” Does anybody know what this means and how I fix it? I’ve been looking on the site’s guides on how to make a game and I’m not finding anything.


#2

Do you have a variable or label titled main?


#3

Sounds like it could have something to do with the “main” function, which isn’t related to anything you should have been altering. Have you been in mygame.js or any of the other files besides those in the scenes folder?

I’m not sure how to fix it, but the first thing I’d try is saving your scenes folder somewhere separately, downloading choicescript again and replacing the new scenes folder with your one, then test again and see if you still get the error.

@CJW would likely know more.


#4

Lol. Nah, I don’t have any variables or labels called “main.” I haven’t been in mygame.js either, I tried to open it, but it didn’t work. Thanks for the advice though. I’ll try to fix it later :slight_smile:


#5

It sounds like it might be referring to the “main” HTML element. Couldn’t say what’s causing it though. Have you edited any core files, like scene.js or index.html?

Do you know how to bring the browser console up? It’s usually F12, that might give you a more detailed error message. If not if you PM me a link to the game or send me a .zip file I can take a closer look for you.


#6

Hmm, definitely not the core files, 'cos I uninstalled Choiceofscript and the reinstalled it and the same thing keeps happening. It doesn’t actually affect the game, it just pops up whenever I start it and I have to press the “okay” button and then it just plays the game normally from there. I’ll try and PM you the file, so you can see if there’s anything up with it.


#7

did you fix the problem? i get the same error…


#8

It’s a bit late, bro.


#9

This is not the answer i was looking for (waving hand)