Quicktest problem "Cannot read properties of null (reading '0')"

Hi everyone. I’m trying to get a scene bugfixed. Wonder of wonders I’ve finally managed to get it to pass random test after working around some of the usual culprits that trigger it off like loops and text entries during the tests.

Now it’s throwing up a quickest error as above though. I’ve got no idea where to find it as it doesn’t give you a line error and I’m not sure what it means. (I’m guessing a variable isn’t set?)

Any help appreciated! I’ve got no idea at the moment where to start. It’s a 26k document so not really thrilled by the idea of trying to disable it line by line (which is going to be particularly annoying due to the loops and things in it) which is where I’m otherwise at.

Been a very long time since i used quicktest, it tests every option right? Do we know if it runs the code in order?

I dont know about the error specifically, but if it does run the code in order, then you could use the following to narrow down where the problem is.

How many random test runs have you done? Assuming it hit all the common routes then your issue is either in an uncommon route or a piece of code that is actually innaccessible. Maybe you have some old code lying around in a file.

Can you rip out chunks of story, will depend on how your files are structured, but you may be able to bypass some stuff and rule it out as the culprit.

You could introduce deliberate errors to cause QT to fail. Stick one at 90% of the code and see which error hits first. Move your error forward until your error hits first and then start localising. No idea if this is practical with how QT works though.

Just thinking, does 'reading ‘0’ ’ mean that it has found code which suggests to it that there is a variable called ‘0’? Maybe just searching for 0 will find it?

1 Like

To fix the bug in your large document, start by checking for any variables that might not be set and review your conditional statements. If possible, use debugging tools to find where the error occurs. Dog likes to eat

Thanks for the response. That’s my understanding. It seems to run choices through designated by numbers. I guess looking at it, I’d guess the problem occured between the previous choice and the next one downstream (not listed) but I can’t find anything obviously wrong there unless I’m missing something or it’s a problem with a previous set variable. (And there’s some messy ones like counters that increase or are reset after each section of the game is completed as well.)

With difficulty. This is the mini game attached to my main game file. The issue is there are a lot of different settings potentially in use and the game is looping around as people replay different parts of it. I could potentially disable parts of the game, but it’s likely then going to cause errors elsewhere when other sections are meeting their *if requirements (For example there are 15 different tasks, if I’m only running 14 I’ll have to reset some things and then try to make sure they’re all set back again later. Do-able but very messy.) Because it’s not linear, it’s making it quite difficult for me to track down the problem.

tens of thousands.

No variable called 0. I think that maybe means it’s looking for a number but can’t find one? I don’t think I’ve seen this error before.

What debugging tools? I’m already using random and quicktest.

Not entirely sure where to look, but the last recorded line before the quicktest failed was 4072 which is below. It always fails exactly on this line even though other sections use almost the same code (just with different answer1 and gotos.

Edit- Ok I’ve found it. I had a *gosub without it directing anywhere in a linked section downstream from here (It wasn’t *label correctq12 as I was expecting). Must have accidentally been deleted when I was messing about in the code to fix some other things. So if anyone’s wondering what this error is, seems like it’s a “no destination to direct to” error. Ugh this took way too many hours for me to work this out :dizzy_face:

1 Like

This is actually a JavaScript error and not a ChoiceScript one. That’s why there were no line numbers. Even if it was triggered by your code, the Engine should have issued its own error message, like missing label or something. So I think it’s something you should report to CoG and @dfabulich could look into.


This topic was automatically closed 24 hours after the last reply. If you want to reopen your WiP, contact the moderators.