Hey,
thanks for the reply!
Could I make the
comma_value as a local function and
i as a local as well? And thanks for the suggestion about zo_strformat - I'll definitely take a look at it.
I'm not at home at the moment so I can not make these changes. But I tried to disable some of the functions and noticed that if I disable both
EVENT_COMBAT_EVENT and
EVENT_LOOT_RECEIVED functions then everything works without any trouble. And now that I checked the code those functions doesn't use
i at all and some other functions use
comma_value as well.
But, I will definitely give it a try. Thanks!
EDIT:
Okay, I changed everything you suggested and it works now as a dream. Except now it gives me an error related to
EVENT_COMBAT_EVENT.
Code:
-- "EVENT_COMBAT_EVENT"
local function CombatEvent ( eventCode, result, isError, abilityName, abilityGraphic, abilityActionSlotType, sourceName, sourceType, targetName, targetType, hitValue, powerType, damageType, log, sourceUnitId, targetUnitId, abilityId )
local source_name = sourceName
if string.find ( sourceName, "%^" ) then
source_name = string.sub ( sourceName, 0, ( string.find ( sourceName, "%^" ) - 1.0 ))
end
local target_name = targetName
if string.find ( targetName, "%^" ) then
target_name = string.sub ( targetName, 0, ( string.find ( targetName, "%^" ) - 1.0 ))
end
if source_name == GetUnitName ( "player" ) then
if sourceName == targetName then
target_name = "yourself"
end
local x = string.sub ( GetTimeString ( ), 0.0, 5.0 )
local y = ""
if result == ACTION_RESULT_CRITICAL_DAMAGE then
y = zo_strformat ( "|cCCCCCC[<<1>>] You dealt |cFA3232<<2>> |cFA9696critical |cCCCCCCdamage to <<3>> with <<4>>",
x, comma_value ( hitValue ), target_name, abilityName )
elseif result == ACTION_RESULT_CRITICAL_HEAL then
y = zo_strformat ( "|cCCCCCC[<<1>>] You |c96FA96critically |cCCCCCChealed <<2>> for |c32FA32<<3>> |cCCCCCCwith <<4>>",
x, target_name, comma_value ( hitValue ), abilityName )
elseif result == ACTION_RESULT_DAMAGE then
y = zo_strformat ( "|cCCCCCC[<<1>>] You dealt |cFA3232<<2>> |cCCCCCCdamage to <<3>> with <<4>>",
x, comma_value ( hitValue ), target_name, abilityName )
elseif result == ACTION_RESULT_DOT_TICK then
y = zo_strformat ( "|cCCCCCC[<<1>>] Your <<2>> ticked |cFA3232<<3>> |cCCCCCCto <<4>>",
x, abilityName, comma_value ( hitValue ), target_name )
elseif result == ACTION_RESULT_DOT_TICK_CRITICAL then
y = zo_strformat ( "|cCCCCCC[<<1>>] Your <<2>> |cFA9696critically |cCCCCCCticked |cFA3232<<3>> |cCCCCCCto <<4>>",
x, abilityName, comma_value ( hitValue ), target_name )
elseif result == ACTION_RESULT_HEAL then
y = zo_strformat ( "|cCCCCCC[<<1>>] You healed <<2>> for |c32FA32<<3>> |cCCCCCCwith <<4>>",
x, target_name, comma_value ( hitValue ), abilityName )
elseif result == ACTION_RESULT_HOT_TICK then
y = zo_strformat ( "|cCCCCCC[<<1>>] Your <<2>> ticked |c32FA32<<3>> |cCCCCCCto <<4>>",
x, abilityName, comma_value ( hitValue ), target_name )
elseif result == ACTION_RESULT_HOT_TICK_CRITICAL then
y = zo_strformat ( "|cCCCCCC[<<1>>] Your <<2>>|c96FA96critically |cCCCCCCticked |c32FA32<<3>>|cCCCCCC to <<4>>",
x, abilityName, comma_value ( hitValue ), target_name )
else
--
end
CHAT_SYSTEM.containers [ 1.0 ].windows [ Basic.combat_tab ].buffer:AddMessage ( y )
end
end
The error is every single one of these
ACTION_RESULT_ if functions. I checked and they are correct related to the
local function CombatEvent ( .. ) parameters.
Any ideas what's wrong?
EDIT:
This is the new function for
comma_value function because it's the only thing that isn't set in the
CombatEvent function.
Code:
local comma_value = function ( amount )
local amount_ = amount
while true do
local amount_, i = string.gsub ( amount_, "^(-?%d+)(%d%d%d)", '%1,%2' )
if i == 0.0 then
break
end
end
return amount_
end