1. If I put my codes, here it decides to go into HTML form. So I'm going to reply to this post instead, with the error messages I receive. Hopefully easier to understand.

    First: When I open and log on WoW. Second: When I click the button.

    I'm new at LUA but I learn by creating usually :/ and I've had experience with CSS and HTML so I thought I'd skip to the second part. I changed the XML so it was originally from "Minimap" to under "PlayerFrame". However I can't move it, it won't change when I'm in combat and it won't let me right click for dps when I've killed something.

    My CombatTracker

  2. First: When I open and log on WoW.

    Firstly:

  3. Second: When I click the button #1.

    Secondly:

  4. My LUA Coding, From the book - please if you note any mistakes please say :) thankyou ^^

    local start_time = 0
    local end_time = 0
    local total_time = 0
    local total_damage = 0
    local average_dps = 0
    
    function CombatTracker_OnLoad(frame)
     frame:RegisterEvent("UNIT_COMBAT")
     frame:RegisterEvent("PLAYER_REGEN_ENABLED")
     frame:RegisterEvent("PLAYER_REGEN_DISABLED")
     frame:RegisterForClicks("RightButtonUp")
     frame:RegisterForDrag("LeftButton")
    end
    
    function CombatTracker_OnEvent(frame, event, ...)
     if event == "PLAYER_REGEN_ENABLED" then
      end_time = GetTime()
      total_time = end_time - start_time
      average_dps = total_damage / total_time
      CombatTracker_UpdateText()
     elseif event == "PLAYER_REGEN_DISABLED" then
      CombatTrackerFrameText:SetText("In Combat")
      total_damage = 0
      start_time = GetTime()
     elseif event == "UNIT_COMBAT" then
      if not InCombatLockdown() then
      else
       local unit,action,modifier,damage,damagetype = ...
       if unit == "player" and action ~= "HEAL" then
        total_damage = total_damage + damage
        end_time = GetTime()
        total_time = end_time - start_time
        average_dps = total_damage / total_time
        CombatTracker_UpdateText()
       end
      end
     end
    end
    
    function CombatTracker_UpdateText()
     local status = string.format("%ds / %d dmg/ %.2f dps", total_time, total_damage, average_dps)
     CombatTrackerFrameText:SetText(status)
    end 
    
    function CombatTracker_ReportDPS()
     local msgformat = "%d seconds spent in combat with %d incoming damage. Average incoming DPS was %.2f"
     local msgformat = string.format(msgformat, total_time, total_damage, average_dps)
     if GetNumPartyMembers() > 0 then
      SendChatMessage(msg, "PARTY")
     else
      ChatFrame1:AddMessage(msg)
     end
    end
    
  5. In your table of contents file, what do you list first, CombatTracker.xml or CombatTracker.lua?

  6. Also you can use http://pastey.net to paste your code, or use the 'code' button in the editor toolbar at the top of the editor window. Select all of the code and click the right-most button. Then you can paste any XML code you'd like, as long as it's in a code block.

  7.  <Ui xmlns="http://www.blizzard.com/wow/ui/" 
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
      <Button name="CombatTrackerFrame" parent="UIparent" enableMouse="true" movable="true" frameStrata="LOW">
       <Size x="175" y="40"/>
        <Anchors>
         <Anchor point="TOP" relativePoint="BOTTOM" relativeTo="PlayerFrame">
          <Offset x="50" y="-10"/>
         </Anchor>
        </Anchors>
        <Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
         <BackdropInsets>
          <AbsInset left="11" right="12" top="12" bottom="11"/>
         </BackdropInsets>
         <TileSize>
          <AbsValue val="30"/>
         </TileSize>
         <EdgeSize>
          <AbsValue val="32"/>
         </EdgeSize>
        </Backdrop>
        <Layers>
         <Layer level="OVERLAY">
          <FontString name="$parentText" inherits="GameFontNormalSmall" justifyH="CENTER" setALLPoints="true" text="CombatTracker"/>
         </Layer>
        </Layers>
        <Scripts>
         <OnLoad>
          CombatTracker_OnLoad(self)
         </OnLoad>
         <OnEvent>
          CombatTracker_onEvent(self, event, ...)
         </OnEvent>
         <OnClick>
          CombatTracker_ReportDPS()
         </OnClick>
         <OnDragStart>
          self:StartMoving()
         </OnDragStart>
         <OnDragStop>
          self:StopMovingOrSizing()
         </OnDragStop>
        </Scripts>
       </Button>
     </Ui>
    
  8. Please note that I said to paste the text, THEN select it and click the code button. It appears you clicked the code button and then pasted the text.. which is not correct. I've fixed it. You also didn't answer my question, which is listed first in your .TOC file?

  9. Also you can use http://pastey.net to paste your code, or use the 'code' button in the editor toolbar at the top of the editor window. Select all of the code and click the right-most button. Then you can paste any XML code you'd like, as long as it's in a code block.

    Apparently I can't actual put the block in an actual block I tried yesterday.. that's my xml, I tried pasteys but because of the websites it won't let me something about putting them in reverse and the number I've used. >.< which ever they're both annoying me.. so there.. erm I still get LUA messages even when I turned the xml and lua around. For some reason.. -.-

  10. I can't really help you if you're not willing to answer the questions. The Lua script needs to be listed first in the .TOC file, followed by the XML file. You can use http://pastebin.ca to paste the code without having to type anything in. I'm going to bed, so I won't be able to respond any more tonight.

    If you are getting the same errors (I doubt it) with the Lua file loading first, then we'll have to look even further, in that case, post each file (.toc, .lua, and .xml) using pastebin.ca, or something similar.

    Alternatively, download the version of the code from this website and see for yourself what differences there are.

  11. I can't really help you if you're not willing to answer the questions.

    I did answer it, I said I switched them around, meaning I referred back into the book, and then I changed them.. so now the lua is first. Unless the book is also wrong ^^ somehow. I managed to get my message I realise I put msgformat twice instead of msgformat then msg. In the Lua, the problem now is the text won't change and the dps and time isn't getting recorded.

     Message: [string "CombatTrackerFrame:OnEvent"]:1: attempt to call global 'CombatTracker_onEvent' (a nil value)
     Time: 07/01/10 23:46:31
     Count: 16
     Stack: [string "*:OnEvent"]:1: in function <[string "*:OnEvent"]:1>
    
     Locals: self = CombatTrackerFrame {
      0 = <userdata>
     }
     event = "UNIT_COMBAT"
     (*temporary) = nil
     (*temporary) = CombatTrackerFrame {
      0 = <userdata>
     }
     (*temporary) = "UNIT_COMBAT"
     (*temporary) = "player"
     (*temporary) = "WOUND"
     (*temporary) = ""
     (*temporary) = 3
     (*temporary) = 1
     (*temporary) = "attempt to call global 'CombatTracker_onEvent' (a nil value)"
    
  12.  Message: [string "CombatTrackerFrame:OnEvent"]:1: attempt to call global 'CombatTracker_onEvent' (a nil value)
     Time: 07/01/10 23:58:48
     Count: 6
     Stack: [string "*:OnEvent"]:1: in function <[string "*:OnEvent"]:1>
    
     Locals: self = CombatTrackerFrame {
      0 = <userdata>
     }
     event = "PLAYER_REGEN_ENABLED"
     (*temporary) = nil
     (*temporary) = CombatTrackerFrame {
      0 = <userdata>
     }
     (*temporary) = "PLAYER_REGEN_ENABLED"
     (*temporary) = "attempt to call global 'CombatTracker_onEvent' (a nil value)"
    

    The previous code changes to this. After combat. But the other one keeps popping up in combat and won't stop.

  13. Thankyou for your time, I was reading the message over and I decided to also check my XML where I found the problem, you do good work here and the problem is fixed and the add on is working :D.

    x Pantharess