WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Macro Help (https://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   Raid invite macro (https://www.wowinterface.com/forums/showthread.php?t=43010)

Voxxel 03-12-12 12:36 PM

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!

Waky 03-12-12 01:27 PM

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."

Ketho 03-12-12 02:03 PM

Something like this?

http://addon.ziuo.net/
Quote:

/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 :(

Phanx 03-12-12 05:44 PM

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


Voxxel 03-18-12 07:35 PM

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?

Seerah 03-18-12 08:10 PM

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.

Voxxel 03-19-12 02:00 AM

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?

Phanx 03-19-12 03:28 AM

Quote:

Originally Posted by Voxxel (Post 254129)
... 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"?

Voxxel 03-20-12 12:00 AM

When I type either /rinv or /raidinvite, wow does not recognize it. Replies "Type '/help' for a listing of a few commands" error message.

Phanx 03-23-12 01:50 AM

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).

Voxxel 03-25-12 03:29 PM

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?

Phanx 03-25-12 08:18 PM

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.


All times are GMT -6. The time now is 05:27 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI