Thread Tools Display Modes
09-23-12, 09:07 AM   #1
makaka
A Cyclonian
Join Date: Feb 2010
Posts: 40
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!
  Reply With Quote
09-23-12, 09:22 AM   #2
tinyu
A Molten Giant
 
tinyu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 837
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.
__________________
"There's no such thing as too many addons."
Lothaer
Titan Dev Team Member.
  Reply With Quote
09-23-12, 11:01 AM   #3
makaka
A Cyclonian
Join Date: Feb 2010
Posts: 40
Originally Posted by tinyu View Post
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
  Reply With Quote
09-23-12, 12:19 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
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.
__________________
"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
09-23-12, 07:32 PM   #5
tinyu
A Molten Giant
 
tinyu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 837
cheers Seerah I was just making a stab in the dark I was almost certain what I posted was wrong lol.
__________________
"There's no such thing as too many addons."
Lothaer
Titan Dev Team Member.
  Reply With Quote
10-01-12, 03:52 AM   #6
makaka
A Cyclonian
Join Date: Feb 2010
Posts: 40
Originally Posted by Seerah View Post
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.
  Reply With Quote
10-05-12, 12:06 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
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.
__________________
"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
10-05-12, 06:04 PM   #8
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
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
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
10-05-12, 09:14 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
There we go! I don't know how I missed that twice.
__________________
"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

WoWInterface » AddOns, Compilations, Macros » Macro Help » Mass guild whisp for X rang.

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