Quantcast
Global config in xml - WoWInterface
Thread Tools Display Modes
06-28-19, 12:00 AM   #1
EKE
An Aku'mai Servant
 
EKE's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2011
Posts: 33
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......
__________________
AltzUI Contributor for Feedback ONLY.

My Addon: EKPlates
  Reply With Quote
06-28-19, 12:10 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,292
You can only use information from lua in xml by using globals. xml doesn't understand ... like lua does.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
06-28-19, 08:09 AM   #3
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,124
https://www.wowinterface.com/forums/...ad.php?t=36308

https://wow.gamepedia.com/Using_the_AddOn_namespace

Last edited by myrroddin : 06-28-19 at 08:13 AM.
  Reply With Quote
06-28-19, 12:26 PM   #4
EKE
An Aku'mai Servant
 
EKE's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2011
Posts: 33
I know how to use them in lua, just wanna know how to use config/options in xml,

reading links in wiki now

Originally Posted by Fizzlemizz View Post
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
__________________
AltzUI Contributor for Feedback ONLY.

My Addon: EKPlates

Last edited by EKE : 06-28-19 at 12:38 PM.
  Reply With Quote
06-28-19, 02:36 PM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,979
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.
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 06-28-19 at 02:50 PM.
  Reply With Quote
06-29-19, 06:32 PM   #6
EKE
An Aku'mai Servant
 
EKE's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2011
Posts: 33
Originally Posted by SDPhantom View Post
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!
__________________
AltzUI Contributor for Feedback ONLY.

My Addon: EKPlates
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Global config in xml

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off