Are your tga files' width/height powers of two?
Are your tga files' width/height powers of two?
Yeah just double checked that and they are. Got any ideas on the error on the second part maybe?
Never used CreateFont before, so that's completely new to me. I always directly SetFont on the FontString.
---------- Post added 2011-07-20 at 08:21 PM ----------
The font file you specified also exists? If it does, try passing an empty string as arg3 to SetFont, not sure if that's required, but might be.
Yeah the font exists, I'll try the 3rd argument you suggested. Thanks
setFont will error if you type the font path / name incorrectly.
Looking at your code, you included the .ttf file extension in the string you use to set the font, and setfont only wants the name (not the extension)
Try removing the .ttf from the font declaration and it should fix your problem.
Good info, thx!
I always include the .ttf, so that's not the issue.
Okey I managed to fix all the errors I was having by disableing the CreateFont en just set the font to the fontstring for now. I also managed to get the toppanel to show, had some issues with the wrong type of tga file it seemed. But now I ran into the next problem, my text isn't showing at all. I tried to give the frame I created a higher strata then the topframe but that didn't change a thing. Is there anything more I should do to let my text show?
Main addon:
I made some changes to the width/height and positioning of the frame and I removed the CreateFont function. The font is now set in directly to the FontString in the code below.Code:-- Frames local EventFrame = CreateFrame("Frame") local Topbar = CreateFrame("Frame", "jbTopbar", UIParent) -- Variables local BackgroundTexture = "Interface\\Addons\\jbTopbar\\Textures\\jbBackground.tga" local BorderTexture = "Interface\\Addons\\jbTopbar\\Textures\\jbBorder.tga" -- Events EventFrame:RegisterEvent("PLAYER_LOGIN") -- OnEvent EventFrame:SetScript("OnEvent", function(self,event,...) Topbar:SetFrameStrata("BACKGROUND") Topbar:SetWidth(1928) Topbar:SetHeight(24) Topbar:SetPoint("TOPLEFT", -4, 4) Topbar:SetBackdrop({ bgFile = BackgroundTexture, edgeFile = BorderTexture, tile = true, tileSize = 16, edgeSize = 16, insets = { left = 0, right = 0, top = 0, bottom = 0 } }) Topbar:SetBackdropColor(0,0,0,1) Topbar:SetBackdropBorderColor(0,0,0,1) end)
Second addon:
Here I changed the way the font is set to the FontString and now it is error free. But not displaying my FontString ingame.Code:-- Frames local EventFrame = CreateFrame("Frame") local TopbarMoney = CreateFrame("Frame", "jbTopbarMoney", jbTopbar) -- Fontstrings local TopbarMoneyText = TopbarMoney:CreateFontString("TopbarMoneyText") TopbarMoneyText:SetFont("Interface\\Addons\\jbTopbar\\Fonts\\jbFont.ttf",10) TopbarMoneyText:SetTextColor(1,1,1,1) -- Variables local PlayerMoney local PlayerGold local PlayerSilver local PlayerCopper local MoneyString -- Events EventFrame:RegisterEvent("PLAYER_LOGIN") EventFrame:RegisterEvent("PLAYER_MONEY") -- OnEvent EventFrame:SetScript("OnEvent", function(self,event,...) PlayerMoney = GetMoney() PlayerGold = floor(abs(PlayerMoney / 10000)) PlayerSilver = floor(abs(mod(PlayerMoney / 100, 100))) PlayerCopper = floor(abs(mod(PlayerMoney, 100))) MoneyString = PlayerGold.."G "..PlayerSilver.."S "..PlayerCopper.."C" TopbarMoneyText:SetText(MoneyString) end)
You never SetPoint your FontString.
Ah oke I'll test that when I get home, I guess my boss wouldn't want me to play wow during hours
Hello,
I'm trying to add the greeting to my core file but seem to be having issues. My code is as follows and yet when i log in on a char that i havent logged in before on i get this message "Welcome to Azeroth Shampaín. How nice to see you again. Your using BasicUI v1.0." not sure what im doing wrong but I have ace installed with the UI and I think it isnt letting it work right.
I dont think ace lets me use a SavedVariablesPerCharacter so i cannot do the default setup.Code:-- Greeting local EventFrame = CreateFrame("Frame") EventFrame:RegisterEvent("PLAYER_LOGIN") EventFrame:SetScript("OnEvent", function(self,event,...) if type(BasicUI.db.char) ~= "table" then -- I know it doesn't exist. so set it's default BasicUI.db.char = {} BasicUI.db.char[UnitName("Player")] = 1 ChatFrame1:AddMessage('Welcome to Azeroth '.. UnitName("Player")..". I do believe this is the first time we've met. Nice to meet you! Your using |cff00B4FFBasicUI v"..version..'|r.') else -- It's already set if BasicUI.db.char[UnitName("Player")] == 1 then ChatFrame1:AddMessage('Welcome to Azeroth '.. UnitName("Player")..". How nice to see you again. Your using |cff00B4FFBasicUI v"..version..'|r.') else ChatFrame1:AddMessage('Welcome to Azeroth '.. UnitName("Player")..". How nice to see you again. Your using |cff00B4FFBasicUI v"..version..'|r.') end local found = 0 for name,number in pairs(BasicUI.db.char) do if UnitName("Player") == name then BasicUI.db.char[name] = BasicUI.db.char[name] + 1 found = 1 end end if found == 0 then BasicUI.db.char[UnitName("Player")] = 1 end end end)
Thanks in advanced with any help.
Coke
Eh, of course you can use SVPC. Also, your code won't work because the "first time" message will only print if it's the first time you log on at all (BasicUI.db.char is not a table, as opposed to BasicUI.db.char[UnitName("player")] being nil).
This is what would work (far shorter, too):
Code:EventFrame:SetScript("OnEvent",function() BasicUI.db.char = BasicUI.db.char or {} local playerIdent = (UnitName("player")).."-"..(GetRealmName():gsub("%s","")) BasicUI.db.char[playerIdent] = (BasicUI.db.char[playerIdent] or 0)+1 print("Welcome to Azeroth, "..(UnitName("player"))..". "..((BasicUI.db.char[playerIdent] == 1) and "I do believe this is the first time we've met. Nice to meet you!" or "How nice to see you again.").." You're using |cff00b4ffBasicUI v"..version.."|r.") end)
Last edited by mmocba105e19de; 2011-09-12 at 03:53 PM.
There is one issue with it tho in the print function you need to add a ")" with (UnitName("player") or it throws a error but other then that works great.
Thank You.
Coke
Yeah, didn't notice. Fixed.
after reading thru and trying 3 times i've give up either its MoP. else im doing something wrong
i just can't seem to get the HelloThar text ingame no matter what i do..
i only get the "Welcome to patch 5.0.4 etc etc.."
sorry from bringing this old thread back but i want to learn :/
As someone who is exploring a computer science degree, but only has limited knowledge of java, C and C++, I found this thread to be very interesting!
(Sorry for the necro.)