Trying to call an ingame lua when a button is activated
Hi, I'm stuck here. I want to run a function when a game button is active (for example the button is an ingame stance, forced march). I write it so: local function forcedCheck(context) local army_stance_group = scripting.m_root:Find("land_stance_button_stack") if world.isPlayerTurn() and army_stance_group then local button_forcedMarch = UIComponent(army_stance_group):Find("button_forced_march"); if UIComponent(button_forcedMarch) then dofile (''TESTUDO_stan.lua'') end end end
-- Callbacks scripting.AddEventCallBack("CharacterSelected", forcedMarchRemoval) -- Remove forced march button upon character selected
dev.log("ui.lua loaded") This is the file called ui.lua. But nothing happens. Please, where I made the mistake ?