• 0

    posted a message on How to get frame name from onClick?
    I need to find out the name from the frame that called "onClick" event, but how?

    why won't this work?

    local function Clicked(self, button, down)
       ChatFrame1:AddMessage("click came from: " .. self)
    end
    
    -- Button widget code
    button1:SetScript("onClick", Clicked)
    
    Posted in: Lua Code Discussion
  • 0

    posted a message on Hey guys
    Hmm yes good points, will do that thanks.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Hey guys
    I have more of a philosophical question rather than just coding. I've made a few very nice addons that enhance or modify the default UI in all sorts of ways. what I've been doing so far is for each new addon I create I then integrate it into a larger addon which will contain all my little addons bunched up into one large one.
    I'm wondering if this is considered a good idea in regards to stability & performance, etc, etc or should I split them all apart and create several small addons each with its own folder and toc files and what not?

    Or perhaps there is a way to split them up but integrate them as modules which can be safely disabled from within the main addon. (or just deleted from the folder if the user prefers).
    Posted in: Lua Code Discussion
  • 0

    posted a message on SMall qustion about framestrata och LVL
    Ok, this is my addon, it makes afontring on the middle of the screen ("hello") and it worked great! except for one thing. WHn im using ALT+Z, or what is ALT+x, I dont remember but you know what ie man! its when the whole UI get disabled/removed so you basicly only see your screens without and addon,
    OK now to the problem, my fonstring pops up even if i just removed everyhing on the screen with the alt+X/Z, what should i do?! fonstring:SetAlpha??
    Posted in: Lua Code Discussion
  • 0

    posted a message on 3.2 Minimap - too small icons
    is it possible to change the object icons on the minimap to a larger sieze? BEfore 3.2 the icons were perfect but now they are way too small imo ;)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Saving tables between sessions
    another question about tables, how do you get the key from a table and not the value?
    for example:

    local tbl = {}
    tbl.banana = "yellow"
    tbl.orange = "orange"

    how do I print the key "banana" and not the value?
    if i do
    print(tbl.banana)
    i get "yellow" but i want the name of the key.. :confused:
    Posted in: Lua Code Discussion
  • 0

    posted a message on Saving tables between sessions
    Quote from lilsparky
    also when you use a saved variable, make sure to pick a good name since it's a global.

    i made the mistake of using "Config" in one of my mods and i have yet to correct it cuz i don't want people's configs to all go kablooey. i wish i had thought more about it to start with. plus now even if change it, people will have a table that gets loaded called "Config" which might step on something else with that name.


    rofl thanks for the tip, will do ;)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Saving tables between sessions
    thank you very much
    Posted in: Lua Code Discussion
  • 0

    posted a message on Saving tables between sessions
    Hi all, I made an addon with a database (as a table) for saving stuff. But now i want to save them between sessions using #SavedVaribales in the addon.toc file, how can i do this??
    ##SavedVariables: myDB
    ^will not work :confused:

    my db looks something like this
    local myDB = {
    lock = true,
    x = 10,
    y = 1,
    }

    all i see is myDB = nil, in the saved variables file? :(
    Posted in: Lua Code Discussion
  • 0

    posted a message on Creating pretty bars
    Indeed it was a little bit tricker, I looked at the code from LibBar and realized I've got a LOT to learn ;) In other words, I didn't understand a single thing. However, Slakah, your piece of code worked perfectly! I can actually understand what it does too and wow, it's so simple yet so clever. Thanks a lot!
    Posted in: Lua Code Discussion
  • 0

    posted a message on Creating pretty bars
    @falconindy and lilsparky: thanks guys! both suggestions were really nice but in the end I went with the sin function.
    This is what I ended up with
    if (etime-GetTime() <= 6) then
    	statusBar:SetAlpha(0.4 *  math.sin(etime-GetTime() * 6) + 0.5)
    else
    	statusBar:SetAlpha(1)
    end

    Where etime = the expiration time of the debuff I'm tracking and statusBar being my statusbar. It works great! Now the only thing left is making the bar change color depending on how much time is left (or the value of the bar), any ideas?

    What I'm looking for is a way to make a smooth transition between say, 3 colors? green, yellow, red
    Posted in: Lua Code Discussion
  • 0

    posted a message on Creating pretty bars
    Quote from falconindy
    Flashing is usually accomplished with a sinusoidal function of time, since it conveniently can be manipulated to fluxuate between 0 and 1 (and assigns the value for the Alpha channel).


    Could you provide a simple example on how to achieve this? Would be awesome.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Creating pretty bars
    So I've successfully created my first addon with a nice little status bar, but now I want to make it look better. At the moment it's just a statusbar with a counter at the end and I was looking at Quartz and I want my bars to look a bit more like them.

    What I'm wondering about is the shadow or backdrop or whatever you call it on the bars. Is it simply just another statusbar with the same max value but in another color (black) underneath the original bar? Or is there some way to create this background bar without making a new statusbar?


    Second question is about making the bars flash when they are about to run out, I've seen this effect on bars in deadly boss mods and I think it looks cool. They also switch color depending on the value on the bar.
    My guess is you have to play around with the alpha to get the flash effect but I have really no idea how to do it. As for the colors I guess you could check the value of the bar on each OnUpdate and change color depending on what value it is. But again, I have no idea how to create this effect. Halp!
    Posted in: Lua Code Discussion
  • 0

    posted a message on Hiding frames
    Oh.. so you mean I have to create a 3rd frame which will function as "the mover"? That makes sense I guess hmm.. yeah that could work. Or.. can any frame function as a parent? I mean can a Statusbar frame work as a parent frame? And then I could attach a "mover" frame to it? Yeah, that's probably what you just said.. hmm *thinking loud* sorry :P
    Posted in: Lua Code Discussion
  • 0

    posted a message on Hiding frames
    I don't want MyFrame to never ever show because it's gonna be the way to move the bar when its "unlocked". So maybe I'm missing something but how are you supposed to create an anchor for your frame (as in a visual anchor to move your frames on the screen) if you can't hide it without hiding the entire addon? Does that make any sense or should I try to explain it further?
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.