Skip to content

Instantly share code, notes, and snippets.

@AltimorTASDK
Created July 20, 2023 04:30
Show Gist options
  • Save AltimorTASDK/7693012e9aa325110b6801bb7245a6ea to your computer and use it in GitHub Desktop.
Save AltimorTASDK/7693012e9aa325110b6801bb7245a6ea to your computer and use it in GitHub Desktop.
local frame_advance_hold_time = 0
local needs_restore_shortcuts = false
local gBattle = sdk.find_type_definition("gBattle")
local TrainingManager = sdk.get_managed_singleton("app.training.TrainingManager")
local PauseManager = sdk.get_managed_singleton("app.PauseManager")
local PauseType = sdk.find_type_definition("app.PauseManager.PauseType")
local BATTLE_TRAINING_PAUSE = PauseType:get_field("BATTLE_TRAINING_PAUSE"):get_data(nil)
local FBattleInput = sdk.find_type_definition("app.FBattleInput")
local FLAG_SELECT = FBattleInput:get_field("FLAG_SELECT"):get_data(nil)
re.on_frame(function()
local holding_frame_advance = false
local Input = gBattle:get_field("Input"):get_data(nil)
for i, pad in pairs(Input.StorageData.Pad) do
if (pad.RawPadNew & FLAG_SELECT) ~= 0 then
holding_frame_advance = true
break
end
end
if holding_frame_advance then
frame_advance_hold_time = frame_advance_hold_time + 1
else
frame_advance_hold_time = 0
end
local other_func = TrainingManager:call("get_OtherFunc")
if other_func == nil or other_func._gData == nil then
return
end
if other_func._gData.IsMenuPause then
if frame_advance_hold_time == 1 or frame_advance_hold_time >= 15 then
PauseManager:call("requestPauseEnd", BATTLE_TRAINING_PAUSE)
end
TrainingManager.IsCanShortCut = false
needs_restore_shortcuts = true
elseif needs_restore_shortcuts then
TrainingManager.IsCanShortCut = true
needs_restore_shortcuts = false
end
end)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment