I need help for gamemaker 2.3

268 Views Asked by At

Pls help me

A few weeks ago it came out of gamemaker 2.3, practically in the gamemaker language they changed the scripts into functions, but now after converting the files to be able to reopen them, I double-checked all the scripts and etc but anyway when I start it it remains a black screen, however it doesn't give me any compilation errors or whatever, what could be the problem?

Ps. I might sound stupid, but if someone has the same program as me I can pass the project to them so they can see the scripts for themselves, so basically it's just the base and there is only the script to make the player walk and for collisions, I know that no one would want to waste time, but I ask the same

2

There are 2 best solutions below

0
On

Majestic_Monkey_ and the commentors are correct: use the debugger. It's easy and it's your friend. Just place a red circle on the very first line of code that runs, and click the little bug icon and you can step through your code easily.

But to address your specific issue (or if anyone in the future has this issue): scripts have changed into files that can have many functions. Where you used to have

//script_name
var num = argument0 + argument1;
return num;

You would now have

function script_name(a, b) {
    var num = a + b;
    return num;
}

All you have to do is create a decleration for your new function:

function my_function_name(argument_names, etc...)

Then wrap all your old code in { }, and replace all those ugly "argument0" things with actual names. It's that easy. Plus you can have more than one function per script!

0
On

Its possible that your code is stuck in an infinite loop, here's an example of what that might look like:

var doloop = true
while(doloop == true){
    x += 1
    y += 1
}

the "doloop" variable is never changed within the while loop, so it is always equal to true and the loop never ends. Because the code never finishes looping, it can never get around to drawing anything, so you end up with a black screen. The easiest way to check for these is to put a breakpoint/debugging point at the beginning and just after every while/for/do/ect loop and debug it. e.g. (I am using asterisks "*" to represent breakpoints)

var doloop = true
* while(doloop == true){
    x += 1
    y += 1
}
*

When you get to one of the loops remove the first breakpoint and hit the "continue" button in the debugger. If it (it being the computer) takes an longer than it should to hit the second breakpoint (as in, you wait for a ten seconds to or two minutes (depends on how complex the code is) and it still hasn't hit the second breakpoint), then you should replace the breakpoint at the beginning of the loop to check and make sure it is still in there. If it is still in the loop, then that is likely where the code is getting stuck. Review the loop and everywhere any associated variables are set/changed, and you should be able to find the problem (even if it takes a while).