WoW:API LoggingCombat: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
(Rewrote the page so it isn't a stub.)
m (Move page script moved page API LoggingCombat to API LoggingCombat without leaving a redirect)
 
(2 intermediate revisions by 2 users not shown)
Line 16: Line 16:
== Example ==
== Example ==
  if (LoggingCombat()) then
  if (LoggingCombat()) then
   DEFAULT_CHAT_FRAME:AddMessage("Combat is already being logged";
   DEFAULT_CHAT_FRAME:AddMessage("Combat is already being logged");
  else
  else
   DEFAULT_CHAT_FRAME:AddMessage("Combat is not being logged - starting it!");   
   DEFAULT_CHAT_FRAME:AddMessage("Combat is not being logged - starting it!");   
Line 22: Line 22:
  end
  end


=== Example #2 ===
Create a new macro and paste the following (one-line)<br>
/script a=LoggingCombat(LoggingCombat()==nil); UIErrorsFrame:AddMessage("CombatLogging is now "..tostring(a and "ON" or "OFF"),1,0,0);
Drag the macro-button to an action bar or key bind it <br>and you have a one-click/keypress toggle.


== Details ==
== Details ==
: If no parameter is passed in, LoggingCombat turns logging on.
: If no parameter is passed in, LoggingCombat turns logging on.

Latest revision as of 04:46, 15 August 2023

WoW API < LoggingCombat


Toggles logging for the combat log and returns the current state.

isLogging = LoggingCombat([newState])


Parameters

Arguments

newState
Boolean - toggles combat logging

Returns

isLogging
Boolean - current state of logging


Example

if (LoggingCombat()) then
  DEFAULT_CHAT_FRAME:AddMessage("Combat is already being logged");
else
  DEFAULT_CHAT_FRAME:AddMessage("Combat is not being logged - starting it!");  
  LoggingCombat(1);
end

Example #2

Create a new macro and paste the following (one-line)

/script a=LoggingCombat(LoggingCombat()==nil); UIErrorsFrame:AddMessage("CombatLogging is now "..tostring(a and "ON" or "OFF"),1,0,0);

Drag the macro-button to an action bar or key bind it
and you have a one-click/keypress toggle.

Details

If no parameter is passed in, LoggingCombat turns logging on.