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!
 

Slyddar

Member
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 -
 

Nidoking

Member
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.
 

TsukaYuriko

☄️
Forum Staff
Moderator
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.
 

Slyddar

Member
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 :
1618096730850.png

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 :
1618097690624.png

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 :
1618097442730.png

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.
 

Attachments

Last edited:
Top