Question

I would like to demote (rank down) every member of my guild with a specific rank (e.g. all Newbies to Incomers)

--- any ideas how to do this in World of Warcraft API ?

(Im guessing some loop over all guild members' names testing if rank and demote then? - please write example if so)

Thank you for your future answers :)

Was it helpful?

Solution

When I played, the the first place I'd always look was wowwiki. Here's the list of guild functions. Looks like you can call GetGuildRosterInfo from 1 to GetNumGuildMember times (or until GetGuildRosterInfo(N) returns nil) to get player name and rank, then call GuildDemote to demote players.

Something like this (totally untested; I don't even have WoW installed these days):

for i=1,GetNumGuildMembers() do
    local name, rank = GetGuildRosterInfo(i)
    if rank == "The rank you're iterested in" then
        GuildDemote(name)
    end
end

You can try out API calls in game. You can even write most of your addon in game. When I played, I wrote quite a few addons for myself and published a few. One of them (Hack) was an in-game Lua script editor. I think someone has picked up the ball on that and kept it going. You should look to get something like that.

OTHER TIPS

This is a clarification for the rest of the OPs question about being able to do this in a macro.

Here is something I had in one of my macros, formatted so you can read it here:

/run for i=0,0 do local instanceName, instanceDesc, backgroundTexture, buttonTexture, 
    titleBackground, mapID, instanceLink = EJ_GetSearchResult(i); if mapID then print
    (i,instanceName, mapID) end end

/dump GetLFGDungeonInfo(20)

Here's the same thing formatted so that you could jsut copy and paste it into a macro. Each command is on one line. You can have multiple commands which are run sequentialy:

/run for i=0,0 do local instanceName, instanceDesc, backgroundTexture, buttonTexture, titleBackground, mapID, instanceLink = EJ_GetSearchResult(i); if mapID then print(i,instanceName, mapID) end end
/dump GetLFGDungeonInfo(20)

Heres the accepted answer again:

for i=1,GetNumGuildMembers() do
    local name, rank = GetGuildRosterInfo(i)
    if rank == "The rank you're iterested in" then
        GuildDemote(name)
    end
end

Here it is formatted for pasting into a macro:

/run for i=1,GetNumGuildMembers() do local name, rank = GetGuildRosterInfo(i); if rank == "The rank you're iterested in" then GuildDemote(name) end end

Notice the simicolon ';' between the two statements in the same block on the same line. This is good practice for making the code unambiguous and a little easier to read.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top