Scripts in GameMaker are blocks of code not directly related to any object in a project. A script is accessible by all objects in a project at any time and allows developers to create their own functions using GML.
Scripts allow developers to create complex calculations and have the answer returned and stored in a variable as an end result. Scripts are also commonly used when multiple objects are meant to behave the same way. Instead of typing up the same code in every object, a script can be used and run in each object.
Let's take a look at scripts and how they are used.
The first step to using a script is creating one. To do this, click on the icon in the main toolbar that looks a bit like a new page with a play button ...