• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

HTML5 [SOLVED] "GameMaker_Init is not defined" error

Hello! I was making my game for HTML5. Suddenly, after compilation, I get this error -
err.PNG
Everything worked fine before.
I use Google Chrome, and also I have Steam GMS version. Everything works well when I build the game on Windows
Who knows what is the reason? Or How can I fix it? There was an IDE update today, maybe that's the reason. I don't know...

P.S. I have not changed any settings:
err2.PNG
 

gnysek

Member
In javascript, if something crashes, then next call also crashes, so it's rather kgml_xxxx_ was already defined which causes error here.

Clean assets and try again, also, does it happens on empty project too?
 
In javascript, if something crashes, then next call also crashes, so it's rather kgml_xxxx_ was already defined which causes error here.

Clean assets and try again, also, does it happens on empty project too?
Cleaning up the assets did not affect anything. A new empty project builds without any errors.
I really don't now why it's happened :/
In my post above, the first error says what some indefier (script, probably function) has already been defined.
I checked my git, but there is nothing what can cause the error...
 
solve1.PNG
I finally found it in my code, commented this function and... Game built successfully!
Omg I really don't know why this bug happened, but there is a way to fix it:
1) Build the game, press RMB -> view code
2) Press RMB on this (html5game/your_project_name.js) -> Open in new Tab
solve2.PNG
3) Copy all JS code in Notepad
4) Ctrl + F -> find your error and try to figure out what is the problem and how can you fix it. My problem was "Identifier 'kgml_Script_anon__19457' has already been declared"
So I found all 'Script_anon__19457' strings in the file, and commented the function above in my GAME code (not JS) (just found function like on the first picture)
 
Last edited:
View attachment 42094
I finally found it in my code, commented this function and... Game built successfully!
Omg I really don't know why this bug happened, but there is a way to fix it:
1) Build the game, press RMB
2) Press RMB on this (html5game/your_project_name.js) -> Open in new Tab
View attachment 42095
3) Copy all JS code in Notepad
4) Ctrl + F -> find your error and try to figure out what is the problem and how can you fix it. My problem was "Identifier 'kgml_Script_anon__19457' has already been declared"
So I found all 'Script_anon__19457' strings in the file, and commented the function above in my code (first picture).
Then I decided to uncomment out the lines back and... the error went away on its own! Just comment/uncomment problem code
 

chamaeleon

Member
So your solution is to comment out code that was compiled from code you wrote in a function in gms? Since this is the same as not writing that function in the first place, are you happy with this solution, or is it possible you have now crippled your program? I'm willing to bet some things will not work the way you expect.
 
So your solution is to comment out code that was compiled from code you wrote in a function in gms? Since this is the same as not writing that function in the first place, are you happy with this solution, or is it possible you have now crippled your program? I'm willing to bet some things will not work the way you expect.
I uncommented my code back (so my code hasn't changed), and problem have been fixed. I don't know why, but it works for me.
 

Psycho-Male

Member
View attachment 42094
I finally found it in my code, commented this function and... Game built successfully!
Omg I really don't know why this bug happened, but there is a way to fix it:
1) Build the game, press RMB -> view code
2) Press RMB on this (html5game/your_project_name.js) -> Open in new Tab
View attachment 42095
3) Copy all JS code in Notepad
4) Ctrl + F -> find your error and try to figure out what is the problem and how can you fix it. My problem was "Identifier 'kgml_Script_anon__19457' has already been declared"
So I found all 'Script_anon__19457' strings in the file, and commented the function above in my GAME code (not JS) (just found function like on the first picture)
How do you pinpoint the problem after opening .js file? I'm not really familiar with JS and HTML.
 

TheMagician

Member
How do you pinpoint the problem after opening .js file? I'm not really familiar with JS and HTML.
You search the string that is thrown in the error in the browser's console (see the original post). In OP's case the error says that something has already been declared so OP searched for all the occurances of the string and then started commenting them out one by one to see if that solves the problem.
 
Top