CurseForge and Overwolf are joining forces!
Awesome More Information
  • 0

    posted a message on Import table info to buttons
    How is your phpRaid_Data file loaded? Is it listed in your .toc or loaded by another addon? Make sure that it is infact getting loaded and that either it's being set as a global variable or you are able to get to it in some other way from your other files (ex. Addon.phpRaid_Data).


    You can try changing that function from OnClick to PreClick. That way it will fire before the OnClick event happens and hopefully the OnClick will then be handled by the button directly and invite the correct player. Otherwise, you can try something like

    self:Click()


    at the end of that OnClick function because InviteUnit doesn't appear to require a hardware event (meaning the click doesn't have to come from the user such as is the case with spell casts for example).
    Posted in: Lua Code Discussion
  • 0

    posted a message on Import table info to buttons
    Yes I forgot a } at the end of that first line.

    I'm not a big fan of XML as imo everything is much easier in lua but you wouldn't want to define the button in both. Pick one.

    The for loop is iterating through every class in your big data table and then through every entry under that class (one per player). If you specify a name in the CreateFrame() call that gives that button a specific global name (_G is the global table) that you can then access from anywhere (including macros / other addons).

    If you don't want your buttons to have global names you can just put them in a local table ("buttons") and then in the for loop you need to replace the _G with whatever your table name is. What's inside the [] after _G is just concatenating strings together to give you the name of the button and taking advantage of the fact that each player entry has a "class" property which matches up with what you want the buttons to be called.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Import table info to buttons
    So what I would do first is when you are initializing your buttons, either make those names the global names for the button:

    local button = CreateFrame("Button", "RDI_DeathKnight1"...


    or put the buttons in a table within your addon:

    local buttons = {}
    buttons.RDI_DeathKnight1 = CreateFrame("Button", nil...


    Then, you want the button to invite the player when clicked so a good way of doing this programmatically is to just use a .name property like this (replace <buttonName> appropriately of course):

    <buttonName>:SetScript("OnClick", function(self) InviteUnit(self.name) end)


    Then you setup all the .name properties from your phpRaid_Data table something like this:

    local classes = {"warriors", "paladins", "hunters", "rogues", "priests", "deathknights", "shamans", "mages", "warlocks", "druids", 
    
    for i=1, #(classes) do
    	local playersInClass = phpRaid_Data.raids[0][classes[i]]
    	for i, data in pairs(playersInClass) do
    		_G["RDI_"..data.class..(i+1)].name = data.name
    	end
    end



    That will iterate through every class and for each class set the .name property of the appropriate button. The reason for the i+1 is because your buttons start at 1 and your table starts at 0.

    Hope this helps let me know if you have any questions.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Getting at Other Addon's Saved Variables
    Quote from lilsparky
    if the other addon is error riddled, you could spoof it by creating an "empty" addon that simply loads the sv file only and doesn't contain any real code.


    Yea I thought about doing that but didn't want to make everybody download an additional addon just to transfer settings. Got a series of dialog windows working as egingell suggested...works well enough.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Getting at Other Addon's Saved Variables
    Quote from egingell
    Is there something wrong with having them both loaded at the same time or having addon B LoD and only load it if addon A hasn't imported the settings from addon B and disable it if it does and is loaded?

    Something like this:
    --snip

    ReloadUI() should be in (or be) the OnAccept function of each popup. Reloading the UI requires a hardware event.


    No that's exactly what I'll end up doing.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Getting at Other Addon's Saved Variables
    Quote from OrionShock
    one has to wonder what your doing when you start futzing around with other addon's sv's


    Quote from sapu94
    This is for transferring settings from an old addon to new one (both my addons).


    I anticipated that question :)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Getting at Other Addon's Saved Variables
    Quote from egingell
    No, addon saved variables data is only available when the addon is loaded and only after it's loaded.

    Edit: No use over complicating it.

    Edit 2: If addon B is LoD, you can use LoadAddOn("addon B") to force it to load.


    That's what I thought...I guess I could do some EnableAddOn(), reload, DisableAddOn() kind of thing....we'll see...
    Posted in: Lua Code Discussion
  • 0

    posted a message on Getting at Other Addon's Saved Variables
    Is there any way for addon A to access the saved variables of addon B without addon B being loaded? I haven't found a way to do it and I even tried specifying two saved variables files in the .toc without any luck. I would assume that wow prevents it on purpose but thought I'd ask anyways just in case. This is for transferring settings from an old addon to new one (both my addons).

    Thanks
    Posted in: Lua Code Discussion
  • 0

    posted a message on Event on Disconnect
    I'm not 100% sure about d/c'ing but at least when a player hits alt-f4 nothing gets saved from that session. Saved variables get saved only when the player logs out (reloading simulates a log out then back in). When you alt-f4 out of wow this never happens so any saved variables db your addon was changing doesn't get save and thus any data you collected was lost.

    I'll test if d/c'ing does the same thing when I get home but my guess would be that it does meaning it's impossible to save anything on-DC.
    Posted in: AddOn HELP!
  • 0

    posted a message on Confounded by an error
    You are calling "GetItemInfo(item)" but is item an itemLink, itemName, itemID, or itemString? If it is an itemLink I'd suggest just parsing the link string for the information you need rather than using GetItemInfo() because, as has already been said, GetItemInfo() will return nil if the item is not in the player's cache.

    More info about the limitations of GetItemInfo:
    http://www.wowpedia.org/Talk:API_GetItemInfo

    Regex (although possibly out dated) for getting info out of the itemLink and more info about itemLinks can be found here:
    http://www.wowpedia.org/ItemLink
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting Scroll Wheel
    Quote from Xinhuan
    Personally, you should not have even considered adding such code to your addon.


    Apparently not...maybe it would be best if this thread was just removed then as my original question was answered long ago.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting Scroll Wheel
    To be clear, my intentions with this whole question were first of all curiosity. I viewed (and still do) figuring out the difference between bots and humans as a puzzle and a programming challenge.

    If (and it's a big if because I have better things to be doing atm) this was ever implemented, the extent of the consequence for the botting user would be at most a one time pop-up saying "To ensure Blizzard does not take any further actions against auction addons, please refrain from using hardware or software "bots" with Auction Profit Master". That's what I meant by insurance.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting Scroll Wheel
    Quote from Morsker
    I'll give you a chance to reply here before I make an issue of this publicly, but if the addon does anything without the user's informed consent, that's malware. It's illegal, and it's a far more serious issue than someone botting in a video game. I certainly hope you weren't considering any such thing.


    Addon's can not run outside of the wow environment there is no way they could become malware. Also, did you read my reply right above yours? "Not something I'm actively coding towards but still something that is good to know." I asked a question to gain more knowledge about the subject. Nothing more. Nothing less.

    Frankly it's an insult to all addon developers to suggest they are doing malicious things. I hope that wasn't your intent. In reality addon developers are putting in hundreds of hours of their time working on something that gives them no personal benefit other than the satisfaction that they are improving the gaming experience of others and the personal challenge.

    If I offended you with anything I said in this thread I am sorry but I think we can all agree I was asking a valid and fair question (and got a good response even).
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting Scroll Wheel
    Quote from Phanx
    Ah, okay. In any case, though, I don't think it's really worthwhile to spend the time and effort putting extra code in your addon to try to determine whether the user is running a third-party software bot. I'm not sure it's even possible; the whole reason bots work is because WoW can't tell the difference between the user clicking the mouse button with their hand and Windows sending that along to WoW, and the bot software sending the same message to WoW without the user having actually clicked the button with their hand.


    There isn't a way to detect where the click is coming from but there is still a way of catching about 90% of people who bot (without any false-positives). Not necessarily something I'm actively coding towards but still something that is good to know how to do.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Detecting Scroll Wheel
    Quote from Phanx
    I'm not sure how using a mousewheel spin as a hardware event means someone is using a bot... I know tons of people who bind things to mousewheel-up and mousewheel-down, and more things with modifier keys, who don't use anything that could be remotely construed as a "bot".


    The reason I asked this question was to make sure somebody who's using their scroll wheel IS NOT considered as using a bot program so don't worry :)
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.