Is updating Text database through SQL still possible?

Ryoga

King
Joined
Oct 12, 2010
Messages
993
During my searches I came across this old thread .

MouseyPounds describes a system that allows to change Text using DB.Query from Live Tuner. This is relevant for my purposes so I tried.
Everyone seems to agree that it actually works in the thread, but to me it does nothing.

Am I doing something wrong, or is that something that was changed with new expansions and patches and is no longer working?
 
You do it like this (the example is from Ea)
Code:
REPLACE INTO Language_en_US (Tag, Text) VALUES ('TXT_KEY_LEADER_BARBARIAN', 'Animals');
Just replace the key and value with whatever you want to change.
 
That doesn't seem to work either.

Let me clarify. The issue is not changing the database "onModActivated", but changing the database while the game is already running, for example from Live Tuner using the lua function "DB.Query".

According to the thread I linked it is possible for the language database.
 
That doesn't seem to work either.

Let me clarify. The issue is not changing the database "onModActivated", but changing the database while the game is already running, for example from Live Tuner using the lua function "DB.Query".

According to the thread I linked it is possible for the language database.

OK, I misunderstood want you ment. I wouldn't be surprised that they changed the functionality at some point, I can't really think of why one would want to change the text keys ingame.
 
See my Norway or Franks mods, or Leugi's Philistines, for an example. The Franks change the leaders name, usually Charlemagne, to Charles Augustus after a specific condition is met, whilst Leugi's mod changes the name of the civ, usually the Philistines, to Philistea. Norway, in this example, changes the leader's name, usually Haakon Haakonsson, to Haakon the Holy (yes, Haakon the Holy the Pious :p)

Code:
if X then
	str =  Locale.ConvertTextKey("TXT_KEY_JFD_NORWAY_THE_HOLY_ENACTED");
	local tquery = {"UPDATE Language_en_US SET Text = '".. str .."' WHERE Tag = 'TXT_KEY_LEADER_JFD_HAAKON'"}
	for i, iQuery in pairs(tquery) do
		for result in DB.Query(iQuery) do
		end
	end
		-- refresh UI texts
	Locale.SetCurrentLanguage( Locale.GetCurrentLanguage().Type )
end

I think it resets on game re-load, but I deal with this in my mods by re-updating it after the load screen closes.

Don't know about doing it in Firetuner, but it stands to reason that it'd be possible.
 
Most of the databases are cached on start up the game reads from the cache not the database during the game. Text keys could be different but I'm skeptical. I believe the exact time of the caching has changed over the years (from vanilla to G&K to BNW) so information from vanilla days is likely no longer accurate.
 
See my Norway or Franks mods, or Leugi's Philistines, for an example. The Franks change the leaders name, usually Charlemagne, to Charles Augustus after a specific condition is met, whilst Leugi's mod changes the name of the civ, usually the Philistines, to Philistea. Norway, in this example, changes the leader's name, usually Haakon Haakonsson, to Haakon the Holy (yes, Haakon the Holy the Pious :p)

Code:
if X then
	str =  Locale.ConvertTextKey("TXT_KEY_JFD_NORWAY_THE_HOLY_ENACTED");
	local tquery = {"UPDATE Language_en_US SET Text = '".. str .."' WHERE Tag = 'TXT_KEY_LEADER_JFD_HAAKON'"}
	for i, iQuery in pairs(tquery) do
		for result in DB.Query(iQuery) do
		end
	end
		-- refresh UI texts
	[COLOR="Red"]Locale.SetCurrentLanguage( Locale.GetCurrentLanguage().Type )[/COLOR]
end

I think it resets on game re-load, but I deal with this in my mods by re-updating it after the load screen closes.

Don't know about doing it in Firetuner, but it stands to reason that it'd be possible.

That was it!!!
You need to refresh the UI texts! And that's how you do it!

I just used MouseyPounds line and then yours and it worked like a charm on Live Tuner!

Thanks a lot JFD, after so many headaches I can finally do the mods that I want!
 
BTW, as part of this, know that using that tends to take a bit of time ingame... so when one updates like 24 texts at the same time it can take quite a while.
 
Top Bottom