(That said, you should still use the global identifier to explicitly define and identify global variables in your code.) What this means is that when you run your game, all of your scripts are now called right at the start of your game (and therefore in the global scope), so that all lines of code outside of function definitions will be considered global and therefore any variables you declared at the top of your scripts, for example, will be initialised right at the start of the game. This is no longer the case and scripts, while still global in scope, are now capable of being a type of 'container' for one or more functions.
The New Way (GameMaker 2.3.0 And Every Version After That) So your Script might be called 'Hello' and have this single line of code in it: show_message('Hello world!') Īnd when you wanted to call that Script inside a different script or object event, or wherever, you simply wrote: Hello() Previously, a Script asset was used to write a single custom function in that script file, and this function would then be called elsewhere in your code by using the Script name as the function name.
The Old Way (GameMaker 2.2.5 And Every Version Before That) The 2.3.0 release of GameMaker sees some changes to the way that scripts are now handled in all current versions of GameMaker, which we'll explain in this article as well as point out how scripts in projects created with previous versions will be imported and handled.