Thread Tools Display Modes
05-06-11, 09:38 AM   #1
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Exclamation channel help.

Hey there all. i wanted to shorten my code from

Code:
	if (iraid == true) then
		SendChatMessage('Interrupted ' .. GetSpellLink(arg13), "RAID")
	elseif (iparty == true) then
		SendChatMessage('Interrupted ' .. GetSpellLink(arg13), "PARTY")
	elseif (isay == true) then
		SendChatMessage('Interrupted ' .. GetSpellLink(arg13), "SAY")
	end
to just

Code:
	SendChatMessage('Interrupted ' .. GetSpellLink(arg13), channel)
i see a few people do

Code:
local channel = 'PARTY'
but i like it so do it in party and raid. so i tried

Code:
local channel = 'PARTY'
local channel = 'RAID'
and also

Code:
local channel = 'PARTY','RAID'
but no luck. any help would be great
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.

Last edited by weasoug : 05-06-11 at 09:59 AM.
  Reply With Quote
05-06-11, 10:01 AM   #2
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Code:
local channel = GetNumRaidMembers()>0 and "RAID" or GetNumPartyMembers()>0 and "PARTY" or "SAY"
SendChatMessage("Interrupted "..GetSpellLink(arg13), channel)
Or do you mean you want to be able to announce to all 3 channels at the same time?
  Reply With Quote
05-06-11, 10:09 AM   #3
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Thumbs up

Originally Posted by Ketho View Post
Code:
local channel = GetNumRaidMembers()>0 and "RAID" or GetNumPartyMembers()>0 and "PARTY" or "SAY"
SendChatMessage("Interrupted "..GetSpellLink(arg13), channel)
Or do you mean you want to be able to announce to all 3 channels at the same time?
yes i would.

with the getraid and getparty set to 0 will this only print if in a raid or a party. but will post to say no matter what.

or can i do
local channel = "RAID" or "PARTY" or "SAY"

also i would like it to say to battleground
GetNumRaidMembers()>0 and "BATTLEGROUND"

thanks again for yourr time
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.

Last edited by weasoug : 05-06-11 at 10:13 AM.
  Reply With Quote
05-06-11, 10:50 AM   #4
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
If your intent is to send the message to all three channels simultaneously, you'd need to do this:

Code:
local MSG_FORMAT = "Interrupted %s"
local CHANNELS = {
        "RAID",
        "PARTY",
        "SAY",
}

for index = 1, #CHANNELS do
	SendChatMessage(MSG_FORMAT:format(GetSpellLink(arg13)), CHANNELS[index])
end
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
05-06-11, 11:02 AM   #5
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
i want it to post to the party if in one. or to raid if in one. say is in there just case people want to use it. and can -- it out.
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.
  Reply With Quote
05-06-11, 11:05 AM   #6
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Then Ketho's method is what you want.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
05-06-11, 11:11 AM   #7
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Thumbs up

Originally Posted by Torhal View Post
Then Ketho's method is what you want.
OK thanks for your time.

so your code would post to say party and raid. no matter what. surely it could only print to the raid or party. and say all the time.

as i dont see how it could print to the raid channel if your in a party.

i guess a raid is made up from lots of party's. but i didn't think the party channel could be used.

but yes. i want to to print to raid or party depending if in one.
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.

Last edited by weasoug : 05-06-11 at 11:15 AM.
  Reply With Quote
05-06-11, 11:21 AM   #8
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Code:
local MSG_FORMAT = "Interrupted %s."

if GetNumRaidMembers() > 0 then
	SendChatMessage(MSG_FORMAT:format(GetSpellLink(arg13)), "RAID")
elseif GetNumPartyMembers() > 0 then
	SendChatMessage(MSG_FORMAT:format(GetSpellLink(arg13)), "PARTY")
end
SendChatMessage(MSG_FORMAT:format(GetSpellLink(arg13)), "SAY")
Code logic is as follows: If you have at least one raid member send to the raid channel, else if you have at least one party member send to party. Always send to say, regardless of the other two.

That is as simple as you are going to get.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
05-22-11, 05:23 AM   #9
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Exclamation

it seems to work fine. i removed the say bit. as i don;t want to to post. but it seems to still post in say when on your own. what did i do wrong. thanks for your time

Code:
eventHandlers['COMBAT_LOG_EVENT_UNFILTERED'] = function(...)
	if select(2,...) ~= 'SPELL_INTERRUPT' then return end
	if select(5,...) ~= UnitName('player') then return end

	local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13 = ...
        local channel = GetNumRaidMembers()>0 and "RAID" or GetNumPartyMembers()>0 and "PARTY"
        SendChatMessage("Interrupted "..GetSpellLink(arg13), channel)
    end
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.
  Reply With Quote
05-22-11, 11:36 AM   #10
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
-- http://www.wowpedia.org/API_SendChatMessage
If chatType is nil or omitted then "SAY" will be used.
Code:
if channel then
	SendChatMessage("Interrupted "..GetSpellLink(arg13), channel)
end
  Reply With Quote
05-22-11, 02:05 PM   #11
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Since you're directly grabbing the second and fifth args anyway you should do that first and avoid calling select twice - the two if checks can also be made into one:

Code:
eventHandlers['COMBAT_LOG_EVENT_UNFILTERED'] = function(...)
	local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13 = ...

	if arg2 ~= "SPELL_INTERRUPT" or arg5 ~= UnitName("player") then
		return
	end

        local channel = GetNumRaidMembers() > 0 and "RAID" or GetNumPartyMembers() > 0 and "PARTY"

	if channel then
		SendChatMessage("Interrupted " .. GetSpellLink(arg13), channel)
	end
end
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
07-05-11, 05:48 AM   #12
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Exclamation

Originally Posted by Torhal View Post
Since you're directly grabbing the second and fifth args anyway you should do that first and avoid calling select twice - the two if checks can also be made into one:

Code:
eventHandlers['COMBAT_LOG_EVENT_UNFILTERED'] = function(...)
	local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13 = ...

	if arg2 ~= "SPELL_INTERRUPT" or arg5 ~= UnitName("player") then
		return
	end

        local channel = GetNumRaidMembers() > 0 and "RAID" or GetNumPartyMembers() > 0 and "PARTY"

	if channel then
		SendChatMessage("Interrupted " .. GetSpellLink(arg13), channel)
	end
end
I see this don;t work as it should for 4.2 it will call out when i used to interrupt. any help would be good. to fix this. thanks again.
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.
  Reply With Quote
07-05-11, 06:25 AM   #13
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
What is confusing me, is that your code looks like it was already "supporting" the Patch 4.2 CLEU parameters
.. I'm not sure what exactly got passed into the vararg (...)

Code:
local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13 = ...
local timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, spellID, spellName = ...

Last edited by Ketho : 07-05-11 at 06:30 AM.
  Reply With Quote
07-05-11, 06:41 AM   #14
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Post

Originally Posted by Ketho View Post
What is confusing me, is that your code looks like it was already "supporting" the Patch 4.2 CLEU parameters
.. I'm not sure what exactly got passed into the vararg (...)

Code:
local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13 = ...
local timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, spellID, spellName = ...
this is it. but every time. I use my interrupt spell it uses mine not the spell i interrupt.. its very strange.
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.
  Reply With Quote
07-05-11, 06:51 AM   #15
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Code:
eventHandlers['COMBAT_LOG_EVENT_UNFILTERED'] = function(...)
	local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16 = ...

	if arg2 ~= "SPELL_INTERRUPT" or arg5 ~= UnitName("player") then
		return
	end

        local channel = GetNumRaidMembers() > 0 and "RAID" or GetNumPartyMembers() > 0 and "PARTY"

	if channel then
		SendChatMessage(GetSpellLink(arg12).." Interrupted "..GetSpellLink(arg15), channel)
	end
end
You'd want to read the CLEU doc, for the ExtraSpell Suffixes

(For a spell you don't have in your spellbook, the spellName(arg16) won't work for GetSpellLink, you'd have to use the Spell ID(arg15))
  Reply With Quote
07-05-11, 06:57 AM   #16
weasoug
A Flamescale Wyrmkin
 
weasoug's Avatar
AddOn Author - Click to view addons
Join Date: May 2010
Posts: 127
Thumbs up

Originally Posted by Ketho View Post
Code:
eventHandlers['COMBAT_LOG_EVENT_UNFILTERED'] = function(...)
	local arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16 = ...

	if arg2 ~= "SPELL_INTERRUPT" or arg5 ~= UnitName("player") then
		return
	end

        local channel = GetNumRaidMembers() > 0 and "RAID" or GetNumPartyMembers() > 0 and "PARTY"

	if channel then
		SendChatMessage(GetSpellLink(arg12).." Interrupted "..GetSpellLink(arg15), channel)
	end
end
You'd want to read the CLEU doc, for the ExtraSpell Suffixes

(For a spell you don't have in your spellbook, the spellName(arg16) won't work for GetSpellLink, you'd have to use the Spell ID(arg15))
nice one. thanks mate.x
__________________
wMmap :: Is a lightweight Minimap, with a sleek look & custom imagery.
wIn1 :: In one addon. and is very lightweight & simple to use.
wChat :: Is a lightweight chat mod.
wBroker :: Is A simple broker add-on.
wPetXPBar :: Is A simple lightweight Pet XP Bar.
wBuffs :: Is A simple Buffs Bar.
  Reply With Quote
07-05-11, 11:21 AM   #17
Verttex
Super Monkey
 
Verttex's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 297
Just saying that auto-posting and macroing more than 1 channel at a time, can cause a ban.

As in:

[General] Hi
[Trade] Hi
[Local Defense] Hi
[Guild Recruitment] Hi
[Party] Sup
[Raid] HEYA
[Say] what up my homies
[Officer] lol
[Battleground] RAWR
[GM] BANHAMMAR.
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » channel help.


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