• 0

    posted a message on Create a frame linking to the InspectFrame
    How do I create a frame that is linked to the inspect frame?
    I only want the frame to show when the player inspects someone.

    I have tried various ways, but the frame keeps popping up as soon as I log in (and is positioned relative to UI_Parent rather than the inspect frame), rather than when I inspect someone....
    Posted in: Need Help?
  • 0

    posted a message on gettind buffs by SpellId and using it to change formulae....
    Quote from Farmbuyer
    I've not looked at the rest, but this

    should be something more like

    for i = 1, 40 do
        local spellId = select (11, UnitAura("player",i))
        if not spellId then break end    -- alternatively "if spellId == nil then break end", as you prefer
        <massive code block>


    Once you've hit the end of the active auras, there's no reason to keep running the loop.


    thanks for that ..... needed to put that code in a different place than I initially though. Had to put it at the end of the calculations rather than the beginning.

    Now I have a different problem though.... If you have a buff and select a similar buff from the dropdown, the addon now ignores it and prints'You already have that buff... it will not be factored in to the calculations' or similar...
    Thats the way I want it.... however....
    If you select a buff that you already have, and the addon ignores it .... fine.... but if your buff then disappears, it is still ignored, even if you have it selected from the dropdown .... I reckon I need to use

    self:RegisterEvent("UNIT_AURA")

    somewhere in the code to get it to re-look at the choices if your aura changes.......
    The problem is that the calculations are done on "onClick", so they are only done once.....
    Posted in: Need Help?
  • 0

    posted a message on gettind buffs by SpellId and using it to change formulae....
    yeah ... thats an option.
    I was going about it a different way though. I was tryingto get the spellIds of any buffs present, and factoring it into the equations, but cant seem to pull the spellId. The equations are still working but arent using the spellIds to change the result so I figure its a major error in my attempting to get and use the IDs -
    Heres the code I have in at the minute ....
    	stat = NewDropDownMenu("StatBuffs", rds.Opts, "      Select Stat Buffs you receive.", { 
    	"None",
    	"Kings",
    	"Gift of the Wild",
    	})
    	stat.OnClick = function(buff)
    		for i=1,40 do local _,_,_,_,_,_,_,_,_,_,spellId = UnitAura("player",i) if spellId then
    		if (spellId == 79061 or spellId == 79063) then stat.BuffValue = 1
    		elseif spellId == 87549 then food.MasteryValue = 0
    		elseif spellId == 87554 then food.DodgeValue = 0
    		elseif spellId == 87555 then food.ParryValue = 0
    		elseif spellId == 57330 then strength.StrengthValue = 0
    		elseif spellId == 6673 then strength.StrengthValue = 0
    		elseif spellId == 87545 then food.StrengthValue = 0 
    		else
    		if buff == "None" then
    		stat.BuffValue = 1
    		else stat.BuffValue = 1.05
    		end
    		end
    		end
    	end	
    	UpdateBuffStats()	
    	end



    Because the code is still working, just not factoring in the buffs present, it must be jumping to 'else if buffs=none ' and skipping the first part entirely as it isnt finding the spellId present... Thats definitely a code issue on my part....

    I think doing it your way would make more sense though ....discount ALL food buffs if you already have a 'well fed' buff rather than discounting just the particular buff you currently have, though if it would be possible to disable the dropdown entirely if you had the 'well fed' buff, that would be a better way of going....
    Posted in: Need Help?
  • 0

    posted a message on gettind buffs by SpellId and using it to change formulae....
    Hi.... problems once again :( ....
    Have completed my addon Raid Defense Stats but want to add one more piece of functionality to the addon...

    Heres a pastebin of the lua as it stands:
    http://pastebin.com/0prqsJwk

    the issue I am running into is the UpdateBuffStats()
    from line 336 to line 349

    I want to check the player to see if he has any of the buffs you can select in the addon to see your raid buffed stats currently applied, and if so, to change the output of the UpdateBuffStats()

    As it stands, the lines in question are :
    	local food, strength, stat
    
    	local function UpdateBuffStats()
    	
    		BuffStrengthAdjust = strength.StrengthValue + food.StrengthValue
    		BuffParryAdjust =  food.ParryValue
    		BuffDodgeAdjust =  food.DodgeValue
    		BuffMasteryAdjust = food.MasteryValue
    		BuffMultiplierAdjust = stat.BuffValue
    
    	
    		PAPERDOLL_STATINFO["TOTALAVOIDANCE"].updateFunc(Frame1, "player")
    		PAPERDOLL_STATINFO["COMBATTABLE"].updateFunc(Frame2, "player")
    	end
    


    I need to check if the player has these buffs (it will need to be by spellId as the well fed buffs all return the name 'Well Fed' even though they give different stats .... (stupid way of blizzard doing this IMO)

    "Mark of the Wild" = 79061
    "Blessing of Kings" = 79063
    "Horn of Winter" = 57330
    "Battle Shout" = 6673
    "Well Fed" = 87554  --Dodge food Buff
    "Well Fed" = 87555   --Parry Food Buff
    "Well Fed" = 87549   --Mastery Food Buff
    "Well Fed" = 87545   --Strength Food Buff
    


    I know WHAT I need to do, but cant, for the life of me incorporate it into the addon.....
    Once getting the spellId of all buffs currently on the player (using spellId = UnitAura("player",i) ), the current values for BuffStrengthAdjust, BuffParryAdjust, BuffDodgeAdjust, BuffMasteryAdjust and BufMultiplierAdjust would need to be worked out in the following way:

    if  (spellId ~= 79061 and spellId ~= 79063) then BuffMultiplierAdjust = stat.BuffValue else BuffMultiplierAdjust = 1
    
    if  spellId ~= 87549 then BuffMasteryAdjust = food.MasteryValue else BuffMasteryAdjust = 0
    
    if  spellId ~= 87554 then BuffDodgeAdjust = food.DodgeValue else BuffDodgeAdjust = 0
    
    if spellId ~= 87555 then BuffParryAdjust = food.ParryValue else BuffParryAdjust = 0
    
    --this next formula is a bit more complex as there are 3 combinations :(  
    
    if  (spellId ~= 57330 and spellId ~= 6673 and spellId ~= 87545) then BuffStrengthAdjust = strength.StrengthValue + food.StrengthValue
    else if (spellId = 57330 or spellId = 6673) and spellId ~= 87545 then BuffStrengthAdjust = food.StrengthValue
    else if (spellId ~= 57330 and spellId ~= 6637) and spellId = 87545 then BuffStrengthAdjust = strength.StrengthValue
    
    
    


    I have no feckin idea how to get this lot into the lua to factor in the current buffs when working out the new stat values ( I actually DID get it working once, but the values didnt update if the buff disappeared (like Battle shout with its 2 minute cooldown), but much to my chagrin, this poxy village suffered a power cut at that time and I lost the file :( )

    I may be going about this in totally the wrong way, as it may be simpler to factor in the Current buffs when you are selecting the raid buffs from the dropdown menu (though that would be complicated when choosing from the list of food buffs )

    Andy
    Posted in: Need Help?
  • 0

    posted a message on Creating an options interface for an addon..... how?
    WHEEEEE.... the addon is now updatged and fully functional.... took me a while to figure out how to incorporate the changes, but everything is now functioning perfectly :D

    Updated to curse .... guess its gonna be another 29 hours or so before it updates on the site... seems to be REALLY slow doing that....

    Heres a couple of pics of the new options pane and tooltip:




    Thanks again guys for all your awesome assistance :D
    Posted in: Need Help?
  • 0

    posted a message on Creating an options interface for an addon..... how?
    Quote from Goranaws
    The code wasn't too far of.. I made a new paste bin with a few fixes for it . I simplified the menu creation process as you were repeating stuffs too much and made the menus work when you select a value on them.


    here's a link to the fix. http://pastebin.com/wpGWcU17



    I know I was repeating the stuff too much, but I gotta learn to crawl before I can walk ;)

    In answer to your question about firtune cookies, its the same as the seafood magnifique.
    For warriors and pallies (and a few other classes) the buff received depends on the spec you are in. If you are in prot spec for either pally or warrior, the buff is simply +90 dodge (alongside the stamina buff which has no bearing on these calculations.), so all other possibilities can be ignored

    Im just about to try this out, but I need to change a lot of stuff, as some of the previous calculations can be removed or need to be changed, but I do see an issue coming....
    The last box, for selecting 'Stat buffs' changes the value in a previous formula..
    Line 65 (and repeated on 2 other ocassions) of the lua contains this code ::
            local parryRatingFromStrength = floor((ceil(( raceStrength + 549 + StrengthAdjust ) * 1.05 ) - raceStrength ) * 0.27 )


    Selecting 'None' from the stats buff will change the '*1.05' to '*1' (or simply remove it from the equation)

    what I am going to need to do is to change this code to :
            
    
    local parryRatingFromStrength = floor((ceil(( raceStrength + BuffSttrengthAdjust + StrengthAdjust ) * BM ) - raceStrength ) * 0.27 )


    The output from the dropdown will have to set BM = 1 if 'none' is selected, and BM=1.5 if either kings or GOTW is selected. (BM is a new variable that needs to be set up)
    Posted in: Need Help?
  • 0

    posted a message on Creating an options interface for an addon..... how?
    Running into a problem now :(

    I have changed the layout of the tooltip for Buffed CTC and it works perfectly and looks good - a LOT better than the looooong line that it was....
    Also fixed the addon button on the character pane disappearing if you did a /reload

    the second change I wanted to do was to include Dropdown boxes for choosing your buffs instead of just calculating them due to the fact that there are quite a few food buffs available, and I would like to give people the choice.

    the code I currently have is here :
    http://pastebin.com/0prqsJwk

    the addon LOOKS good... exactly the way I want it, but Im damned if I can figure out how to incorporate the selections from the drop down boxes into the equations... :(

    on line 483-490, I tried to call the selections for the 'Strength Buffs' ( havent tried the food or stats buffs yet, as this one is easiest to factor in)

    the code is as follows:
    	local StrengthBuffChanges = UIDropDownMenu_GetSelectedID(StrengthBuffs)
    	function StrengthBuffs:UpdateEvents()
    		if StrengthBuffChanges  == "2" or StrengthBuffChanges  == "3" then
    			StrengthAdjust = StrengthAdjust + 549
    		elseif StrengthBuffChanges  == "1" then
    			StrengthAdjust = StrengthAdjust
    		end
    		end


    The code isnt breaking the addon :rolleyes: , but it isnt actually DOING anything :(
    Its probably waaaaay off base though
    What IM trying to get it to do, is to add 549 (Battleshout and Horn of winter both add 549 strength) to the StrengthAdjust calculations without putting the 549 into the editbox (as that would confuse people) and not adding anything to it if the option selected is 'none'

    any (More) help would be greatly appreciated...
    Posted in: Need Help?
  • 0

    posted a message on Creating an options interface for an addon..... how?
    Quote from Goranaws
    The frame looks awesome. And just add rds.Opts:Hide() at the start of the rds.Opts.Load() function to have the frame hidden by default.

    also, you can change the OnClick function for the mini button to

    	f:SetScript("OnClick", function(self)
    		PlaySound("igCharacterInfoTab")
    		ToggleFrame(rds.Opts)
    	end)
    

    Thanks for the compliment :D
    blegh .... didnt know about the toggleFrame call. took me a while to figure out how to strip your code out and make th window close on click.... I am TOTALLY winging this.... 2 weeks ago I had never opened an lua file and have no coding experience whatsoever..... spend a lot of time going through addons that make similar calls to see how they do it ....

    I figured it had something to do with rds.Opts:Hide() , but was simply putting it in the wrong place.
    I also have a LOT of duplicate code .... its actually triplicate, so I need to figure out where to place that so that I only need it once.
    Next stage is to check if the player has the raid buffs already, and if so, remove them from the equation so that the info in the stats frame can be accurate. At the minute, the 'Raid Buffed CTC' calculations simply assume that you have no buffs currently, so the calculations aare carried out even when you have the buffs ... in effect, giving false readings as soon as you obtain a buff which benefits your stats :(
    Fortunately I only need to check for 8 buffs:
    MoTW
    Kings
    BattleShout
    Horn of Winter
    well fed (though there are quite a few of these that affect your ratings :( )
    flasks
    Elixirs (Battle and guardian)

    man ... theres me thinking I only needed to check for 8.....
    is there a list somewhere of SpellIDs for buffs? ..... guess I hit google again....

    One route I am thinking of going down is to have check-boxes to choose what raid buffs you will use. Actually, now that I think of it, probably a dropdown list instead so that people cant tick 8 different foods .... would need to make it that if you chose a flask, then you couldnt select elixirs, and vice-versa...

    The annoying thing about this, is that I already have the addon doing what I needed for myself, now I just keep thinking of ways to improve it, even though, personally, I dont need these options ...
    Hell, why dont I just push all-in and have boxes for ALL the stats so that it doesnt just cover tanks.... agility, stamina, intellect, haste, crit, hit, expertise ..... a lot of classes have caps they want to aim for .....
    hmmm .... I sense too much work on this coming up :(
    Posted in: Need Help?
  • 0

    posted a message on Creating an options interface for an addon..... how?
    thanks for that info.
    I know the code needs SERIOUSLY cleaned up. Thats the next stage......
    Posted in: Need Help?
  • 0

    posted a message on Creating an options interface for an addon..... how?
    Very nice :D
    Used a lot of that code/layout and modified a few things :
    1. Added a button on the Character Pane to open/close the adjustment window.
    2. Changed the look of the adjustment window.
    3. Had to do a LOT of changes to the formulae to get the maths to work correctly.
    4. Changed it so the Unbuffed CTC also updated
    5. Fixed a bug where the formulae for paladins for block from mastery was incorrect.

    Uploaded the new file to pastebin:
    http://pastebin.com/0prqsJwk

    Now I just need to figure out how to make the Adjustment frame be closed by default when you open your Character Pane....

    Thanks again for your assistance :D
    Posted in: Need Help?
  • 0

    posted a message on Creating an options interface for an addon..... how?
    Quote from Goranaws
    Her's some code I've written up for you. You should look at how this code looks in game, then really look through the code. The options panel is linked to the CharacterFrame, so all you have to do to see it is open the CharacterFrame. Here's a link to the code ==>> http://pastebin.com/2WLjEvid



    Man, thats excellent. Cant do it today, but I will definitely have the time tomorrow to go through all the code.

    Had a quick glance through it and have a few questions:

    Actually, no..... gonna try to figure it out myself, THEN ask questions if I get stuck.
    Once again, ty very much for your assistance.

    Set up a pastebin for the lua as it is now before modifying it.
    The first 39 lines and the last 15 or so are from the original addon I found on curse. the rest is the bits I added to calculate raid buffed stats.
    Probably a lot of overkill or poor coding in there, but as this is my first addon, Im happy enough that it works ....

    http://pastebin.com/0prqsJwk
    Posted in: Need Help?
  • 0

    posted a message on Creating an options interface for an addon..... how?
    I have just written my first addon (based on another addon, that I heavily modified and added several formulae to). I know NOTHING about lua, but was able to look at the lua files for several addons that didsimilar things to figure out how to write my lua file.

    The addon can be found here:
    http://www.curse.com/addons/wow/raid-defense-stats

    as you can see from the screenshot, it uses your current stats and recalculates them to tetll you what your defense stats would be raid buffed.
    Simple enough :rolleyes:

    what I would LIKE to do it to utilise an options screen to modify these stats.

    e.g.

    you want to regem or reforge your items, but before going to the expense, you would like to see the effect this would have on your raid buffed stats.
    the layout would be something like:

    Strength Change:  X
    Dodge Change:  X
    Parry Change:  X
    Mastery Change:  X
    
    *Calculate*
    


    The 'X' signifies a text box where you would input a +ve or -ve number signifying the changges to your stats that a certain gem/reforge would give you.
    the *calculate* would be a button to add these values to the paperdoll calculations so that you see the effect these numbers have on your raid buffed stats.

    1 Is this possible? (Im guessing/hoping that it is...)
    2 if so, how the hell can I go about it? Is there a program that I can use to create the xml file required by the options panel or do I have to code it fro scratch? How can the numbers input into this panel be grabbed by the lua file to recalculate using these inputs?


    Thanks for any input.
    Posted in: Need Help?
  • To post a comment, please or register a new account.