View Single Post
07/29/22, 01:27 AM   #6
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,913
Keep in mind that changing the SI_ constants of the vanilla game could make other addons break which rely on it, via string comparison e.g.

Not applicable here I guess but for e.g. some menu entries the descriptors of the menu buttons use those SI_ constants and the only way to identify the ciorrect button/tab would be this constants. And they could be re-used the same time at other coding you would need to change (e.g. the word "Research" or somethign similar).
So if you change them you'd change the menu button too by accident (depends on if the menu button is created as the menu opens, then it would be changed, or even before as vanilla code was loaded already -> Gamepad input UI often does create the stuff as it opens!)

At best create your own MY_ADDON_CONSTANT = "String here" as only vanilla game string constants should start with SI_, and then apply them ONLY THERE where really needed, so all other constants and code and addons still run fine.

That said, in your example here, you could just check the function I've linked above and rebuild it.
Lua Code:
  1. --original function code
  2. function Compass:SetCardinalDirections(font)
  3.     self.container:SetCardinalDirection(GetString(SI_COMPASS_NORTH_ABBREVIATION), font, CARDINAL_DIRECTION_NORTH)
  4.     self.container:SetCardinalDirection(GetString(SI_COMPASS_EAST_ABBREVIATION), font, CARDINAL_DIRECTION_EAST)
  5.     self.container:SetCardinalDirection(GetString(SI_COMPASS_WEST_ABBREVIATION), font, CARDINAL_DIRECTION_WEST)
  6.     self.container:SetCardinalDirection(GetString(SI_COMPASS_SOUTH_ABBREVIATION), font, CARDINAL_DIRECTION_SOUTH)
  7. end
  8.  
  9.  
  10. --Your function:
  11. local function MyUpdateCompassCardinalDirections(font)
  12.     local compassContainer = COMPASS.container
  13.     compassContainer:SetCardinalDirection(GetString(MY_ADDON_COMPASS_NORTH_ABBREVIATION), font, CARDINAL_DIRECTION_NORTH)
  14.     compassContainer:SetCardinalDirection(GetString(MY_ADDON_EAST_ABBREVIATION), font, CARDINAL_DIRECTION_EAST)
  15.     compassContainer:SetCardinalDirection(GetString(MY_ADDON_WEST_ABBREVIATION), font, CARDINAL_DIRECTION_WEST)
  16.     compassContainer:SetCardinalDirection(GetString(MY_ADDON_SOUTH_ABBREVIATION), font, CARDINAL_DIRECTION_SOUTH)
  17. end

This would keep the original string constant alive for other addons use!
  Reply With Quote