Thread Tools Display Modes
08-11-22, 02:18 PM   #1
Benalish
A Flamescale Wyrmkin
 
Benalish's Avatar
Join Date: Dec 2012
Posts: 123
Concatenate parameters and string

Hello there. This code should report who cast the buff, which buff cast, and who received it

Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  3. f:SetScript("OnEvent", function(self, event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10,
  4.                                               arg11, arg12, arg13)
  5.     if (event == "COMBAT_LOG_EVENT_UNFILTERED") then
  6.         if (arg2 == "SPELL_AURA_APPLIED") then --do stuffs
  7.                 end
  8.     end
  9. end)

What exactly do I have to write in order to get a sentence in the form "arg4 cast arg10 on arg7"?
  Reply With Quote
08-11-22, 02:45 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,877
Depends but the simplest just see it in your chat frame would be:

Lua Code:
  1. if (arg2 == "SPELL_AURA_APPLIED") then --do stuffs
  2.         print(arg4, "cast", arg10, "on", arg7)
  3. end

You could use concatination:
Code:
print(arg4.."cast"..arg10.."on"..arg7)
or string format (%s is replaced with strings, see this for other replacment values:
Code:
local msg = "%s cast %s on %s"
print(string.format(msg, arg4, arg10, arg7))
or ...

The last two are useful if you are using something other than print() (like sending to the chat system)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 08-11-22 at 02:56 PM.
  Reply With Quote
08-11-22, 09:26 PM   #3
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
Also since BfA, CLEU doesn't send its payload to the event handler anymore. You need to use CombatLogGetCurrentEventInfo() to query the args now.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Concatenate parameters and string

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off