function GetLanguage takesnothingreturnsstringlocalstring Name = GetObjectName('hfoo')if Name=="Soldat"thenreturn"German"endifif Name=="Footman"thenreturn"English"endif// Do NOT use elseif, because that may cause desyncs// Add other languages with other unit names herereturn"Other"endfunction
This function returns the game language of the local player.
The result may be different for different players, it is asynchronous.
An asynchronous variable is no problem, a long as you do not create any handles (including strings) for one player only or change values affecting the game (like a unit's hp).
For those, who know how to use asynchronous values, it is useful for multiboards or notifications.
You can submit new scripts in this section You can comment on scripts in this section You cannot edit your scripts in this section You cannot delete your scripts in this forum