1. So, I've gone through many steps, trying to get what I want. And nothing seems to do what I want yet.. I obviously need to wait for the book to get these things to do what I want, simple common sense isn't cutting it for me.

    I thank you for the brief help you gave me, and I look forward to the book helping me more.

    I went away from the dropdownmenu, and back to the checkbox idea, and this time, instead of 2 checkboxes, I did 1, that toggles the channel.

     <CheckButton name="ChannelSelect" inherits="UICheckButtonTemplate" text="ChannelSelect">
                    <Size>
                        <AbsDimension x="45" y="31" />
                    </Size>
                    <Anchors>
                        <Anchor point="TOPLEFT">
                            <Offset x="30" y="-67" />
                        </Anchor>
                    </Anchors>
                    <Scripts>
                        <OnLoad>
                            NQGambler_ChannelSelect();
                         </OnLoad>
                    </Scripts>
                    <NormalTexture file="Interface\BUTTONS\CheckButtonGlow" />
                    <HighlightTexture file="Interface\BUTTONS\CheckButtonHilight" />
                </CheckButton>
            </Frames>
    

    And this is what I have so far in my LUA which, everytime I enter it, the whole addon stops working:

     function NQGambler_ChannelSelect() 
                     local channel = channelChoice
                local string = strjoin(" ", "[NQG] Enabled for", channelChoice,")
            if ChannelSelect:GetChecked() then
                channelChoice = "Party"
                SendChatMessage(string,"channel",GetDefaultLanguage("player"));
            else
                channelChoice = "Raid"
                SendChatMessage(string,"channel",GetDefaultLanguage("player"));
            end
        end
    

    My problem seems to be the same across the board. Whenever I impliment some new scheme, something new, like this check box.. the whole addon seems to fall apart, I am so beyond baffled. I really hope the books help me resolve this, before I go insane.

  2. A CheckButton will AUTOMATICALLY toggle it's state when it's clicked, so your code should not try to manage the click state at all. I would, in this case, suggest a PostClick.

     RaidButton:SetScript("PostClick", function(self)
       if self:GetChecked() then
         PartyButton:SetChecked(false);
       end
     end)
    
     PartyButton:SetScript("PostClick", function(self)
       if self:GetChecked() then
         RaidButton:SetChecked(false);
       end
     end)
    

    Very straightforward.

  3. Well, addons can't 'crash', so you'll need to be more specific. Are you getting an error? Does your WoW client crash? What is actually happening?

  4. So, I've gone through many steps, trying to get what I want. And nothing seems to do what I want yet.. I obviously need to wait for the book to get these things to do what I want, simple common sense isn't cutting it for me.

    Please do not edit your posts. It's a waste of time and anyone who comes afterwards is unable to follow the conversation. Do not continue doing it, just reply. Also, highlight the code block you want to set as a code block, and click the button. Your code inserts are all borked, and I've fixed them.

    I thank you for the brief help you gave me, and I look forward to the book helping me more.

    I went away from the dropdownmenu, and back to the checkbox idea, and this time, instead of 2 checkboxes, I did 1, that toggles the channel.

     <CheckButton name="ChannelSelect" inherits="UICheckButtonTemplate" text="ChannelSelect">
                  <Size>
                      <AbsDimension x="45" y="31" />
                  </Size>
                  <Anchors>
                      <Anchor point="TOPLEFT">
                          <Offset x="30" y="-67" />
                      </Anchor>
                  </Anchors>
                  <Scripts>
                      <OnLoad>
                          NQGambler_ChannelSelect();
                         </OnLoad>
                  </Scripts>
                  <NormalTexture file="Interface\BUTTONS\CheckButtonGlow" />
                  <HighlightTexture file="Interface\BUTTONS\CheckButtonHilight" />
              </CheckButton>
          </Frames>
    

    And this is what I have so far in my LUA which, everytime I enter it, the whole addon stops working:

     function NQGambler_ChannelSelect() 
                     local channel = channelChoice
              local string = strjoin(" ", "[NQG] Enabled for", channelChoice,")
          if ChannelSelect:GetChecked() then
              channelChoice = "Party"
              SendChatMessage(string,"channel",GetDefaultLanguage("player"));
          else
              channelChoice = "Raid"
              SendChatMessage(string,"channel",GetDefaultLanguage("player"));
          end
      end
    

    My problem seems to be the same across the board. Whenever I impliment some new scheme, something new, like this check box.. the whole addon seems to fall apart, I am so beyond baffled. I really hope the books help me resolve this, before I go insane.

    1. Open Interface Options
    2. Click on the 'Help' section
    3. Click 'Display Lua Errors'
    4. Report the error.
  5. Well, I fixed 1 error, which was this line:

    SendChatMessage("[NQG] Enabled for Party Gambling!","channel");
    

    Now, I've got this error, and not sure where this error is indicating the problem is.

    Message: [string "*:OnClick"]:2: unexpected symbol near ''

    I also get:

    Message: attempt to call a nil value Time: 05/17/10 13:54:14 Count: 3 Stack: Locals:

    whenever I click the check box.

  6. Well, I fixed 1 error, which was this line:

    SendChatMessage("[NQG] Enabled for Party Gambling!","channel");

    The code samples you input are correct, and you keep breaking them. Please preview your posts rather than posting 15 times.

    Now, I've got this error, and not sure where this error is indicating the problem is.

    Message: [string "*:OnClick"]:2: unexpected symbol near ''

    No idea, can't say a thing without the code, but that's not a valid error message really.

    I also get:

    Message: attempt to call a nil value Time: 05/17/10 13:54:14 Count: 3 Stack: Locals:

    whenever I click the check box.

    This means you're trying to call a nil value. Without the code (use http://pastey.net if you're going to paste anything) I can't tell you anything.

  7. Alright: http://pastey.net/136554-3woi

    That is my LUA - Toward the bottom, is where the Channel Select is.. I know its not in a working area at this moment. I'm trying to get it working somewhat, before I figure out how to make the other things accept its choices.

  8. A few things, but I'm just 100% stabbing in the dark here since the error messages don't even begin to correspond to the code.

    1. You have local channel = channelSelect, but this variable is never defined anywhere. What's the purpose of this code?
    2. You also set channelSelect = Party and channelSelect = Raid. This will set both of them to nil, because those are variables.. not strings.
    3. There's no definition of the ChannelSelect checkbox anywhere.. so I don't know what to look at.
  9. Hmm.. Well, I really am sorry for not making much sense. I am still learning this stuff. I am trying to write the code as I've seen it somewhere else, I apparently am not doing it right.. I hope the book will make it clear..

    Basically.. what I want to do is . . . When I click this button, I want it to toggle the reporting to either party or raid.

     function NQGambler_ChannelSelect() 
                     local channel = channelChoice
            if ChannelSelect:GetChecked() then
                channelChoice = Party
                SendChatMessage("[NQG] Enabled for Party Gambling!","channel");
            else
                channelChoice = Raid
                SendChatMessage("[NQG] Enabled for Raid Gambling!","channel");
                     end
     end
    

    My strings are under the function NQGamblerR_Report()

    which look like this:

    SendChatMessage(string,"RAID",GetDefaultLanguage("player"));

    And as you see, they're all set to raid. I want to make them either go to raid or party when I toggle the check box. OR ... Like Loothog does it, it is set to either send to say, party, or raid, dependant on how many are in the group, which I've tried coding, and failed miserably..

    My book should be here toward the end of the week.. I'm sure it will tell me how to do this stuff.

  10. Hmm.. Well, I really am sorry for not making much sense. I am still learning this stuff. I am trying to write the code as I've seen it somewhere else, I apparently am not doing it right.. I hope the book will make it clear..

    I understand, I'm just trying to help as much as I can.

    Basically.. what I want to do is . . . When I click this button, I want it to toggle the reporting to either party or raid.

    Yes, I understand that. You need a variable somewhere that will store the choice. You have half of that, but it's all not quite right.

     function NQGambler_ChannelSelect() 
                     local channel = channelChoice
          if ChannelSelect:GetChecked() then
              channelChoice = Party
              SendChatMessage("[NQG] Enabled for Party Gambling!","channel");
          else
              channelChoice = Raid
              SendChatMessage("[NQG] Enabled for Raid Gambling!","channel");
                     end
     end
    

    The exact same issues I listed above are here. In the code above channel, channelChoice, Party and Raid are all nil. This means your function does nothing, ever, other than print something to the client. What you probably want is something more like this:

     function NQGambler_ChannelSelect() 
         -- Set a default for the channel selection, if not set already
         if not NQGambler_ChannelChoice then
             NQGambler_ChannelChoice = "RAID"
         end
    
         if ChannelSelect:GetChecked() then
             NQGambler_ChannelChoice = "PARTY"
             SendChatMessage("[NQG] Enabled for Party Gambling!","channel");
         else
             NQGambler_ChannelChoice = "RAID"
             SendChatMessage("[NQG] Enabled for Raid Gambling!","channel");
         end
     end
    

    Now, elsewhere in your code you can examine NQGambler_ChannelChoice to actually send the message, i.e.

    SendChatMessage(string, NQGambler_ChannelChoice,GetDefaultLanguage("player"));

    You'll just need to make sure NQGambler_ChannelChoice has a default value in case the checkbox function is never called, which it may not be.

  11. Hey, I appreciate that help, but for some reason I still get: attempt to call a nil value

    Also, I went through and changed the channel that it was sending to, to NQGambler_ChannelChoice, and now, the buttons don't work..

    And again.. I'm getting these errors with it..

     3x <string>:"*:OnLoad":2: unexpected symbol near ''?
    

    and

     1x <string>:"*:OnClick":2: unexpected symbol near ''?
    

    I'm not sure what those errors are for, but, I loaded up an alt with JUST this mod running, and I got those errors.. I am so confused..

    http://pastey.net/136610 - This is my XML http://pastey.net/136611 - Here is my LUA again..

    I apparently can't seem to figure out why its causing this error.. Another thing, when I click the check box, it doesn't broadcast the SendChatMessage("[NQG] Enabled for Raid Gambling!","channel"); to any channel, neither party or raid.

  12. Hey, I appreciate that help, but for some reason I still get: attempt to call a nil value

    Also, I went through and changed the channel that it was sending to, to NQGambler_ChannelChoice, and now, the buttons don't work..

    And again.. I'm getting these errors with it..

     3x <string>:"*:OnLoad":2: unexpected symbol near ''?
    

    and

     1x <string>:"*:OnClick":2: unexpected symbol near ''?
    

    These error messages make no sense.. you can't have an unexpected symbol near.. nothing. They also don't give any information about where the errors are occurring. However, look at line 149 in your XML file.. what's going on there.

    I'm not sure what those errors are for, but, I loaded up an alt with JUST this mod running, and I got those errors.. I am so confused..

    The errors are IN your mod, so that shouldn't be a surprise at all.

    http://pastey.net/136610 - This is my XML http://pastey.net/136611 - Here is my LUA again..

    I apparently can't seem to figure out why its causing this error.. Another thing, when I click the check box, it doesn't broadcast the SendChatMessage("[NQG] Enabled for Raid Gambling!","channel"); to any channel, neither party or raid.

    This code is really quite completely all over the place. The variable names are incredibly confusing and very difficult to follow. Other than sitting down and just writing the code for you (something I don't have the time for) I'm not quite sure where to begin.

  13. Yeah, thats what I was afraid of hehe.. I should be getting the book tomorrow.. Then, I'll spend all weekend reading it, and hopefully grasp this stuff a bit better, and be able to fix it myself.