WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Macro Help (https://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   Disband raid macro help (https://www.wowinterface.com/forums/showthread.php?t=59009)

zENK 12-31-21 03:58 PM

Disband raid macro help
 
Hi,

Is there a way to make this disband raid macro work so it gets the name-realm from "player" as well? Currently when I use this macro some of my alts are still left in the group and have to manually remove them if they have the same name but are on a different realm, I'm using this macro to disband my group after summoning my alt army to different places. Also, is it possible to make it so it works for both party and raid?

Thanks :)

/run for i=1,GetNumGroupMembers() do if UnitName("raid"..i) ~= UnitName("player") then UninviteUnit("raid"..i, "reason") end end LeaveParty()

Seerah 12-31-21 08:00 PM

/run for i=1,GetNumGroupMembers() do if not UnitIsUnit("player", "raid"..i) then UninviteUnit("raid"..i) end end LeaveParty()

zENK 12-31-21 08:33 PM

Quote:

Originally Posted by Seerah (Post 340145)
/run for i=1,GetNumGroupMembers() do if not UnitIsUnit("player", "raid"..i) then UninviteUnit("raid"..i) end end LeaveParty()

Works for raid group but not while in party :/

zENK 12-31-21 08:39 PM

Leatrix plus addon just added this feature into their addon so won't need help on this anymore. case closed :) ty for trying to help Seerah

Seerah 01-01-22 01:53 PM

Just FYI, your original macro you posted would only work in raid also. Glad you got it figured out, though.

Kanegasi 01-01-22 03:49 PM

I'm a bit confused as to how your original macro even worked. On retail, UninviteUnit is supposed to take only name-realm and is hardware protected, as well as LeaveParty() moving to C_PartyInfo in 8.2.5 with the deprecated placeholder removed in 9.0. Maybe the act of hitting the macro is good for the whole loop, haven't really tried something like that, as well as a unit token still being allowed, but either you have your own LeaveParty() shortcut or an addon is providing it, or you're on one of the classic versions.

In any case, assuming you're on a legitimate WoW version, here are four versions of a macro that will disband a party or a raid, each version accounting for unit tokens, name-realm, and where the LeaveParty() function might be. The last one is the longest at 186 characters. As a side note, I added the third argument to UninviteUnit which should skip any confirmation dialogs, based on the way Blizzard uses it.

Code:

/run local n,u=4,"party" if IsInRaid() then n,u=40,"raid" end for i=1,n do if not UnitIsUnit(u..i,"player") then UninviteUnit(u..i,nil,1) end end LeaveParty()

/run local n,u=4,"party" if IsInRaid() then n,u=40,"raid" end for i=1,n do if not UnitIsUnit(u..i,"player") then UninviteUnit(GetUnitName(u..i,1),nil,1) end end LeaveParty()

/run local n,u=4,"party" if IsInRaid() then n,u=40,"raid" end for i=1,n do if not UnitIsUnit(u..i,"player") then UninviteUnit(u..i,nil,1) end end C_PartyInfo.LeaveParty()

/run local n,u=4,"party" if IsInRaid() then n,u=40,"raid" end for i=1,n do if not UnitIsUnit(u..i,"player") then UninviteUnit(GetUnitName(u..i,1),nil,1) end end C_PartyInfo.LeaveParty()


zENK 01-01-22 06:14 PM

Quote:

Originally Posted by Kanegasi (Post 340154)
I'm a bit confused as to how your original macro even worked. On retail, UninviteUnit is supposed to take only name-realm and is hardware protected, as well as LeaveParty() moving to C_PartyInfo in 8.2.5 with the deprecated placeholder removed in 9.0. Maybe the act of hitting the macro is good for the whole loop, haven't really tried something like that, as well as a unit token still being allowed, but either you have your own LeaveParty() shortcut or an addon is providing it, or you're on one of the classic versions.

In any case, assuming you're on a legitimate WoW version, here are four versions of a macro that will disband a party or a raid, each version accounting for unit tokens, name-realm, and where the LeaveParty() function might be. The last one is the longest at 186 characters. As a side note, I added the third argument to UninviteUnit which should skip any confirmation dialogs, based on the way Blizzard uses it.

Code:

/run local n,u=4,"party" if IsInRaid() then n,u=40,"raid" end for i=1,n do if not UnitIsUnit(u..i,"player") then UninviteUnit(u..i,nil,1) end end LeaveParty()

/run local n,u=4,"party" if IsInRaid() then n,u=40,"raid" end for i=1,n do if not UnitIsUnit(u..i,"player") then UninviteUnit(GetUnitName(u..i,1),nil,1) end end LeaveParty()

/run local n,u=4,"party" if IsInRaid() then n,u=40,"raid" end for i=1,n do if not UnitIsUnit(u..i,"player") then UninviteUnit(u..i,nil,1) end end C_PartyInfo.LeaveParty()

/run local n,u=4,"party" if IsInRaid() then n,u=40,"raid" end for i=1,n do if not UnitIsUnit(u..i,"player") then UninviteUnit(GetUnitName(u..i,1),nil,1) end end C_PartyInfo.LeaveParty()


I found that macro I posted here on another website, I didn't make it myself :P but your macros works great the way I wanted it to :) thanks! Now I have both a macro and an addon to do it for me incase the addon would ever break or something, just one thing I'm wondering about for the macros you posted. Is there something you can edit to avoid the "You aren't in a party" spam while using the macro in a raid group? https://imgur.com/a/vkTmVFc

Kanegasi 01-01-22 10:44 PM

There might be some weird delay with UninviteUnit on nonexistent members, causing something to happen after the loop. Normally, unit functions on nonexistent units are silently ignored.

In any of the versions, find this:

Code:

if not

replace with this:

Code:

if UnitExists(u..i) and not

I also thought about an edge case where the loop may miss someone because unit IDs in a group could get shuffled around.

In any of the versions, find this:

Code:

i=1,n

replace with this:

Code:

i=n,1,-1

zENK 01-02-22 09:59 AM

Thank you! This macro works great now :)

Code:

/run local n,u=4,"party" if IsInRaid() then n,u=40,"raid" end for i=n,1,-1 do if UnitExists(u..i) and not UnitIsUnit(u..i,"player") then UninviteUnit(u..i,nil,1) end end LeaveParty()


All times are GMT -6. The time now is 02:28 PM.

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