casting bar: attempt to perform arithmetic
Code:
\castbar.lua:77: attempt to perform arithmetic on local "endTime" (a nil value) Lua Code:
line 77 is the UnitChannelInfo endTime. What's causing this? |
Try adding some debug prints to see what's going on:
Code:
if not endTime then |
w/ that script at the start of the function:
w/ that script in the UNIT_SPELLCAST_START event: & in the UNIT_SPELLCAST_CHANNEL_START: + the last one also spat out this error Code:
1x FrameXML\UnitFrame.lua:173: script ran too long |
wowwiki states "Received for party/raid members as well as the player" for UNIT_SPELLCAST_CHANNEL_START. Assuming this is still correct the return value of UNIT="target" seems to be strange.
Is this a castbar for party/raid units? Or for a target frame? Did you test that with a party member as a target? Maybe UNIT_SPELLCAST_CHANNEL_START triggers for target but just returns nothing if target isn't a party member? Can't test this. |
You need to put the print statement somewhere after the variables you're printing in it are assigned values. Otherwise, of course they're all going to be nil. :p
|
|
Quote:
I hadn't even realised party and raid units might be further muddying the waters, though I'd say the error is clearly based upon some cross-pollution of the player and target. It's an easily replicable error; just cast when the target is channeling. I will see what happens when i target a party member channeling a spell though. edit: same result when targeting a party member w/o any other variation. Also getting no print returns at all when I put them in the right place, so i guess they're passing correctly? |
UNIT_SPELLCAST_START and UNIT_SPELLCAST_CHANNEL_START aren't returning the values that are nil. Those are from UnitCastingInfo(). The code doesn't check if the event firing is for the player while it only runs for the player castbar. So it's asking UnitCastingInfo() to check the player when the target starts casting.
I would suggest replacing this line to be a little more robust: Code:
if (self.unit~="player") then return end Code:
if not UnitIsUnit(self.unit,"player") or not UnitIsUnit(unit,"player") then return; end Alternate: Code:
if self.unit~="player" or not UnitIsUnit(self.unit,unit) then return; end |
Thanks. Both versions give off the same error.
Code:
castbar.lua:48: Usage: UnitIsUnit("unit", "otherUnit") seems to have fixed the other issue though! |
What about checking to see if the casting unit is the castbars unit?
Lua Code:
|
Quote:
Code:
if not unit or not UnitIsUnit(self.unit,"player") or not UnitIsUnit(unit,"player") then return; end Code:
if not unit or self.unit~="player" or not UnitIsUnit(self.unit,unit) then return; end Quote:
With varying extents, this is what UnitIsUnit() is checking for. |
Yep, just came to the same realisation and fix too. Thanks for your help!
|
Quote:
|
whoops, not sure why that's not included there already.
|
Quote:
Code:
if unit ~= "player" or unit ~= self.unit then return end |
Quote:
|
All times are GMT -6. The time now is 09:46 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI