If you want your plugin to not only change 1 variable and then call it a day, you probably want to add objects and/or insert extra code in already existing objects. Here I'll explain how to do that. Keep in mind that making a plugin is harder than just modding the game and thus it's recommended that you have some experience modding gg2 first.
The function that pretty much all plugins use is object_event_add(ind, evtype, evnumb, codestr):
- ind is the name of the object you want to add the code to. This can be the name of an existing object or the name of an object you created with the plugin.
- evtype is the name of the event where you want to add the code to. They're usually the regular name used in the game maker editor with the 'ev_' prefix. Examples are ev_create, ev_step, ev_draw, ev_alarm,...
There is also ev_other for the less used events. You can see the lists of all event names below this paragraph.
- evnumb is used to specify what event you want to modify exactly. This is unused most of the time so you can set it to 0 if it's unused. If you're editing an alarm event this number specifies which one and if you're editing a step event it specifies what sort of step event (begin step, regular or end step). This is also used if your event is ev_other
- codestr is just whatever you want the selected object to do. It should be enclosed by (double)quotes.
List of all events (spoilered):
ev_create
ev_destroy
ev_step
ev_alarm
ev_keyboard
ev_mouse
ev_collision
ev_other
ev_draw
ev_keypress
ev_keyrelease
ev_trigger
ev_outside
ev_boundary
ev_game_start
ev_game_end
ev_room_start
ev_room_end
ev_no_more_lives
ev_no_more_health
ev_animation_end
ev_end_of_path
ev_close_button
ev_user0
ev_user1
ev_user2
ev_user3
ev_user4
ev_user5
ev_user6
ev_user7
ev_user8
ev_user9
ev_user10
ev_user11
ev_user12
ev_user13
ev_user14
ev_user15
ev_step_normal
ev_step_begin
ev_step_end
This function only adds code and doesn't overwrite any old code that might be in that event already. If you need to change old code then you have to clear the old code in that event first and then re-add all code in that event. The function used to do this is object_event_clear(ind, evtype, evnumb). Keep in mind that this breaks any other plugins that happen to edit the same event.
To add a new object you have to use object_add(). It returns the id of the new object so you need to add the name of the object first (object_name = object_add()). If you plan on using the new object anywhere outside the object you've created it in you need to use global. This is basically always so it's best to always make it a global object.
These are all the tools you get to make your plugins. This means that you can't edit scripts. It's possible to clear and change the object that executes the script but this often gives errors or bugs so it's usually not worth doing. Try thinking of a better way or consider modding the game instead of making it a plugin.
Making the plugin is best done in game maker or another code editor. Then when you're ready to test it you have to make a new text document, paste your code in it and save it as a .gml file and you're done!