GM: Creation code

From GMpedia.org Wiki

Jump to: navigation, search

The Creation Code for a room is a script which is performed when a room opens or when an object's instance is created in a room.

While the concept is similar to the create event for an object, it differs in being attributed to a specific instance of an object or room.

[edit] Room Creation Code

When the following piece of code is typed in the room creation box:

show_message("Hello!")

The message Hello! will appear when the room is created. The Creation Code button is under the "Settings" tab for a room. If the room is set to Persistent, then such code will only appear once when the room is first opened, even when the player navigates back to that room. For a room that is not persistent, however, the code will be executed each time the room is open.

[edit] Object Creation Code

You can also set a Creation Code for individual objects in the room editor by holding down ctrl + Right click and clicking Creation Code in the drop down menu, And entering code in the code box that pops up. This code will be specific to this individual instance and can be useful by allowing you to use less instances.

[edit] See Also

Personal tools