• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

The config() function tricks

Status
Not open for further replies.
Level 3
Joined
Oct 13, 2012
Messages
28
I tested custom code in the config() function using JassHelper feature:

Code:
//! inject config
    call SetMapName("Foo")
    call SetMapDescription("Bar")
    call SetPlayers(10)
    call SetTeams(10)
    call SetGamePlacement(MAP_PLACEMENT_TEAMS_TOGETHER)

    // ...

    call InitCustomPlayerSlots()
    call InitCustomTeams()
    call InitAllyPriorities()
//! endinject

I didn't notice any difference with custom values in SetMapName() and SetMapDescription(): what do these functions? It looks like WC3 in the lobby takes names from the metadata, not by calling config() function.

Also I tried to test timers: they start only after game loading (however, I had no opportunity to test it for 2 players: probably, it allows to measure loading time with respect to the very first player with fastest time?).

I wonder if somebody knows useful/curious tricks with config() function. For example, in theory, if SetMapName() changes the name of the map for Battle.net lobby interface, one can detect language of the client (e.g. via GetLocalizedString) and set translated names and descriptions (if names/descriptions are not part of sync algorithm of course).
 
Level 3
Joined
Oct 13, 2012
Messages
28
Ah, you probably mean to modify for all players. So any different variable value excepting hashtables causes desync? Even when it's about UI? And it's impossible to make different UI look for different players (in terms of different set of frames)?
 
Last edited:
I didn't notice any difference with custom values in SetMapName() and SetMapDescription(): what do these functions? It looks like WC3 in the lobby takes names from the metadata, not by calling config() function.
That is cause at that point the old text already was transfered to the frame showing the text inside the lobby. One could change the displayed text of that frame, but using BlzGetFrameByName inside the lobby will crash the game after the map was started and exited.

You don't need such tricks to know in which language a player plays.
BlzGetLocale() tells you which version(language) of the game is used. Although I don't know what one wants with this info. The new folder system since 1.31 makes multilanguage map quite easy (technical to create) by importing Strings/Sounds/Textures/FDF into _Locales, "_Locales/frFR.w3mod/war3map.wts", "_Locales/deDE.w3mod/war3map.wts", "_Locales/zhCN.w3mod/war3map.wts" as seen in warchasers (1.31).
 
Level 3
Joined
Oct 13, 2012
Messages
28
That is cause at that point the old text already was transfered to the frame showing the text inside the lobby.
"old" text loads from metadata? But what's the point in these 2 functions then? Or it loads from some cache?

BlzGetLocale() tells you which version(language) of the game is used. You don't need such tricks to know in which language a player plays.
Oh, didn't see that function.

Although I don't know what one wants with this info.
As I can see in some threads, people say it returns exactly locale (like "en_US", "en_GB"), so it may help to adapt map for different countries ("Harry Potter and the Sorcerer's Stone" vs "Harry Potter and Philosopher's stone").

Some board games are identical, but have some little differences in various countries. So it also may help.

makes multilanguage map quite easy (technical to create) by importing Strings/Sounds/Textures/FDF into _Locales, "_Locales/frFR.w3mod/war3map.wts", "_Locales/deDE.w3mod/war3map.wts", "_Locales/zhCN.w3mod/war3map.wts" as seen in warchasers (1.31).
Does it support named placeholders like "Hello, {username}"? It seems not. If one wants such feature, he will need to keep those strings in the script file I guess.

Named are necessary due to possible different order in lexemes for different languages.
 
Last edited:
As I can see in some threads, people say it returns exactly locale (like "en_US", "en_GB"), so it may help to adapt map for different countries ("Harry Potter and the Sorcerer's Stone" vs "Harry Potter and Philosopher's stone").
Some board games are identical, but have some little differences in various countries. So it also may help.
Havent through about that. But you are right can be useful, Had only the multilanguage in mind.
Does it support named placeholders like "Hello, {username}"? It seems not. If one wants such feature, he will need to keep those strings in the script file I guess.

Named are necessary due to possible different order in lexemes for different languages.
It does not support that nativly, But you can create the base text in each Language and define a common placeholder Symbol which than is replaced with game data during the game, before printing that text. Like in your example "Hello, {username}" when loading that string one would replace {username} with a PlayerName using concate strings or replace strings.
Such text could be defined using StringList in Fdf which allows to define your own new custom GetLocalizedStrings such StringList would be saved in this previous refered _Locales folders to have a different text for each supported Language.
UI: Reading a FDF
 
Level 3
Joined
Oct 13, 2012
Messages
28
I didn't test it yet, but I'm not sure if it works. Because you also need to update the text in runtime for each player (BlzFrameSetText?), otherwise they will see template with placeholders. But it's unclear for me whether it leads to desync or not.

By analogy with multiboard, it probably shouldn't lead to desync (I can fill multiboard with different values for each player).
 
Status
Not open for further replies.
Top