Thread Tools Display Modes
09-17-09, 05:12 PM   #1
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
LFG joining/leaving

So im trying to make a button to join and leave the lfg channel but so far no luck. This is what i have so far, some may ask why i dont put leave on right mouse button well... simple something else is on right mousebutton. or is it left? well either way need to get the whole function in one click. I know right now their is some sort of error with the way i tried to link the if's, not sure how to put 2 separated if sets in one button click.

The other and more major error at the moment imo is that if i remove it so it only has the one command to SetLookingForGroup it does setup the LFG page and joins LFG but it does not actually join the LFG channel for what ever reason.

Any thoughts? here is the code i have so far.
Code:
if button == 'LeftButton' then
		if (GetNumPartyMembers()==0) then
			SetLookingForGroup(3, 5, 1);
			SetLFGComment("LFG-Channel enabled by GrimUI");
			UIErrorsFrame:AddMessage("LookingForGroup On", 0.0, 1.0, 0.0, 53, 3);
		elseif
			(UnitIsPartyLeader("player")==1) then
			SetLookingForMore(5, 1);
			SetLFGComment("LFG-Channel enabled by GrimUI");
			UIErrorsFrame:AddMessage("LookingForGroup On", 0.0, 1.0, 0.0, 53, 3);
		end
	else
		if (UnitIsPartyLeader("player")==nil) then
			ClearLookingForGroup()
			UIErrorsFrame:AddMessage("LookingForGroup Off", 1.0, 0.0, 0.0, 53, 3);
		elseif
			(n > 0) then
			ClearLookingForGroup()
			UIErrorsFrame:AddMessage("LookingForGroup Off", 1.0, 0.0, 0.0, 53, 3);
		end
    end
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
09-17-09, 05:32 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by Grimsin View Post
So im trying to make a button to join and leave the lfg channel but so far no luck. This is what i have so far, some may ask why i dont put leave on right mouse button well... simple something else is on right mousebutton. or is it left? well either way need to get the whole function in one click. I know right now their is some sort of error with the way i tried to link the if's, not sure how to put 2 separated if sets in one button click.
Well, right now, you're telling it to join on left click and leave on any other click. Let me fix your lines/indentation to show you that:
Code:
if button == 'LeftButton' then
          if (GetNumPartyMembers()==0) then
                    SetLookingForGroup(3, 5, 1);
                    SetLFGComment("LFG-Channel enabled by GrimUI");
                    UIErrorsFrame:AddMessage("LookingForGroup On", 0.0, 1.0, 0.0, 53, 3);
          elseif
                    (UnitIsPartyLeader("player")==1) then
                    SetLookingForMore(5, 1);
                    SetLFGComment("LFG-Channel enabled by GrimUI");
                    UIErrorsFrame:AddMessage("LookingForGroup On", 0.0, 1.0, 0.0, 53, 3);
          end
else
          if (UnitIsPartyLeader("player")==nil) then
                    ClearLookingForGroup()
                    UIErrorsFrame:AddMessage("LookingForGroup Off", 1.0, 0.0, 0.0, 53, 3);
          elseif (n > 0) then          --have no clue what this n variable is, but I can guess what you mean to do...
                    ClearLookingForGroup()
                    UIErrorsFrame:AddMessage("LookingForGroup Off", 1.0, 0.0, 0.0, 53, 3);
          end
end
Here's how your code *should* read:
Code:
if button == 'LeftButton' then
          if IsInLFGQueue() then          --http://wowprogramming.com/docs/api/IsInLFGQueue
                    ClearLookingForGroup()          --leave LFG if already in it
                    UIErrorsFrame:AddMessage("LookingForGroup Off", 1.0, 0.0, 0.0, 53, 3)
          else          --if not in it, then join
                    if (GetNumPartyMembers()==0) then          --you're not in a party
                              SetLookingForGroup(3, 5, 1);
                              SetLFGComment("LFG-Channel enabled by GrimUI");
                              UIErrorsFrame:AddMessage("LookingForGroup On", 0.0, 1.0, 0.0, 53, 3);
                    elseif (UnitIsPartyLeader("player")==1) then
                              SetLookingForMore(5, 1);
                              SetLFGComment("LFG-Channel enabled by GrimUI");
                              UIErrorsFrame:AddMessage("LookingForGroup On", 0.0, 1.0, 0.0, 53, 3);
                    end
          end
end
Can't double check it atm, but that'll start you off.
__________________
"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-17-09, 05:34 PM   #3
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
oh wow. i had not seen that lfgqueue command that might make all the difference right their.

Well that for sure fixed the issues i had with my if statements. still no luck on it actually joining the channel or not which makes no sense. /join LookingForGroup also does not function the way one would think it should...
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 09-17-09 at 05:44 PM.
  Reply With Quote
09-17-09, 06:03 PM   #4
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Okay got it to work, its because i had used the /join command at one point so it was not doing anything. It does join it now without a problem. What it does not do is leave the channel or clear the lfg.....
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
09-17-09, 06:53 PM   #5
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
OKay so i think the issue might be with IsInLFGQueue, i think that returns a value right? dont we need to return that value somewhere and do the if on th at? so it reads if IsInLFGQueue's returned value is such n such do this?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
09-17-09, 07:00 PM   #6
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
ah nope IsInLFGQueue() is not valid for this.... because you dont actually join the autojoin queue. i think GetLookingForGroup is what i need to base things on.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 09-17-09 at 07:11 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » LFG joining/leaving


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