View Single Post
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