+ Reply to Thread
Results 1 to 9 of 9

Thread: Changing text

  1. #1
    Ascendant Credo's Avatar
    Join Date
    Jan 2011
    Posts
    4,172

    Default Changing text

    I'm having an issue with changing text in a Text frame. I have it made so that when Event.Currency triggers it updates the text to the new stack for that currency. It does that correctly (for the most part sometimes it stops doing it until a /reloadui), but the previous text doesn't go away. So I end up with these text fields of gibberish due to numbers being laid on top of each other. Any ideas?
    Even free cost too much now

  2. #2
    Plane Walker Kreiri's Avatar
    Join Date
    Feb 2011
    Posts
    402

    Default

    Are you sure you don't have two overlapping text frames?
    Last edited by Kreiri; 02-20-2012 at 11:23 PM.
    Feminism is the radical notion that women are people.

  3. #3
    Ascendant Credo's Avatar
    Join Date
    Jan 2011
    Posts
    4,172

    Default

    Oh no, there's no overlap. It looks fine until it updates, and the update should only call the SetText function for each Text Frame.

    Code:
    function SetText()
    	len = string.len(GetStack("Platinum, Gold, Silver"))
    	if len <= 4 then
    		plati_text:SetText("0")
    	else
    		plati_text:SetText(string.sub(GetStack("Platinum, Gold, Silver"),1,len-4))
    	end
    	gold_text:SetText(string.sub(GetStack("Platinum, Gold, Silver"),len-3,len-2))
    	silver_text:SetText(string.sub(GetStack("Platinum, Gold, Silver"),len-1,len))
    	favor:SetText(GetStack("Favor"))
    	plan_text:SetText(GetStack("Planarite"))
    	master_plaq_text:SetText(GetStack("Master Craftsman's Mark"))
    	art_text:SetText(GetStack("Artisan's Mark"))
    	corr_text:SetText(GetStack("Corrupted Sourcestone"))
    	curse_text:SetText(GetStack("Cursed Sourcestone"))
    	vile_text:SetText(GetStack("Vile Sourcestone"))
    	in_text:SetText(GetStack("Inscribed Sourcestone"))
    	luck_text:SetText(GetStack("Lucky Coin"))
    	ap_text:SetText(GetStack("Plaque of Achievement"))
    	moa_text:SetText(GetStack("Mark of Ascension"))
    	gmoa_text:SetText(GetStack("Greater Mark of Ascension"))
    end
    table.insert(Event.Currency,{SetText,"Money","Update"})
    Even free cost too much now

  4. #4
    Shield of Telara Adelea's Avatar
    Join Date
    Mar 2011
    Posts
    734

    Default

    What does all your UI.CreateFrame elements look like? And post a screenshot of the problem.

    Sounds like youre writing some sort of currency display - feel free to take a look at my addon MoneyBags to see how I did things.

    http://www.riftui.com/downloads/info177-MoneyBags.html
    http://forums.riftgame.com/image.php?type=sigpic&userid=125779&dateline=13553  38065

  5. #5
    Ascendant Credo's Avatar
    Join Date
    Jan 2011
    Posts
    4,172

    Default

    I'll post some screenshots when I get home. Bascially it's a bar frame set at the bottom of the screen with the text frames set along the bar attached to the icon for the respective currency.
    Even free cost too much now

  6. #6
    Ascendant Credo's Avatar
    Join Date
    Jan 2011
    Posts
    4,172

    Default

    http://i882.photobucket.com/albums/a...-19_133138.jpg

    Hopefully that shows it well enough. There's nils showing up behind some of the numbers. It gets worse the more it updates.


    How all of my frames are created upon loading of the Addon.
    Code:
       main = UI.CreateContext("UI")
    
       bar = UI.CreateFrame("Frame","Bar",main)
    
       plati = UI.CreateFrame("Texture","Platinum",main)
       gold = UI.CreateFrame("Texture","Gold",main)
       silver = UI.CreateFrame("Texture","Silver",main)
       pvp_icon = UI.CreateFrame("Texture","Favor Icon",main) 
       master_plaq = UI.CreateFrame("Texture","Master Craftsmen Mark",main)
       art_mark = UI.CreateFrame("Texture","Artisan Mark",main)
       planarite = UI.CreateFrame("Texture","Planarite",main)
       corr_ss = UI.CreateFrame("Texture","Corrupted Sourcestone",main)
       curse_ss = UI.CreateFrame("Texture","Cursed Sourcestone",main)
       vile_ss = UI.CreateFrame("Texture","Vile Sourcestone",main)
       in_ss = UI.CreateFrame("Texture","Inscribed Sourcestone",main)
       luck_coin = UI.CreateFrame("Texture","Lucky Coin",main)
       achieve_plaq = UI.CreateFrame("Texture","Plaque of Achievement",main)
       moa = UI.CreateFrame("Texture","Marks of Ascension",main)
       gmoa = UI.CreateFrame("Texture","Greater Marks of Ascension",main)
       
       plati_text = UI.CreateFrame("Text","Plat Text",main)
       gold_text = UI.CreateFrame("Text","Gold Text",main)
       silver_text = UI.CreateFrame("Text","Silver Text",main)
       favor = UI.CreateFrame("Text","Favor",main)
       master_plaq_text = UI.CreateFrame("Text","Num. of Master Plaques",main)
       art_text = UI.CreateFrame("Text","Num. of Artisan Marks",main)
       plan_text = UI.CreateFrame("Text","Num. of Planarite",main)
       corr_text = UI.CreateFrame("Text","Num. of Corr. SS",main)
       curse_text = UI.CreateFrame("Text","Num. of Cursed SS",main)
       vile_text = UI.CreateFrame("Text","Num. of Vile SS",main)
       in_text = UI.CreateFrame("Text","Num. of Ins. SS",main)
       luck_text = UI.CreateFrame("Text","Num. of Lucky Coin",main)
       ap_text = UI.CreateFrame("Text","Num. of Plaques of Achieve",main)
       moa_text = UI.CreateFrame("Text","Num. of Marks of A",main)
       gmoa_text = UI.CreateFrame("Text","Num. of G Marks of A",main)
    Even free cost too much now

  7. #7
    Shield of Telara Adelea's Avatar
    Join Date
    Mar 2011
    Posts
    734

    Default

    Now youve posted the addon on curse, I've taken a look.

    Code:
    function Initialize()
    ...
    end
    
    table.insert(Event.Addon.Load.End,{Initialize,"Money","Create UI"})
    Now, you may not be aware, but this event gets fired for each addon that loads, so you could be creating several copies of the text frames.

    Try adding this

    Code:
    function Initialize(a)
    if a ~= "Money" then return end
    ...
    end
    When initiailize is called, it is passed in the addon ID, so you need to check that it is YOUR addon that is being loaded, and then act accordingly.
    http://forums.riftgame.com/image.php?type=sigpic&userid=125779&dateline=13553  38065

  8. #8
    Champion Lorandii's Avatar
    Join Date
    Jun 2011
    Posts
    516

    Default

    Quote Originally Posted by Credo View Post
    http://i882.photobucket.com/albums/a...-19_133138.jpg

    Hopefully that shows it well enough. There's nils showing up behind some of the numbers. It gets worse the more it updates.


    How all of my frames are created upon loading of the Addon.
    Code:
       main = UI.CreateContext("UI")
    
       bar = UI.CreateFrame("Frame","Bar",main)
    
       plati = UI.CreateFrame("Texture","Platinum",main)
       gold = UI.CreateFrame("Texture","Gold",main)
       silver = UI.CreateFrame("Texture","Silver",main)
       pvp_icon = UI.CreateFrame("Texture","Favor Icon",main) 
       master_plaq = UI.CreateFrame("Texture","Master Craftsmen Mark",main)
       art_mark = UI.CreateFrame("Texture","Artisan Mark",main)
       planarite = UI.CreateFrame("Texture","Planarite",main)
       corr_ss = UI.CreateFrame("Texture","Corrupted Sourcestone",main)
       curse_ss = UI.CreateFrame("Texture","Cursed Sourcestone",main)
       vile_ss = UI.CreateFrame("Texture","Vile Sourcestone",main)
       in_ss = UI.CreateFrame("Texture","Inscribed Sourcestone",main)
       luck_coin = UI.CreateFrame("Texture","Lucky Coin",main)
       achieve_plaq = UI.CreateFrame("Texture","Plaque of Achievement",main)
       moa = UI.CreateFrame("Texture","Marks of Ascension",main)
       gmoa = UI.CreateFrame("Texture","Greater Marks of Ascension",main)
       
       plati_text = UI.CreateFrame("Text","Plat Text",main)
       gold_text = UI.CreateFrame("Text","Gold Text",main)
       silver_text = UI.CreateFrame("Text","Silver Text",main)
       favor = UI.CreateFrame("Text","Favor",main)
       master_plaq_text = UI.CreateFrame("Text","Num. of Master Plaques",main)
       art_text = UI.CreateFrame("Text","Num. of Artisan Marks",main)
       plan_text = UI.CreateFrame("Text","Num. of Planarite",main)
       corr_text = UI.CreateFrame("Text","Num. of Corr. SS",main)
       curse_text = UI.CreateFrame("Text","Num. of Cursed SS",main)
       vile_text = UI.CreateFrame("Text","Num. of Vile SS",main)
       in_text = UI.CreateFrame("Text","Num. of Ins. SS",main)
       luck_text = UI.CreateFrame("Text","Num. of Lucky Coin",main)
       ap_text = UI.CreateFrame("Text","Num. of Plaques of Achieve",main)
       moa_text = UI.CreateFrame("Text","Num. of Marks of A",main)
       gmoa_text = UI.CreateFrame("Text","Num. of G Marks of A",main)
    I hope all those variables are local to your addon. Also, did you call ClearAll() before you called SetText() ?

  9. #9
    Ascendant Credo's Avatar
    Join Date
    Jan 2011
    Posts
    4,172

    Default

    Okay, I'll give get these in there. Thanks guys!
    Even free cost too much now

+ Reply to Thread

Bookmarks

Posting Permissions

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