Fully Modifiable Custom Notifications

CustomNotifications, CustomNotificationManager, CustomNotificationHandler?
 
"I" is an abstraction. :)
 
True about 'I', but without that pronoun the line can be interpreted as "the name is only going to cause headaches like where this mod is going" which has a totally different meaning! :crazyeye:

Are lua files considered tables? The reference material does say everything in lua is tables... if "CustomNotification.lua" is actually a table of strings and include("CustomNotification") simply concatenates the current file's table with the first table it finds starting with the name CustomNotification... it could explain the odd behavior.

Well, I got it working and it hides the starvation notification, but the sound effect and 'glow' on the city still appear, like when I deleted the notification from NotificationPanel.xml. Do you know if it's possible to get rid of those additional effects?
 
Referring to filename: ModifiableCustomNotifications - just to match how the thread title refers to it?
 
True about 'I', but without that pronoun the line can be interpreted as "the name is only going to cause headaches like where this mod is going" which has a totally different meaning!

:lol: Got it now.

And I like Sam's idea, but how about... SneaksFullyModifiableCustomNotifications.lua

_
 
SneaksAndAlpacasSuperAwesomeFullyModifiableCustomNotificationsThatUseSomeCodingIdeasFromOtherModdersSuchAsMoafThoughStillDontReallyUseContextsThatWellBecauseTheyAreConfusingAndPoorlyDocumented.lua
 
"The specified path, file name, or both are too long, The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters." -- ModBuddy Error

Figures...

edit: 248 ??

_
 
edit: 248 ??
The only explanation I can think of, it being near 255, is that they have a length for a whole structure in a byte, and there's 7 bytes (or whatevers) used for other stuff.

Or it's just cracked. It's probably from the VS underlying stuff.
 
I'm pretty sure every table, variable, function, etc, has a 7 character id tied to it
 
What I don't get, from my limited and possibly faulty understanding of contexts, is that any data defined in a included file will be defined in the context of the including file, and will be separate from any other instance of the included file; this would lead to any registered LuaEvent having an identical (but separate) instance of the function defined n times, where n is the number of contexts the file is included from, or possibly as much as the number of times it is included (if it's included in the same context more than once). Where an included file is included strictly once that wouldn't matter, and where it doesn't register event handlers it wouldn't either.

Has this been tested with multiple inclusions? Just curious. If it has, I need to re-think my understanding of either contexts or the various event registering functions. It might be checking for equivalence of the chunks that make up the event handler, I suppose...
 
I run this successfully in CCMAT with Emigration Mod, Liberation Boost, Random Events, and my own Improved Events all using Custom Notifications.
 
I basically duplicate c++ "#ifndef" precompiler statements to prevent the issue in my files, and named it "PragmaOnce" since that's similar to microsoft's version.

Code:
--[[ PragmaOnce(value) usage examples: ensures a block of code is only run once

if PragmaOnce("TU_TurnPers") then
    Events.ActivePlayerTurnStartAdd( DoAtTurnStart )
    Events.ActivePlayerTurnEndAdd( DoAtTurnEnd )
end
--]]
MapModData.InitializedValue = MapModData.InitializedValue or {}
function PragmaOnce(value)
    if not MapModData.InitializedValue[value] then
        MapModData.InitializedValue[value] = {}
        return true
    end
    return false
end

I just wish I knew a reliable way to ensure there wouldn't be any mod conflicts with similarly-chosen strings. I did some searches through other mods and everyone seems to manually define their mod name or ID... is there a way to get uniquely identifying information directly?

Also, any ideas for the earlier problem? :)
Well, I got it working and it hides the starvation notification, but the sound effect and 'glow' on the city still appear, like when I deleted the notification from NotificationPanel.xml. Do you know if it's possible to get rid of those additional effects?
 
...is there a way to get uniquely identifying information directly?

Code:
modinfo key-value pairs from Modding.GetInstalledMods():

  "Authors"                  = string.
  "MinCompatibleSaveVersion" = integer-string.
  "SpecialThanks"            = string.
  "Description"              = string.
  "ReloadUnitSystem"         = integer-string (0/1).
  "SupportsSinglePlayer"     = integer-string (0/1).
  "SupportsMultiplayer"      = integer-string (0/1).
  "SupportsMac"              = integer-string (0/1).
  "Enabled"                  = boolean.
  "Name"                     = string.
  "ReloadLandmarkSystem"     = integer-string (0/1).
  "ID"                       = unique-string.
  "AffectsSavedGames"        = integer-string (0/1).
  "Stability"                = string (Experimental/Alpha/Beta) (nil=Stable).
  "Version"                  = integer.
  "Homepage"                 = url-string.

A combination of "ID" and "Version" is probably what you'll want. :)
 
Do you know a way to get the path of a lua file, or some other way to check which mod (retrieved from GetInstalledMods) the file resides in?

Now that I think about it, if we can get the path, the need for figuring out which mod it's in isn't necessary.
 
This thread has been inactive for a while. Does this still work? Are the very detailed instructions in the first post still correct (more or less)?
 
Back
Top Bottom