Script Gamemaker with Param

In this lab we will create a script PrintText(str) with the str param in order to print the input text to the game screen.

We do create the script - How to Create Simple Script Gamemaker here ( this script has no param ).

Param is variable the script will get when we call the functions. For example if we call the script like this PrintText('Script with Param'); the game screen will display the text 'Script with Param'

The diffrerent is we will get the param in the Game Maker Script Editor using this argument0 variable

 Script Gamemaker With Param argument

We can pass variable via argument0... Gamemaker allows us to pass up to 16 arguments.

Then, we will add these lines of code to Action Code of Event Draw of Object obj_Draw

text = "Print with Param";
PrintText(text);

Then place this obj_Draw object to the room and run the game to see the text "Print with Param"