0

JavaScript Beginner, my script crashes my game when executed twice

Hi guys, I worked my way through the JS, HTML, CSS and JQuery courses here over the last weeks. I am trying to make a visual novel game with the software Tyranobuilder, which is based on HTML and supports Javascript. I am trying to make a menu, where player stats are shown. For that I want to get the stat value from a JSON file, and then change the size of the shown skill bars accordingly, everytime the user enters the menu. If stats change along the course of the game, it should be shown. After some time I finally got it running that the values were read from the file and also shown in the menu. However... only ONCE!! :< after I close the menu and reopen it, the game freezes. So I'm guessing I made some stupid mistake wih the JS. It is not that easy to get a hang of it, since Tyranobuilder uses its own methods, which I could not fully grasp. Maybe they are getting in the way with each other. If that's the case, you won't be able to help me, I guess, but maybe my code is the problem. In this code you can see a reduced version of the menu. https://code.sololearn.com/WA13a6a109a1/# So, please ignore the ugly CSS and the fact that in my example code many things are missing. It looks weird, I admit. I just wanted to see if someone more experienced than I already sees the probably obvious and big mess mistake I made. thanks for checking!

23rd Jul 2021, 9:20 AM
Ann
Ann - avatar
3 ответов
+ 1
I Think i found it. As i Suspected the Game does not like it if I append new Script nodes. Or smhw it seems to do it again and again if I do it like here. At First this was the only was the Script worked. But i got it Working anyway
23rd Jul 2021, 11:22 AM
Ann
Ann - avatar
0
Error in line7 js section Incomplete skills array
23rd Jul 2021, 9:41 AM
Divya Mohan
Divya Mohan - avatar
0
Thanks for the Note. but that was just a copy-paste Problem. my phone continues to annoy me... Some other Code somehow ended up in my JS line when i was copying the Code im afraid my Bug can't Be found by Running the Script, since there are too many external Files involved.
23rd Jul 2021, 9:45 AM
Ann
Ann - avatar