You are not logged in.

Applications: [GameMaster: OPEN] | [Volunteer Testers: OPEN]


This forum will be permanently shut down on Friday 13.07.2018
Please copy or save all important information from old forum before they will be deactivated
We have moved to new board. https://forum.runesofmagic.gameforge.com/Come join us.

1

Thursday, March 29th 2012, 8:01pm

Help with vcThreatMeter not showing up in Combat

I've installed vcThreatMeter, but when I go into combat, it doesn't appear that the window automatically shows up:



But when I create a macro using:

/run vcThreatMeter:Show()

I can get it to show up and can move the window around:



I'm using several addons, but the UI is using XBar III, has anyone else run into this where vcThreatMeter won't show up automatically when you get into combat?

Posts: 262

Location: The Ocean?

  • Send private message

2

Thursday, March 29th 2012, 8:30pm

I have not experienced this on my private toon.

However, I would suggest you try to see if it an add-on conflict. (Xbar most likely)

-TunaShake

Peryl

Intermediate

Posts: 313

Location: Elsewhere

  • Send private message

3

Thursday, March 29th 2012, 11:06pm

In your first pic, where the threat meter isn't showing up, I notice that the green glowing dot next to the minimap is on. This indicates an add-on error message of some sorts. It may, or may not be the cause of the problem, but click on it to view the error message next time this happens. (more than one error could show up here, so make sure to check all of them).

As TunaShake said, it is likely some kind of conflict with another add-on that is causing this. Even more likely since vcThreatMeter is indeed active since you can make it show up manually.
2013... The year from hell....

4

Friday, March 30th 2012, 1:05am

open the lua and take out the hide function...its only in 2 places if i remember right

5

Friday, March 30th 2012, 6:10pm

Thanks guys! I tried to tinker around with the LUA file, but changing the hide to show or commenting out the hide didn't seem to change the behavior.

@peryl, the error bubble seems to be related to the AdvQuestBook not being able to index the global advquestbook_config.

I decided to give up on this addon and go with pbinfo that seems to show the threat meter properly in my current addon configuration. Thanks for the feedback, appreciate it!

7

Sunday, April 22nd 2012, 1:30pm

This is a very easy fix. If you right click one of the icons...either the system one or the other it gives a "VCthreatmeter in party" option. I'm not signed on at the moment... But I had this same problem and after saying "F-it" for a month I stumbled on it and was like "DUUUUUH". But I do know it's in one of "Xbar's" system icons. either the one with the option to get to portable AH and stuff or the other 1. lol I'm great at explaining things aren't I! >< Good luck. And that should fix ur problem....I hope. ;P

8

Sunday, April 22nd 2012, 4:18pm

here's my lua for vcThreatmeter so it never hides...in case you have lag issues with xbar like i did. (seems random..some do some dont.) you may have to enter combat once so it shows, then grab it and move to where ever you want it so the anchor saves.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
local classColor = {
        WARRIOR = {0.9, 0, 0},        -- warrior
        RANGER = {0.45, 0.64, 0.01},  -- scout
        THIEF = {0, 0.64, 0.57},      -- rogue
        MAGE = {1, 0.5, 0},           -- mage
        AUGUR = {0.16, 0.55, 0.93},   -- priest
        KNIGHT = {1, 0.9, 0},         -- knight
        DRUID = {0, 0.49, 0},         -- druid
        WARDEN = {0.65, 0.42, 0.13},  -- warden
        GM = {0.93, 0.39, 0.70},      -- GM's are pink ;)
        UNKNOWN = {0.5, 0.5, 0.5},        -- uknown is gray
}

local vcThreatMeter_DefaultSettings = {
        ['point'] = "CENTER",
        ['relativePoint'] = "CENTER",
        ['relativeTo'] = "UIParent",
        ['offsetX'] = -400,
        ['offsetY'] = 75,
}

local playerClass = {}        -- playerClass["Duppy] = "THEIF"


function vcThreatMeter_OnLoad(this)
    DEFAULT_CHAT_FRAME:AddMessage("vcThreatMeter loaded")

    this:RegisterEvent("SAVE_VARIABLES")
    this:RegisterEvent("VARIABLES_LOADED")
    this:RegisterEvent("TARGET_HATE_LIST_UPDATED")
    this:RegisterEvent("UNIT_TARGET_CHANGED")
    this:RegisterEvent("PARTY_MEMBER_CHANGED")
    this:RegisterEvent("COMBATMETER_DAMAGE")
    this:RegisterEvent("COMBATMETER_HEAL")
    this:RegisterEvent("LOADING_END")
    this:RegisterEvent("EXCHANGECLASS_SUCCESS")

    SaveVariables("vcThreatMeter_Settings")  -- settings are saved to this table
end


-- local formattedNumber = (tostring(myNumber):reverse():gsub("%d%d%d", "%1,"):reverse():gsub("^,", ""))
local function CommaValue(amount)
    local formatted, k = math.floor(amount+0.5)
    while true do
        formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')
        if ( k == 0 ) then
            break
        end
    end
    return formatted
end


local function ClearThreatMeter()
    for j = 1, 6 do
        getglobal("vcThreatMeter_Bar" .. j):SetValue(0)
        getglobal("vcThreatMeter_Bar" .. j .. "TextLeft"):SetText("")
        getglobal("vcThreatMeter_Bar" .. j .. "TextRight"):SetText("")
    end
end


local function UpdateThreatMeter()
    --echo("Update ThreatMeter " .. GetTime())

    local hateList = {}
    local i, totalHate, greatestHate = 0, 0, 0
    local unitName, unitHate = "???", 0

    repeat
        i = i + 1
        unitName, unitHate, unitDamage = GetTargetHateList(i)

        if (not unitName) then
            ClearThreatMeter()
            break;
        else
            hateList[i] = { unitName = unitName, unitHate = unitHate, unitDamage = unitDamage }

            totalHate = totalHate + unitHate

            if (greatestHate < unitHate) then
                greatestHate = unitHate
            end
        end
    until (unitName == nil)

    if (#hateList > 0) then

        if ( not vcThreatMeter:IsVisible() ) then
            vcThreatMeter:Show()
        end

        -- sort threat list in descending order
        table.sort(hateList, function(a, b) return a.unitHate > b.unitHate end)

        -- display info
        for j = 1, 6 do
            local threatBar = getglobal("vcThreatMeter_Bar" .. j)
            local threatName = getglobal("vcThreatMeter_Bar" .. j .. "TextLeft")
            local threatPercentage = getglobal("vcThreatMeter_Bar" .. j .. "TextRight")

            if (type(hateList[j]) == "table" and totalHate > 0) then
                local hateValue = hateList[j].unitHate / totalHate

                -- adjust bar (0-100)
                threatBar:SetBarColor(unpack(classColor[playerClass[hateList[j].unitName]] or {0.5, 0.5, 0.5}))
                threatBar:SetValue(math.ceil(hateValue * 100))

                -- show player name
                --threatName:SetColor(unpack(classColor[playerClass[hateList[j].unitName]]))  -- color names
                threatName:SetText(hateList[j].unitName)

                -- show threat number and percentage
                threatPercentage:SetText(string.format("%s (%2d%%)", CommaValue(hateList[j].unitHate), math.ceil(hateValue * 100)))
            else
                threatName:SetText("")
                threatName:SetColor(1,1,1)
                threatPercentage:SetText("")
                threatBar:SetValue(0)
            end

        end

    end

end


local function UpdatePartyMemberInfo()
    if GetNumRaidMembers() > 0 or GetNumPartyMembers() > 0 then
        --echo("Updating party info")
        for i = 1, 36 do
            local name = UnitName("raid" .. i)
            if name then
                playerClass[name] = UnitClassToken("raid" .. i)
            end
        end
    else
        --echo("Updating player info")
        local name = UnitName("player")
        if name then
            local class = UnitClassToken("player") or "UNKNOWN" -- strangely, name and class are sometimes nil after teleporting
            playerClass[name] = class
        end
    end
end



function vcThreatMeter_OnEvent(this, event)
    if ( event == "TARGET_HATE_LIST_UPDATED" ) then
        UpdateThreatMeter()

    elseif ( event == "UNIT_TARGET_CHANGED" and arg1 == "player") then
        if ( UnitExists("target") and not UnitIsDeadOrGhost("target") and UnitCanAttack("player", "target") ) then
            TargetHateListRequest()
        
        end

    elseif ( event == "COMBATMETER_DAMAGE" or event == "COMBATMETER_HEAL" ) then
            TargetHateListRequest()

    elseif ( event == "PARTY_MEMBER_CHANGED" or event == "EXCHANGECLASS_SUCCESS" ) then
        UpdatePartyMemberInfo()

    elseif ( event == "LOADING_END" ) then
        local name = UnitName("player")
        if name then
            playerClass[name] = UnitClassToken("player") or "UNKNOWN"
        end

    elseif ( event == "SAVE_VARIABLES" ) then
        local point, relativePoint, relativeTo, x, y = this:GetAnchor()

        assert(vcThreatMeter_Settings, "[vcThreatMeter:SAVE_VARIABLES] vcThreatMeter_Settings variable is nil!" )
        vcThreatMeter_Settings.point = point
        vcThreatMeter_Settings.relativePoint = relativePoint
        vcThreatMeter_Settings.relativeTo = relativeTo:GetName()
        vcThreatMeter_Settings.offsetX = x
        vcThreatMeter_Settings.offsetY = y

        DEFAULT_CHAT_FRAME:AddMessage("[vcThreatMeter] Saving settings.")

    elseif ( event == "VARIABLES_LOADED" ) then
        if not vcThreatMeter_Settings then
            vcThreatMeter_Settings = {}
            vcThreatMeter_Settings.point = vcThreatMeter_DefaultSettings.point
            vcThreatMeter_Settings.relativePoint =    vcThreatMeter_DefaultSettings.relativePoint
            vcThreatMeter_Settings.relativeTo =    vcThreatMeter_DefaultSettings.relativeTo
            vcThreatMeter_Settings.offsetX =    vcThreatMeter_DefaultSettings.offsetX
            vcThreatMeter_Settings.offsetY =    vcThreatMeter_DefaultSettings.offsetY

            DEFAULT_CHAT_FRAME:AddMessage("[vcThreatMeter] Loaded default settings.")
        end

        assert(vcThreatMeter_Settings, "[vcThreatMeter:VARIABLES_LOADED] - vcThreatMeter_Settings variable is nil!" )
        this:ClearAllAnchors()
        this:SetAnchor(vcThreatMeter_Settings.point, vcThreatMeter_Settings.relativePoint, vcThreatMeter_Settings.relativeTo, vcThreatMeter_Settings.offsetX, vcThreatMeter_Settings.offsetY)
    end

end




--[[
Test Macros
/run for i=1,6 do getglobal('vcThreatMeter_Bar'..i):SetValue(100) end
/run vcThreatMeter_Bar1TextLeft:SetText('Foooooobaaar'); vcThreatMeter_Bar1TextRight:SetText('10,000,000 (99%)')
/run vcThreatMeter:ClearAllAnchors(); vcThreatMeter:SetAnchor('BOTTOMRIGHT', 'TOPRIGHT', 'ChatFrame1', 0, -5)
]]

9

Sunday, April 22nd 2012, 9:30pm

Or u could do that. hehe I like that idea better cause it anchors to the spot and stays there. Nice work Pazuzzu. +1 from me! :)