Hi,
What I'm trying to do is to trigger a popup when a specific event is triggered and then execute custom functions.
So what I'm struggling with is passing data from one Lua to another. The popup triggers but does not take any notice of anything after that.
If I call this function a popup appears, I can't really customise it. I've had a look at the mod UI tutorials (dialog 1 through to 6) and ideally I am looking to call this functionality from another file. However, nothing gets passed to the other file in order to trigger it.
function TestPopup()
local popupInfo = {
Data1 = 500,
Type = ButtonPopupTypes.BUTTONPOPUP_TEXT,
}
popupInfo.Text = "HELLOWORLD";
UI.AddPopup(popupInfo);
end
Events.SerialEventGameMessagePopup.Add( OnPopup );
My understanding is that the Events.SerialEventGameMessagePopup.Add is adding the test function functionality to the (OnPopup), so If I the call just Events.SerialEventGameMessagePopup( OnPopup ) then it should execute the above, right? I've tried this but can't seem to get it to work.
Is it because everything is 'local' here and I need to pass any data to a global to be seen by another Lua file? Couldn't I just add an include instead?
Am I making sense to anyone? Can anyone point me in the right direction?
Thanks,
Smeg
What I'm trying to do is to trigger a popup when a specific event is triggered and then execute custom functions.
So what I'm struggling with is passing data from one Lua to another. The popup triggers but does not take any notice of anything after that.
If I call this function a popup appears, I can't really customise it. I've had a look at the mod UI tutorials (dialog 1 through to 6) and ideally I am looking to call this functionality from another file. However, nothing gets passed to the other file in order to trigger it.
Spoiler :
function TestPopup()
local popupInfo = {
Data1 = 500,
Type = ButtonPopupTypes.BUTTONPOPUP_TEXT,
}
popupInfo.Text = "HELLOWORLD";
UI.AddPopup(popupInfo);
end
Events.SerialEventGameMessagePopup.Add( OnPopup );
My understanding is that the Events.SerialEventGameMessagePopup.Add is adding the test function functionality to the (OnPopup), so If I the call just Events.SerialEventGameMessagePopup( OnPopup ) then it should execute the above, right? I've tried this but can't seem to get it to work.
Is it because everything is 'local' here and I need to pass any data to a global to be seen by another Lua file? Couldn't I just add an include instead?
Am I making sense to anyone? Can anyone point me in the right direction?
Thanks,
Smeg