Current Status of Lua Modding

This is just a shot in the dark, but I found this for ui context,
Code:
for i, addin in ipairs(Modding.GetUserInterfaces("InGame")) do
        print("Loading InGame UI - " .. addin.ContextPath);
        table.insert(g_uiAddins, ContextPtr:LoadNewContext(addin.ContextPath));
    end
is it possible to do something similar for gameplayscripts?

I looked at that myself, but from what I can tell anything executed through ContextPtr is going to be somewhere in a UI context, inheriting from the context in which the LoadNewContext was run.

I've looked at several kludging ideas, but I'm not happy with any of them, so while I'll probably keep experimenting, I'm hoping they just release a patch that fixes the GameplayScripts reload--and allows UI only mods to work with games that weren't created with them enabled.
 
New info as of the release of the Winter 2016 Patch.
  1. Please see alteration to #1 in OP. Gameplay Scripts are indeed reloading now along with a saved game
  2. Custom lua files that are "Imported" and "included" are still not loading into the main lua file that contains the include() command. Unless I am doing something fundamentally wrong. This would include things such as William Howard's PlotIterators.lua utility from civ5, for example, or either of my own plot data-gathering utilities from civ5.
    • Would appreciate a confirmation
  3. Mods are enabled by default unless/until you un-enable them.
    • This also pertains to editing a modinfo file for example, or adding a new mod to the MODS folder. Both these act as auto-enable.
    • Have not made up my mind whether this is very good or very bad
 
1/ is great news
3/ must be a bug
 
Has anyone been able to get a popup window to appear\disappear using the UIManager: QueuePopup and UIManager: DequeuePopup methods?
I have looked at the popups that come with the game to get an idea of how it works but just can't get it quite right.

modinfo
Code:
    <Components>
       <UserInterface>
           <Properties>
               <Context>InGame</Context>
           </Properties>
           <Items>
               <File>UI/Popups/InGameCivAndCityRankings.xml</File>
           </Items>
       </UserInterface>
    </Components>

    <Files>
       <File>UI/Popups/InGameCivAndCityRankings.xml</File>
       <File>UI/Popups/InGameCivAndCityRankings.lua</File>
   </Files>

popup xml
Code:
<Context>
    <Container ID="WorldPopups">
        <LuaContext ID="InGameCivAndCityRankingsPopup" FileName="InGameCivAndCityRankings" Hidden="1"/>
    </Container>

    ... window controls
</Context>

The popup window is always visible, even though the Hidden property was set to true, and when I call the UIManager: DequeuePopup the window does not close.
I have tried several combinations of values for the Context and LuaContext entities but have had no luck. The rest of my code does execute though as my rankings list is displayed in the window.

If anyone could provide any assistance it would be greatly appreciated. Thanks.

UPDATE: I managed to get this sorted eventually. Working solution can be seen in my Golden Ages mod, but basically I needed to have an Xml that was imported using the <UserInterface> tag that does not show in game but is used as a container for the references to the luacontext on the actual popup xml.
 
Last edited:
Custom lua files that are "Imported" and "included" are still not loading into the main lua file that contains the include() command. Unless I am doing something fundamentally wrong. This would include things such as William Howard's PlotIterators.lua utility from civ5, for example, or either of my own plot data-gathering utilities from civ5.
  • Would appreciate a confirmation
Have spent the last 4 hours trying to do this, with no success. Existing files work fine, but custom lua files from your own mod just don't seem to work. But then again, I could be doing something totally wrong too....
 
Item #1 in the op:
[fixed by Winter 2016 patch]Lua scripts that are activated in the modinfo file as "GameplayScripts" only load into the game when a new game is started.
As noted, this issue was fixed in the Winter 2016 patch. These Gameplay Scripts are now properly activated when a saved game is loaded.

ImportFiles type for "FrontEnd Actions" became available with the latest patch (according to Sukritact) and this now allows for "Front End" UI files to be replaced with modded versions. Front End actions so far as I am aware do not support GameplayScripts. This makes sense because there is nothing really for GameplayScripts to do until the player is "in-Game".
 
Back
Top Bottom