DND Platformer Tutorial Bug

Hi, I'm new here so bear with me. I'm doing the DND platformer tutorial and on the first video i get a bug that doesn't allow the game to run. In the description of the video on youtube he mentions stuff has changed with 2.3, so now you have to add a new "declare new function code block" but i'm not sure what he means or how to fix the issue. I can drag that code block in but not sure what to do with it. I assume I don't leave the arguments empty but he doesn't mention anything else about it. As of now I can't continue the tutorial because of this. I appreciate any help!


The pinned comment in the video describes the changes in 2.3, and has a link to a forum post showing what you need to do. A future video which was made just after 2.3 was released has a section where I talk about what you need to do with the Declare a New Function codeblock -


You're declaring a function in the Step event. That is not a script. It is also not calling the function. Reread the sticky post at the top of the forum or rewatch the tutorial. Or both. And read about Functions in the Manual.
You're declaring a function in the Step event. That is not a script. It is also not calling the function. Reread the sticky post at the top of the forum or rewatch the tutorial. Or both. And read about Functions in the Manual.
What do you mean by "that is not a script" Am I supposed to write a script and then somehow reference that? I'm at the very beginning of this tutorial so i have no idea what i'm doing. Rewatching the tutorial doesn't work, because as i've said there were changes made in version 2.3 that makes the tutorial not work. But the one forum post i found on this doesn't really explain what exactly i'm supposed to do in this instance. And the video that is referenced above that was made after 2.3 is for a completely different tutorial so i'm not sure how to apply that to this first tutorial. I'm brand new to this so i don't know what any of this means and i'm just looking for help.


Forum Staff
The tutorial you are talking about may be using scripts. The way scripts work has changed.
If you wanted to use a script to declare a function that you can then call later, refer to the corresponding manual page about declaring functions.
However, you are NOT using a script, but a Step event. From the look of it, you also don't seem to be trying to define a function, but to run code every step. If so, don't declare a function.

What to do depends on what you want to do, or what the tutorial expects you to do.
If you're supposed to create a script and declare a function in it, refer to the manual page I linked.
If you're not supposed to create a script, remove the function declaration.


When the video says you need to make a script, it simply means right click on the scripts group under the asset browser, select Create and go to Scripts. This will create a script, and inside it will be a Declare a New Function codeblock. The name of that codeblock is important, and for that tutorial series, and most others, that name will need to be the same name as the script.
Function name and Script name should be the same for all pre 2.3 tutorials :

As a background, the change in Gamemaker 2.3 is that a script now contains functions, so all codeblocks need to be placed under a Declare a New Function codeblock instead of just placed by themselves in the script.

In the pre 2.3 tutorial the codeblocks are just dragged into the script, but now every time a script is created, you now need to drag the codeblocks under the Declare a New Function codeblock, like you've done above.
That is shown in this spoiler image :

Now once you've created a script with your declared function inside it, and ensured the script name in the Asset Browser is the same as the Function codeblock name, then you can use an Execute Script codeblock to 'call' the script and have the code inside run. The Execute Script codeblock is placed inside the Step event, which runs 60 times a second, calling and script every step.
Exectue Script example :

If you're doing the first tutorial in the series, at no point are any scripts created, so there is no need to do anything but place that code into the step event. It's the second episode where you will need to use the knowledge mentioned above whenever a script is created.


Last edited:
I did that, but it still says that there's an error when I try testing the game. What do I do? Here's a screenshot of the problem...
I don't know what's wrong with my game. What do I do? (please look at the error pop-up)


You missed the part about using the Declare a Function Block action. Remember, the thing you did previously but not in a script? You need to follow ALL of the steps, and you need to follow them all in the order presented, in the same project. You've had six months to figure this out.


The one in the picture? The one in the pop-up that's covering the script you say you formatted properly? You'll have to show your work.

Did you put the body of the function inside the Declare a Function block?


but the problem is now that an error pop-up says that the variable "hsp" isn't set.
When the error shows "<unknown_object>.variable_name" like your error does, it means you haven't done what this whole thread is demonstrating. In my post above click on the spoiler buttons and read, and re-read, the content. It is showing you how to use the Declare a New Function codeblock. If you use it correctly it will fix your error.

If you still can't get it to work, ensure you have added a Declare a New Function codeblock, and have the other codeblocks underneath it.
This is what I have for my calc_movement script:
2021-10-21 (3).png
Here is what I have for my get_input script:
2021-10-21 (4).png
2021-10-21 (5).png
And here's what I have for my collisions script:
2021-10-21 (6).png
...And here are my variables...
2021-10-21 (7).png
Regardless of everything I try to do, it always leads to that error pop-up.

The player character I created is called Blocky_player.

What do I do?


seriously -_-' the little blue line between block HAS MEANING

the little blue line between the "declare a new function" and the "assign var" block is on the left. that means your assignment is UNDER your function declaration, not INSIDE.

drag the assign block on the right of the declare function block instead of under that should do the trick to put the assignment inside the function

edit: same things for all your other function