Page 5 of 7 FirstFirst ...
3
4
5
6
7
LastLast
  1. #81
    Deleted
    Are your tga files' width/height powers of two?

  2. #82
    Yeah just double checked that and they are. Got any ideas on the error on the second part maybe?

  3. #83
    Deleted
    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.

  4. #84
    Yeah the font exists, I'll try the 3rd argument you suggested. Thanks

  5. #85
    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.

  6. #86
    Good info, thx!

  7. #87
    Deleted
    I always include the .ttf, so that's not the issue.

  8. #88
    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?

  9. #89
    Quote Originally Posted by Treeston View Post
    I always include the .ttf, so that's not the issue.
    Really? Whenever I did it errored. strange...

  10. #90
    Deleted
    Quote Originally Posted by Shivano View Post
    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?
    Think you could paste us our new code again?

    ---------- Post added 2011-07-21 at 12:23 PM ----------

    Quote Originally Posted by Brusalk View Post
    Really? Whenever I did it errored. strange...
    Code:
    :SetFont("Fonts\\FRIZQT__.TTF", 12, "OUTLINE")
    Typed it so often it's in muscle memory already.

  11. #91
    Main addon:
    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)
    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.

    Second addon:
    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)
    Here I changed the way the font is set to the FontString and now it is error free. But not displaying my FontString ingame.

  12. #92
    Deleted
    You never SetPoint your FontString.

  13. #93
    Ah oke I'll test that when I get home, I guess my boss wouldn't want me to play wow during hours

  14. #94
    Thanks for the help everyone I got it fixed. The bar at the top in the picture is what I made. (Clicky for bigger image)

    Last edited by Shivano; 2011-07-23 at 01:37 AM. Reason: Failed the image the first time :s

  15. #95
    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.

    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)
    I dont think ace lets me use a SavedVariablesPerCharacter so i cannot do the default setup.

    Thanks in advanced with any help.

    Coke

  16. #96
    Deleted
    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.

  17. #97
    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

  18. #98
    Deleted
    Yeah, didn't notice. Fixed.

  19. #99
    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 :/

  20. #100
    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.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •