WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Global config in xml (https://www.wowinterface.com/forums/showthread.php?t=57241)

EKE 06-28-19 12:00 AM

Global config in xml
 
I dont know how to description the question i wanna ask......for example, I do this in Config.lua:
Lua Code:
  1. local EKPlates, ns = ...
  2.  
  3.     ns[1] = {} -- C, config
  4.     ns[2] = {} -- G, globals (Optionnal)
  5.  
  6. local C, G = unpack(select(2, ...))
  7.  
  8.     -- config
  9.     G.norFont = STANDARD_TEXT_FONT

It's fine but now I need to make a xml template:

Code:

<FontString parentKey="value" font="Interface\AddOns\EKPlates\media\font.ttf" justifyH="CENTER" outline="NORMAL">
how to get media/font/texture file config in xml?

I know this is wrong

Code:

<FontString parentKey="value" font=G.norFont justifyH="CENTER" outline="NORMAL">
but I dont know the correct way......

Fizzlemizz 06-28-19 12:10 AM

You can only use information from lua in xml by using globals. xml doesn't understand ... like lua does.

myrroddin 06-28-19 08:09 AM

https://www.wowinterface.com/forums/...ad.php?t=36308

https://wow.gamepedia.com/Using_the_AddOn_namespace

EKE 06-28-19 12:26 PM

I know how to use them in lua, just wanna know how to use config/options in xml,

reading links in wiki now

Quote:

Originally Posted by Fizzlemizz (Post 332626)
You can only use information from lua in xml by using globals. xml doesn't understand ... like lua does.

so lua cannot understand those config so it is....not feasible right? thanks for reply

SDPhantom 06-28-19 02:36 PM

I would suggest setting the FontString in XML to inherit from an ingame font initially, then change it from Lua when your config loads using Fontstring:SetFont().

Alternatively, you can try your luck with CreateFont() and inheriting it in your XML.
Lua Code:
  1. local NorFont=CreateFont("EKPlates_NorFont");-- This is the global name we'll use when inheriting this font
  2. NorFont:CopyFontObject("GameFontHightlightSmall");--    Initiate to an ingame font
  3. NorFont:SetFont("Interface\\AddOns\\EKPlates\\media\\font.ttf",12,"OUTLINE");-- Set our custom font
XML Code:
  1. <FontString parentKey="value" inherits="EKPlates_NorFont" justifyH="CENTER">

Note: Last time I tried creating fonts in Lua, there was a bug where the font couldn't be used even after using Font:SetFont() unless I initially inherited from an ingame font first.

EKE 06-29-19 06:32 PM

Quote:

Originally Posted by SDPhantom (Post 332658)
Alternatively, you can try your luck with CreateFont() and inheriting it in your XML.
Lua Code:
  1. local NorFont=CreateFont("EKPlates_NorFont");-- This is the global name we'll use when inheriting this font
  2. NorFont:CopyFontObject("GameFontHightlightSmall");--    Initiate to an ingame font
  3. NorFont:SetFont("Interface\\AddOns\\EKPlates\\media\\font.ttf",12,"OUTLINE");-- Set our custom font
XML Code:
  1. <FontString parentKey="value" inherits="EKPlates_NorFont" justifyH="CENTER">

It's useful, Thank you very much! :banana:


All times are GMT -6. The time now is 07:47 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI