WoWInterface

WoWInterface (http://www.wowinterface.com/forums/index.php)
-   Macro Help (http://www.wowinterface.com/forums/forumdisplay.php?f=140)
-   -   Mass guild whisp for X rang. (http://www.wowinterface.com/forums/showthread.php?t=44474)

makaka 09-23-12 09:07 AM

Mass guild whisp for X rang.
 
Hello everybody!

This is ma script:

/run for i = 1, select(2, GetNumGuildMembers()) do SendChatMessage("TEXT MESSAGE", "WHISPER", nil, GetGuildRosterInfo(i)) end


So.. how to change the script so that will not whisp all the people who are online, but whisp only to a XXX rank in the guild?

Like..

*Member* - nothing whisp!
*Veteran* - nothing whisp!
*Newbie* - Hello, this is.. blahblahblah!

Thx you!

tinyu 09-23-12 09:22 AM

try this

/run for i = 1, select(2, GetNumGuildMembers()) do SendChatMessage("TEXT MESSAGE", "WHISPER", nil, GetGuildRosterInfo(i), GuildControlGetRankName("rank name")) end

It might work, I'm not playing WoW atm so I can't test it.

makaka 09-23-12 11:01 AM

Quote:

Originally Posted by tinyu (Post 264854)
try this

/run for i = 1, select(2, GetNumGuildMembers()) do SendChatMessage("TEXT MESSAGE", "WHISPER", nil, GetGuildRosterInfo(i), GuildControlGetRankName("rank name")) end

It might work, I'm not playing WoW atm so I can't test it.

Nope, dosnt work :)

I think need put rang level.

http://www.wowwiki.com/API_GuildControlGetRankName

Seerah 09-23-12 12:19 PM

tinyu: that's not how SendChatMessage() works, nor is it what GuildControlGetRankName() is for. ;)

makaka: This is untested, but really should work. ;)
Code:

/run for i=1,select(2,GetNumGuildMembers()) do local n,r=GetGuildRosterInfo(i) if r="Newbie" then SendChatMessage("TEXT MESSAGE","WHISPER",nil,n) end end
GetGuildRosterInfo has many returns. The first is name, and the second is rank. As your script goes through the loop, it assigns that member's name to the variable n and their rank to the variable r. If the rank is "Newbie" (or whatever you want to replace that with) then it will send the message. I also tightened it up a little bit more. As written, if your rank name is "Newbie" or another 6-letter name, you have 114 characters to use for your message.

tinyu 09-23-12 07:32 PM

cheers Seerah I was just making a stab in the dark I was almost certain what I posted was wrong lol.

makaka 10-01-12 03:52 AM

Quote:

Originally Posted by Seerah (Post 264862)
tinyu: that's not how SendChatMessage() works, nor is it what GuildControlGetRankName() is for. ;)

makaka: This is untested, but really should work. ;)
Code:

/run for i=1,select(2,GetNumGuildMembers()) do local n,r=GetGuildRosterInfo(i) if r="Newbie" then SendChatMessage("TEXT MESSAGE","WHISPER",nil,n) end end
GetGuildRosterInfo has many returns. The first is name, and the second is rank. As your script goes through the loop, it assigns that member's name to the variable n and their rank to the variable r. If the rank is "Newbie" (or whatever you want to replace that with) then it will send the message. I also tightened it up a little bit more. As written, if your rank name is "Newbie" or another 6-letter name, you have 114 characters to use for your message.

Tryed, but doesn't work. I think need change r="Newbie" - r="(number of rank)". I use russian client, and maybe it did not work because of transliteration, but I changed the name of the rank from Russian to English name - Newbie. And this again dsoen't work.

Seerah 10-05-12 12:06 PM

No, the second return of GetGuildRosterInfo() is a string - the actual name of the rank. http://wowprogramming.com/docs/api/GetGuildRosterInfo

Is Newbie the actual name of the rank you want to check for? I noted that you need to replace that with whatever you're looking for.

Phanx 10-05-12 06:04 PM

Also, to test for equality, you need two equals-signs, not one.

This sets the value of r to "Newbie", and the check fails because setting a variable doesn't return anything:

if r = "Newbie" then

This compares the value of r to "Newbie" and returns true (passing the check) if it is:

if r == "Newbie" then

Seerah 10-05-12 09:14 PM

There we go! I don't know how I missed that twice. :o


All times are GMT -6. The time now is 11:08 PM.

vBulletin © 2014, Jelsoft Enterprises Ltd
©2012 ZAM Network LLC