'HookFunction' function (EN) - Archie-osu/ProjectDELTA GitHub Wiki
Runs your function before / after the game attempts to execute a script / object event.
<void> HookFunction(
<string / LCT> GameScript,
<string> LuaFunctionName,
<boolean> RunBeforeScript
);GameScript
Type: String / LCT
The name of the script. Examples: gml_Object_obj_battlecontroller_Create_0, gml_Object_obj_mainchara_Create_0.
You may also used one of the predefined types:
-
LCT.Script- Runs on every script execution -
LCT.Frame- Runs every frame (30FPS usually) -
LCT.DrawEvent- Runs every DrawEvent (object events ending in Draw_0).
LuaFunctionName
Type: String
The name of the function that should be called when the conditions are met. Examples: FixEchoFlower, ShowRoomName
The target Lua function can accept an argument, in which case it will get filled by the name of the calling script (useful with LCT hooks).
RunBeforeScript
Type: Boolean
true if you want the function to run before the script, false if you want the function to run after the script.
Type: void
function ShowRoomName()
-- Draw Stuff here
end
HookFunction("gml_Object_obj_time_Draw_64", "ShowRoomName", false); -- Run the "ShowRoomName" function after "gml_Object_obj_time_Draw_64" executes.