This document explains how to use the scripts on this site. This document
is created for GM 5.2 but will be compatible with other versions. This document
assumes you have used Game Maker and are capable of using it for simple tasks.
This document assumes you have Game Maker standing on advanced mode.
This can be activated by pressing file and then advanced
mode. If a v stands there like: it
is correct. If not click the item once.
Within Game Maker add a new script:
A new window will open. On the top of the window stands a text
field where you can enter the name. The default value is script0.
To be capable of using the script later it is useful to give the
script a clear name. You can name the script everything you want,
never the less it is useful to use some guidelines to keep your
game orderly.
Start the name with script_ This way you always
now that it is a script when refering to it.
Use a clear name like: platform_movement for
a platform script. The name must be chosen so that you always
know what the script does by reading the name
Do not use spaces in the name. If you start using GML within
your game you can not refer to a resource which has spaces in
the name
Do not use capitols. Game Maker is capital sensative. Refering
to a resource is simpler if it does not have capitols since you
then don't forget to add then in the name
After you have done that you open the script you want and select
it completely. This can be done by placing your mouse at the beginning
of the script, holding the left button pressed and dragging the
mouse untill the end of the script and releasing the mouse button.
After you have done that press right mouse button on top of the
script and select the option copy from the menu.
Then go back to Game Maker, press right mouse button in the blank
white area of the script window and select paste.
Then press F12 twice.
Now you have added the script you must first read the green text
on top of the script. This text will contain important information
on how to use the script. If the script requires you to fill in
certain arguments you can find there what you must fill in as the
arguments. Also you can often find information on the event in which
you must place the script. Now you need to add some code to execute
the script. There are two ways of doing this. The first way is to
use D&D. The second way is to use scripts. Scripts that require
more than five arguments can not be added using D&D. These must
be added using GML.
D&D
If you want to use the Drag and Drop interface of Game Maker then go to the
event the code must be placed in. This usually stands mentioned in the beginning
of the script. Within this event add from the tab code the command execute
script and drag it to the event. .
You now get the screen:
click on field 1 and select from the list the
name of the script you have chosen. At the top of the script stands
what the different arguments should be. Fill in the arguments on
the places. So if in the script stands: argument0: horizontal
speed then fill in area 2 after argument0:
the speed you want to have as horizontal speed. A few notes:
If you need to enter a string then place the string between
quotes. Like: "hello" instead of hello
When entering names of resources make sure that the resource
follows the guidelines on giving names mentioned above.
If you do not need to fill in a certain argument you can leave
the field blank.
GML
In the cases you need more then 5 arguments or you need to know the value the script returned you can also use a code block for this. Note that there's no reason to add a code block just to call up a script unless you need these points.
First go to the event you want the code in executed. Usually the event stands
mentioned at the top of the script. Then drag the option execute a
piece of code.
You will then get a new window in which you can enter the required code. The
code starts with the name of the script. For this example we assume that the
script is named script_message_box. After the name of the
script you place an opening bracket like script_message_box(
then enter the required arguments. lets assume you want as arguments
3, 5 and hello then do script_message_box(3,5,"hello");
End the line with a closing bracket and a ;. All
arguments must be seperated by a ,.
By Simon Donkers
www.simondonkers.com
gmmentor@simondonkers.com
Shouldn't it be 'script_message_box(3,5,"hello");' instead of 'script_message-box(3,5,"hello");'?
Good tutorial Simon, it should be useful for beginers.
SD:fixed that, thanks for the tip
mo posted at 2006-08-12 16:37:01
no : script_message_box(3,5,"hello"
- is never used for sonthing like this
Wolfprogramming posted at 2006-10-06 17:06:51
It is cool I culdent use it... But i think that it is good for people who will start learning Gml
Dark Mage posted at 2006-12-08 06:33:46
I am wondering "why would u make a tut to exe a script? I mean if dis 4 begginers I tink they need to know how to make a script with arguments b4 they can exe one???"
@Dark Mage, That, or they visit a Game Maker site filled with scripts and decide to want to use these scripts. In that case they can either read on the site how to use these script or send hundreds of emails to the website owner asking how to do this.
This tutorial helps beginning users to implement scripts found on my site and thus does nicely what it is supposed to do.
Ahmad posted at 2006-12-14 12:43:03
Please mail me the game makers professional samples and scripts
ahmadrezahadidi@yahoo.com
Anderew posted at 2007-02-03 02:54:54
Awesome site Simon,
i am only 12 and i think it easy using game maker the script this was just what i need but i have a request how do you get a gamemaker compiler
great work!! though i still don't quite understand. I will read it over and over again to work out how to use script. Thanks anyway!
Andrio posted at 2007-06-15 10:45:04
It kinda helped me there, but would anyone be able to convert this into script (I'll say what the image does and what happens)
Collision with wall = reverse direction
Collision with Hero = Destroy Hero object
Gravity: 0.5 direction: 270
silver posted at 2007-06-23 02:37:32
i still don't get it..
joe posted at 2007-10-07 09:25:30
hi, future game designer here, trying to learn how to make a simple video game before i go to bed i dont understand the whole "argument" thing, and what do you mean by "drag 'execute script' to the event" i tried typing it in in the right spot (i think) and i didnt get an extra window like that one
First, create an object (blue ball) or use an existing object.
Then add an event (add event, pick one) or select an existing one.
Then, at the right side of the window click on 'Control' to see a different group of icons displayed. Under the header 'Code' the second action is a piece of paper with lines and a green arrow with as tooltip 'execute script'.
What you need to do is left click and hold your mouse on that icon and then move your mouse to the left to the big white area below 'Actions:'.
Release your mouse there and follow the rest of the tutorial.
joe posted at 2007-10-12 00:59:42
ok thanks for the advice
pat posted at 2007-10-18 10:57:45
well i have game maker but i don't want to script a game by it. How do i script a game by map 001? it is a rpg maker.
Hunt posted at 2008-03-04 04:35:33
Hi! My name is Hunt Singleton and I have a problem. I used your script on a game I'm making but there's a problem. When my character stopped moving my character started falling of the solid ground. What can I do? Please reply soon! huntdbz@comcast.net
OmegaIMaGamer posted at 2008-03-28 08:45:40
AWSOME, im a newb to GM7 and just did a few adjustments to my Platform game with your script and already i see a HUGE imporvement!!!!
oh a hater !!??
whatever
thanks for the advises!! helped me a lot with making passwords for my game!!
you know it's really easy I never thought it's that easy
oh and if you download the game the code is "getall"