Thread Tools Display Modes
03-12-12, 12:36 PM   #1
Voxxel
A Chromatic Dragonspawn
Join Date: Mar 2009
Posts: 193
Raid invite macro

Hello!

"All max level character will be invited to raid in 10 sec. Please leave your groups."

I'm looking for a script to be able to to do mass invites for guildies similar to DBM's mass invite above, but with another guild chat warning text and other level range.

Fore example "For the X event discussed on the forum, all players between level 70 and 80 will be invite in 10 sec." -> then the script invites all guildies in that level range in 10 sec.

Is that possible to do with a script? I really dont want to install justanoherusefuladdon since I got plenty already.

Thanks!
  Reply With Quote
03-12-12, 01:27 PM   #2
Waky
A Cobalt Mageweaver
 
Waky's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 200
I feel like the script required would be too large to fit into just one macro. I would just look for an auto-invite addon of some sort.

I've found AutoInvite by Martag. The only thing is this one invites by whispering a keyword, such as "inv" or "invite."
  Reply With Quote
03-12-12, 02:03 PM   #3
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Something like this?

http://addon.ziuo.net/
/rinv All max level character will be invited to raid in 10 sec. Please leave your groups.
Code:
local delay = 0

local function OnUpdate(self, elapsed)
	delay = delay + elapsed
	if delay > 10 then
		for i = 1, GetNumGuildMembers() do
			local name, _, _, level, _, _, _, _, online = GetGuildRosterInfo(i)
			if online and (level >= 70 and level <= 80) then
				InviteUnit(name)
			end
		end
		delay = 0
		self:SetScript("OnUpdate", nil)
	end
end

local f = CreateFrame("Frame")

SLASH_RAIDINVITE1 = "/rinv"
SLASH_RAIDINVITE2 = "/raidinvite"

SlashCmdList["RAIDINVITE"] = function(msg, editbox)
	SendChatMessage(msg, "GUILD")
	f:SetScript("OnUpdate", OnUpdate)
end

or with AceTimer, provided you have Ace3 loaded/embeded. The message has a limited length though
Code:
/run SendChatMessage("Hello World!","GUILD")LibStub("AceTimer-3.0"):ScheduleTimer(function()for i=1,GetNumGuildMembers()do local a,_,_,b,_,_,_,_,c=GetGuildRosterInfo(i)if c and(b>=70 and b<=80)then InviteUnit(a)end end end,10)

-- Neither of those 2 example scripts cope with changing from a party to a raid though

Last edited by Ketho : 03-12-12 at 02:36 PM.
  Reply With Quote
03-12-12, 05:44 PM   #4
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
This modification of Ketho's code should handle party-to-raid conversions. If you're already in a party when the mass invites go out, it will convert the party to a raid. If you're not in a party yet, it will wait until someone accepts the invite, and then convert the party to a raid.

I also added the ability to configure the delay time in the slash command:

Code:
/rinv 15 Raid invites coming in 15 seconds!
If you don't specify a number, it will default to 10 seconds.

Code:
local WAIT_TIME = 10

local f = CreateFrame("Frame")
f:Hide()

f:SetScript("OnEvent", function(self, event)
	if GetNumRaidMembers() > 0 then
		self:UnregisterAllEvents()
	elseif GetNumPartyMembers() > 0 then
		ConvertToRaid()
	end
end)

local delay = 0
f:SetScript("OnUpdate", function(self, elapsed)
	delay = delay + elapsed
	if delay < WAIT_TIME then
		return
	end

	if GetNumRaidMembers() == 0 then
		self:RegisterEvent("RAID_ROSTER_UPDATE")
		if GetNumPartyMembers() == 0 then
			self:RegisterEvent("PARTY_MEMBERS_CHANGED")
		else
			ConvertToRaid()
		end
	end

	for i = 1, GetNumGuildMembers() do
		local name, _, _, level, _, _, _, _, online = GetGuildRosterInfo(i)
		if online and (level >= 70 and level <= 80) then
			InviteUnit(name)
		end
	end
	delay = 0
	self:Hide()
end

SLASH_RAIDINVITE1 = "/rinv"
SLASH_RAIDINVITE2 = "/raidinvite"

SlashCmdList["RAIDINVITE"] = function(msg, editbox)
	local wait, text = msg:trim():match("^(%d+) (.+)$")

	wait = tonumber(wait)
	if wait and wait > 0 then
		WAIT_TIME = wait
	else
		WAIT_TIME = 10
	end

	SendChatMessage(text or msg, "GUILD")
	f:Show()
end

Last edited by Phanx : 03-12-12 at 05:50 PM.
  Reply With Quote
03-18-12, 07:35 PM   #5
Voxxel
A Chromatic Dragonspawn
Join Date: Mar 2009
Posts: 193
Thank both of you for the reply!

Is there any dependency to induce the addon to work that I made at http://addon.ziuo.net ? Because it seems not working. It reports wrong command for bot /rinv and /raidinvite

All I have to do is copy-paste the code (with the starting line "local WAIT_TIME = 10") to the "LUA file" editbox on addon.ziuo.net and choose a name above at "Addon folder name" editbox or should I use "Show advanced TOC options" also or something else I missed out? How can I get it to work?
  Reply With Quote
03-18-12, 08:10 PM   #6
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Do you have "Load Outdated AddOns" checked? The addon creator you linked to has the incorrect interface number in the TOC. It's 40300, not 40330. You can either tell your game client to load the addon or change the number in the TOC while on that site.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
03-19-12, 02:00 AM   #7
Voxxel
A Chromatic Dragonspawn
Join Date: Mar 2009
Posts: 193
Of course, I use some other outdated addons aswell. It used to be working but it doesn't.

Edit: Ok, I figured out that the first script (Ketho's script) is working, the second script (Phanx' one) is not working for me. Is the Phanx' one only an affix to Ketho's script or is it a complete rewrite that I can copy+paste into the http://addon.ziuo.net script field?

Last edited by Voxxel : 03-19-12 at 02:43 AM.
  Reply With Quote
03-19-12, 03:28 AM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Voxxel View Post
... the second script (Phanx' one) is not working for me. Is the Phanx' one only an affix to Ketho's script or is it a complete rewrite that I can copy+paste into the http://addon.ziuo.net script field?
It is a complete rewrite (eg. used by itself, not in addition to Ketho's code) but I did not test it in-game. Are there any Lua errors (install BugSack to check), or does it just "not work"?
  Reply With Quote
03-20-12, 12:00 AM   #9
Voxxel
A Chromatic Dragonspawn
Join Date: Mar 2009
Posts: 193
When I type either /rinv or /raidinvite, wow does not recognize it. Replies "Type '/help' for a listing of a few commands" error message.
  Reply With Quote
03-23-12, 01:50 AM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
There was a missing parenthesis. Here is a corrected version:
Code:
local WAIT_TIME = 10

local f = CreateFrame("Frame")
f:Hide()

f:SetScript("OnEvent", function(self, event)
	if GetNumRaidMembers() > 0 then
		self:UnregisterAllEvents()
	elseif GetNumPartyMembers() > 0 then
		ConvertToRaid()
	end
end)

local delay = 0
f:SetScript("OnUpdate", function(self, elapsed)
	delay = delay + elapsed
	if delay < WAIT_TIME then
		return
	end

	if GetNumRaidMembers() == 0 then
		self:RegisterEvent("RAID_ROSTER_UPDATE")
		if GetNumPartyMembers() == 0 then
			self:RegisterEvent("PARTY_MEMBERS_CHANGED")
		else
			ConvertToRaid()
		end
	end

	for i = 1, GetNumGuildMembers() do
		local name, _, _, level, _, _, _, _, online = GetGuildRosterInfo(i)
		if online and (level >= 70 and level <= 80) then
			InviteUnit(name)
		end
	end
	delay = 0
	self:Hide()
end)

SLASH_RAIDINVITE1 = "/rinv"
SLASH_RAIDINVITE2 = "/raidinvite"

SlashCmdList["RAIDINVITE"] = function(msg, editbox)
	if msg == "" then
		return print("|cffffff00Usage:|r /rinv |cff66ffff10|r |cffff99ffRaid invites coming in 10 seconds!|r")
	end

	local wait, text = msg:trim():match("^(%d+) (.+)$")

	wait = tonumber(wait)
	if wait and wait > 0 then
		WAIT_TIME = wait
	else
		WAIT_TIME = 10
	end
	SendChatMessage(text or msg, "GUILD")
	f:Show()
end
As I'm not in a guild, I can't completely test it, but the slash command with no arguments outputs the help line as expected, and there are no syntax errors.

Also, for future reference, when testing code, or trying to figure out why an addon isn't working right, you should install BugSack or a similar error catching tool so you can see any Lua errors that are occurring. Just enabling Lua errors in the Blizzard interface options isn't enough, because that won't show you errors that occur during the initial loading sequence (like those caused by missing parentheses).
  Reply With Quote
03-25-12, 03:29 PM   #11
Voxxel
A Chromatic Dragonspawn
Join Date: Mar 2009
Posts: 193
The new one is working as intended, thank you very much!

However, when the invites begin and it reaches the 4th invite then I got some "Your party is full." message for the 5th, 6th, etc.. I had to manually invite the rest again who weren't invited since the party was full. (Actually the party wasn't full, it was empty (only me) because nobody has accepted the first 4 invites because they were in a group.)

Could switching the order (convert party to raid then invite members) solve that problem?
  Reply With Quote
03-25-12, 08:18 PM   #12
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Hmm, I see the problem. You actually can't send more than one party's worth of invites until you convert to a raid. It's definitely solvable, though. I'll see what I can come up with.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Macro Help » Raid invite macro

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