Plans can take a variety of valid forms, and are in essence callback functions. Since Game Maker provides very little native callback functionality, a Plan can be used to call a Script or execute an Event, while providing arguments to them.
Plans do have a limitation in that they can only pass a single argument. However, this argument can be an array. Game Maker supports nested arrays and array literals, making it easy to pass a large amount of values to a Script or Event.
Scripts have to be constructed with this limitation in mind, should you wish for them to be compatible with Plans.
The functionality of Plans is to be expanded upon in the future, so that it becomes easier to pass new arguments into the Plan after it has been created. For the time being, it is recommended to always construct a Plan according to the "+ Arguments" model, and access its arguments using
If you do not need to pass an argument into it right away, simply pass
[ with, event_type, event_number ]
Script + Arguments
[ script, arguments ]
Event + Arguments
[ [ with, event_type, event_number ], arguments ]
m_make_theme( "foo", c_blue, c_green, c_yellow, c_red ); var _plan = [ m_get_theme, "foo" ]; var _theme = m_perform_plan( _plan ); draw_set_colour( _theme[ __mono_EColour.text ] ); draw_text( 0, 0, "Hello World!" ); // Result: "Hello World!" in c_yellow
// Create Event m_perform_plan( [ [ id, ev_other, ev_user0 ], "Hello World!" ] ); // User Event 0 msg = show_message_async( mono_load ); // Result: "Hello World!"