-
Posted by akise on Wed, 11 Apr 2012 03:44:50
Hello dear wow programmer community
I am unexperienced in addon programming, but am not an unexperienced programmer overall...so Ive started just testing some stuff today which I want to use in an addon later. SO ive started with simple macros first.
One of them is a script running in the background which fires when I am invited to a group. This automatically declines any party invites incoming immediately:
/run local s = StaticPopupDialogs["PARTY_INVITE"] s.OnAccept=nil s.OnShow=function() StaticPopup_Hide("PARTY_INVITE") DeclineGroup(); end
(I want to make the same for guild specific invites, but that wont be hard since this is already working).
It works perfectly!! But I wanted to expand it a bit, so that the person who invited me automatically gets a whisper from me. This is how far I got:
/run local s = StaticPopupDialogs["PARTY_INVITE"] s.OnAccept=nil s.OnShow=function() StaticPopup_Hide("PARTY_INVITE") DeclineGroup(); SendChatMessage("text", "WHISPER", nil, *****); end
So my problem is quite simple, I don't know what to type where * are. There's supposed to be the name of the person who I want to whisper, right? So how can I make it automatically whisper the person who sent me the invite?
(Also, I'd like to know how to stop scripts Ive started with /run ... embarrassing question, but I don't know it. Please help.)
-
Posted by jnwhiteh on Wed, 18 Apr 2012 17:02:09
I don't believe the information about who has invited you to the party is in the static popup. If it is, you could parse it to get that information, but its not just sitting around as far as I know.
As for stopping scripts, well.. you've got the wrong idea. You're not 'starting' a script when you call /run, you're executing it. It's the event-driven behaviour of the system that causes it to be invoked hen necessary. There's no way to 'stop' it, other than to take steps to remove the behaviour that you've defined.
Or you could add a boolean flag that deactivated your logic, but you'd still have the event handler overwriting that you'r edoing.
-
Posted by stolenlegacy on Fri, 20 Apr 2012 21:09:22
The StaticPopup's text (named $parentText according to the FrameXML) is populated according to the INVITATION global string. You can thus reverse this string.format to obtain the inviting player.
local invitingPlayer = _G[self:GetName().."Text"]:GetText():match(INVITATION:gsub("%%s","(%%S+)"))
(You probably want to cache the match formatstring to improve performance.)
-
Posted by stolenlegacy on Fri, 20 Apr 2012 21:09:23
The StaticPopup's text (named $parentText according to the FrameXML) is populated according to the INVITATION global string. You can thus reverse this string.format to obtain the inviting player.
local invitingPlayer = _G[self:GetName().."Text"]:GetText():match(INVITATION:gsub("%%s","(%%S+)"))
(You probably want to cache the match formatstring to improve performance.)