Reply
Thread Tools Display Modes
Unread 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!
makaka is offline   Reply With Quote
Unread 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: 816
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.
tinyu is offline   Reply With Quote
Unread 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
makaka is offline   Reply With Quote
Unread 09-23-12, 12:19 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,637
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

Seerah is offline   Reply With Quote
Unread 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: 816
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.
tinyu is offline   Reply With Quote
Unread 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.
makaka is offline   Reply With Quote
Unread 10-05-12, 12:06 PM   #7
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,637
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

Seerah is offline   Reply With Quote
Unread 10-05-12, 06:04 PM   #8
Phanx
A Pyroguard Emberseer
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 4,432
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
__________________
Author/maintainer of Grid, PhanxChat, ShieldsUp, and many more.
Troubleshoot an addonTurn any code into an addonMore addon resources
Need help with your code? Post all of your actual code! Attach or paste your files.
Please don’t PM me about addon bugs or code questions. Post a comment or forum thread instead!
Phanx is offline   Reply With Quote
Unread 10-05-12, 09:14 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 9,637
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

Seerah is offline   Reply With Quote
Reply

Go BackWoWInterface » 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