Comment on page
Objects can send and receive messages to create an interactive experience.
Messages are used to broadcast that an action has taken place. These messages can then be received by other objects in your experience, and depending on the Behaviour or Component, trigger a specified outcome.
If we consider logic as a collection of processes that lead from an action to an outcome, then triggers are the initial action that initiates a string of logic, Tags help identify the objects involved in the action, and Messages are what connect the Action to the Outcome. They are the equivalent of the electricity flowing from a switch to a light that tells the light to turn on.
Messages carry a signal from one place to another, confirming that a trigger has taken place, and putting in motion the resulting Outcome.
The Message System isn't as hard as it seems, and once understood, it will bring a lot of depth to your creations.
Some Behaviours and Components allowed one or several Messages to be 'Sent' (we usually call them 'Broadcasters').
Some Behaviours and Components are waiting for one or several Messages to be received (we usually call them 'Listeners').
Some Behaviours and Components use specific predefined Messages that will work with some Components and Behaviours out of the box. That being said, you can always modify these pre-set messages to something of your choosing.
An example of this is the "Interact" Message. This is the Default Message sent by Avatars when 'E' is used to interact with an Object.
This ‘Interact’ is ‘sent’ when the Player presses ‘E’, and is, by default, already set as the Message to be received by some Behaviours and Components.
Behaviours such as the Button Behaviour, the Door Behaviour, and the Speaker Component all have their ‘Message Required' parameter preset to 'listen' for the message 'Interact'.
So, if we look at the Door Behaviour, In a few quick clicks you can have the interactive door functionality established in your Experience: The Avatar triggers the action by pressing 'E' on the relevant Object, which sends the ‘Interact’ Message, which is then received as the ‘Message Required ' by the Door Behaviour parameter, which then plays the animation of the door opening.
However, if you don’t want to use the default messages you are also able to customize your own.
If you want to create a Message you have two options. With both options, you need to navigate to the Behaviour or Component Message parameter you want to set or change. From here you can either click 'ADD +' if you would like to add a new message or, if there is already a Message set, and you would like to overwrite it, click on the current message.
In both these cases, you will see a drop-down menu of the existing available Messages, but, instead of clicking any of those, type your Message in the field. This will bring up the option to ADD 'your text, which will be in green text. Click the text and your Message will now be set as a required message.
If you want to use an existing Message, navigate to the relevant Component or Behaviour, find the Message Required Input and start to type in the name of the Message you wish to use. The list will populate with all the existing related Messages. You can then select the one that fits with what you were searching for.
This section covers two kinds of message removal. One from an Object, and one from the whole of the Game Maker.
If you want to remove a message from a Behaviour or Component, you can simply click the 'X' to the right of the relevant message. This will remove it from that specific object.
If you want to delete a specific message from the list of used messages, you’ll find this is done automatically once the Message isn’t detected as being ‘in use’ anywhere in your experience.
This means you aren’t manually able to remove it from the list, but rather that it will be automatically be removed if it isn't used in the Experience. Once it doesn't appear as a sent or received Message in the Parameters of a Component or Behaviour, then the Message will not appear in the list.
By default, setting the message to ‘none’ is the same as setting a message to empty.
Now that You have some contact for Messages, try them out by applying some Behaviours and Components in the Game Maker and getting them to 'talk to each other.'
Last modified 2yr ago