Home | Customize | Blog | Extras | Log In | Info
Manual | D&D icons | GML Parser | Archive | Iso City
Username: Password:  
About | Features | Directory | Banners | Contact

Designing Games with GameMaker
Designing Games with GameMaker

Scripts

When you create a script, you want to access the arguments passed to it (either when using the script action, or when calling the script as a function from a program (or from another, or even the same script). These arguments are stored in the variables argument0, argument1, ..., argument15. So there can be at most 16 arguments. (Note that when calling the script from an action, only the first 5 arguments can be specified.) You can also use argument[0] etc.

Scripts can also return a value, so that they can be used in expressions. For this end you use the return statement:

return <expression>

Execution of the script ends at the return statement!

Example
Here is the definition for a little script that computes the square of the argument:

{
  return (argument0*argument0);
}

To call a script from within a piece of code, just act the same way as when calling functions. That is, write the script name with the argument values in parentheses.

Search Search


Alternative versions Alternative versions

You can also read this manual on one single long page (± 1.5 mb)

Also available in: Dutch French German

ZIP Download helpfile

Advertisement Advertisement

GameMaker Manual