• 0

    posted a message on Help with frames
    Make them global variables.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Help with frames
    You are confusing me with your code...

    local function eventHandler(self, event, ...)
    print("Hello World! Hello " .. event)
    end


    I don't use LUA for creating frame's so my little knowledge is much less here.

    But why are you localizing the function?

    This was given to me for help also by Phanx:

    --
    -- Create the frame
    --

    local f = CreateFrame("Frame", "OutsideFrame", UIParent)
    f:SetMovable(true)
    f:EnableMouse(true)
    f:SetSize(200, 95)
    f:SetPoint("CENTER", -2, 57)

    --
    -- Set the frame backdrop
    --

    f:SetBackdrop({
    bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]],
    edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]],
    tile = true,
    tileSize = 32,
    edgeSize = 32,
    insets = { left = 11, right = 12, top = 12, bottom = 11 },
    })
    f:SetBackdropColor(0, 0.4, 0.8)
    f:SetBackdropBorderColor(0, 0, 0)

    --
    -- Set the frame's drag scripts
    --

    f:SetScript("OnDragStart", function(self)
    self:StartMoving()
    end)

    f:SetScript("OnDragStop", function(self)
    self:StopMovingOrSizing()
    end)


    So to add a function to this frame, I'm assuming you would just do:

    f:SetScript("OnEvent", function(self)
    self:functionName(args)
    end)

    And just do:

    function functionName(args)
    -- What you want it to do
    end


    I think...

    You might want to wait for a more educated answer before relying on my answer.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Help with frames
    Oh, didn't notice them lol.

    Seem's "UNIT_STATS" would be what he is looking for since agility effect's crit chance, and possibly call PLAYER_EQUIPMENT_CHANGED beforehand.

    But with "UNIT_STATS" if an item is equipped with crit chance as a stat, UNIT_STATS" won't recognize it, since it is for main stat's -- Stamina, Agility, etc..
    Posted in: Lua Code Discussion
  • 0

    posted a message on Help with frames
    Quote from crowem00
    could i use "PLAYER_AURAS_CHANGED" event
    http://www.wowwiki.com/Events/Buff


    11/8/2008 This was removed with 3.02. Use UNIT_AURA instead.


    After looking through some event's, that seem's like it might be the correct one.

    Test it, add it to your AddOn, make sure you have the coding correct, and cause the event to fire, if whatever you want to happen, occur's then it's the right event.
    Posted in: Lua Code Discussion
  • 0

    posted a message on NewFrame with minimap button
    Well, right now i am not home, so i don't have wow (didn't bring my laptop) :( but i will be working with LDB soon, but i first want to get all the actual function's of the AddOn to work correctly. I have gotten the announcing to work (send amount to party/guild) and there are some other thing's i want to do before i start changing cosmetic's.

    But, i suspect LDB will create a frame/table ? when clicking the Minimap button? But if not, i will be doing massive cosmetic changes to the frame with xml (or might try using lua for it) and instead of doing a button click + minimap button click to announce, i will be creating button's on the new frame to send (to make it easier to use). And also add current session amount with the total amount, with send option's for the current amount also.

    I made a lot of progress since i uploaded it to curse, on my laptop, but i might work on the current downloadable version and just implement the thing's i did to my current version on my laptop, and test them tomorrow.


    Thank you all for the information.
    Posted in: Lua Code Discussion
  • 0

    posted a message on How to send messages to chat?
    Quote from OrionShock
    other than you cannot send texture strings in chat messages, no


    Well now:

    elseif IsShiftKeyDown() then
    	/run local guildLoot_mainTotal = guildLoot_currentTotal; local yourGuild, _, _ = GetGuildInfo("player"); SendChatMessage( guildLoot_mainTotal  .. " put in " .. yourGuild .. "'s bank, from me looting.", PARTY )


    give's me this error:

    unexpected error near '/'


    On line 96 which is the '/run' code snippet posted above.
    Posted in: Lua Code Discussion
  • 0

    posted a message on How to send messages to chat?
    Quote from Farmbuyer
    What does it do when you try it?


    It give's this error:

    Invalid escape code in chat message


    I tried using the gold, silver, and copper variable's used for the guildLoot_currentTotal variable, but found they can only be used either, when the CHAT_MSG_MONEY event is fired, or inside the GetCoinTextureString function, so i am now at a dead end.
    Posted in: Lua Code Discussion
  • 0

    posted a message on How to send messages to chat?
    Does anyone see a problem with this?:

    /run local guildLoot_mainTotal = guildLoot_currentTotal; local yourGuild, _, _ = GetGuildInfo("player"); SendChatMessage( GetCoinTextureString( guildLoot_currentTotal ) .. " put in " .. yourGuild .. "'s bank, from me looting.", GUILD )
    Posted in: Lua Code Discussion
  • 0

    posted a message on How to send messages to chat?
    Quote from Ketho
    also try to check the the API docs on Wowpedia and/or wowprogramming beforehand


    Yea, sorry about that, i didn't look there before asking, i just tried everything i knew already.
    Posted in: Lua Code Discussion
  • 0

    posted a message on How to send messages to chat?
    How can an AddOn add something to the chat frame for other people to see, I.e:

    /party TEXT
    /guild TEXT
    /whisper person TEXT
    /yell TEXT

    I have tried everything i can think of and I've gone insane.
    Posted in: Lua Code Discussion
  • 0

    posted a message on .lua working with numbers
    Well, it now save's the variable, thanks to this:

    local defaults = {
           			guildLoot_currentTotal = 0
    }
    		guildLoot_currentTotal = guildLoot_currentTotal or 0
    
           		guildLoot_currentTotal.variable = guildLoot_currentTotal.variable + 1


    But now, if you are running BugSack + BugGrabber, and possibly using the default blizz lua error display, you will receive some "error's" but they don't affect the AddOn at all. It will still keep track of amount of money looted, and save it perfectly fine.
    Posted in: Lua Code Discussion
  • 0

    posted a message on .lua working with numbers
    Removing the PLAYER_LOGOUT event didn't help.

    It still renew's back to 0 in the event of logging out and back in.
    Posted in: Lua Code Discussion
  • 0

    posted a message on .lua working with numbers
    Ok, but why doesn't this event fire?

    if event == "VARIABLES_LOADED" then
    	if arg1 == "GuildLoot" then
    		print("GuildLoot has been loaded.")
    		currentTotal = currentTotal or 0
    		print( currentTotal )
    	end
    end


    Nothing print's. It should at least print that the AddOn has been loaded, correct?
    Posted in: Lua Code Discussion
  • 0

    posted a message on .lua working with numbers
    So i used a print to check my currentTotal, print( currentTotal ) and it just print's "true".

    print( currentTotal:toNumber() ) give's the "attempt to index global 'currentTotal' (a boolean value)" error.

    Also, i changed it back to:

    local currentTotal = (currentTotal or 0) + (gold*1000) + (silver*100) + copper


    And got the:


    1x GuildLoot-0.1\GuildLoot.lua:36: attempt to perform arithmetic on a boolean value
    <string>:"*:OnEvent":1: in function <[string "*:OnEvent"]:1>

    Locals:
    self = guildLoot {
    0 = <userdata>
    }
    event = "CHAT_MSG_MONEY"

    ---
    Posted in: Lua Code Discussion
  • 0

    posted a message on .lua working with numbers
    Now a new error, but i think it mean's the variable is saving.

    1x GuildLoot-0.1\GuildLoot.lua:36: attempt to perform arithmetic on a boolean value
    <string>:"*:OnEvent":1: in function <[string "*:OnEvent"]:1>

    Locals:
    self = guildLoot {
    0 = <userdata>
    }
    event = "CHAT_MSG_MONEY"

    ---


    This is line 36:

    currentTotal = (currentTotal or 0) + getNew


    This is getNew:

    local getNew =  (gold*1000) + (silver*100) + copper


    currentTotal is the SavedVariablesPerCharacter.
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.