Page 7 of 7 FirstFirst ...
5
6
7
  1. #121
    Anyone able to tell me why this isnt working?

    Code:
    local AutoSheathAfterCombat_EventFrame = CreateFrame("Frame")
    AutoSheathAfterCombat_EventFrame:RegisterEvent("PLAYER_LEAVE_COMBAT")
    AutoSheathAfterCombat_EventFrame:SetScript("OnEvent",
    	function(self, event, ...)
    		if (GetSheathState() ~= 0) then
    			ToggleSheath()
    		end
    	end
    end)

  2. #122
    Quote Originally Posted by kiingy View Post
    Anyone able to tell me why this isnt working?

    Code:
    local AutoSheathAfterCombat_EventFrame = CreateFrame("Frame")
    AutoSheathAfterCombat_EventFrame:RegisterEvent("PLAYER_LEAVE_COMBAT")
    AutoSheathAfterCombat_EventFrame:SetScript("OnEvent",
    	function(self, event, ...)
    		if (GetSheathState() ~= 0) then
    			ToggleSheath()
    		end
    	end
    end)
    Two things:

    1) PLAYER_ENTERING_COMBAT and PLAYER_LEAVING_COMBAT are not actually combat flags. They only fire based on your auto attack, so you can enter combat lockdown and not get the ENTERING event or leave combat and never get the LEAVING event. Use PLAYER_REGEN_ENABLED for a "leaving combat" event.

    2) GetSheathState() is not binary and returns weapon type, not actual sheath state. If the documentation I read is correct, it shouldn't return 0. It returns 1, 2, or 3 based on what weapon is unsheathed. 1=none, 2=melee, and 3=ranged. So, if GetSheathState() ~= 1 then should work assuming "none" means sheathed and not "no weapon type".

    I am unable to test at the moment, but you can see what it returns ingame by typing /run print(GetSheathState()) and a number will print to your chat window. Throw that in a macro and toggle your combat with a training dummy or use the sheathe key to see what it prints.

    Edit: I thought about this a little more and have a theory. I'm fairly confident that 1 really means sheathed, 2 means whatever is in your mainhand or both hands, and 3 means your wand, bow, or gun. Since the change to that ranged slot in MoP, GetSheathState() should never return 3. I remember when playing a Mage or Hunter that pressing the sheathe key would unsheathe the main weapon (1 -> 2), pressing again would switch to wand/bow/gun (2 -> 3), and a third press back to sheathed (3 -> 1).
    Last edited by Kanegasi; 2016-04-17 at 09:48 PM.
    Originally Posted by Zarhym (Blue Tracker)
    this thread is a waste of internet

  3. #123
    You were right in that it doesn't ever return 3; 1 is sheathed, 2 is unsheathed.

    I have switched the event to PLAYER_REGEN_ENABLED, still doesn't work though.

  4. #124
    Quote Originally Posted by kiingy View Post
    You were right in that it doesn't ever return 3; 1 is sheathed, 2 is unsheathed.

    I have switched the event to PLAYER_REGEN_ENABLED, still doesn't work though.
    I ran the script through a simple lua checker in my Notepad++. You have one more end than you need, I missed that. Only the "function" and the "if" need an end, not the SetScript. The code should now look like this:

    Code:
    local AutoSheathAfterCombat_EventFrame = CreateFrame("Frame")
    AutoSheathAfterCombat_EventFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
    AutoSheathAfterCombat_EventFrame:SetScript("OnEvent",
    	function(self, event, ...)
    		if (GetSheathState() ~= 1) then
    			ToggleSheath()
    		end
    	end)
    Originally Posted by Zarhym (Blue Tracker)
    this thread is a waste of internet

  5. #125
    Yep, that works now.

    If you're still around though, whats the best way to register multiple events? At the moment I'm just adding a new line:

    Blah_EventFrame:RegisterEvent("New event here")

    while it's fine for two but once you start watching for multiple events it gets messy.

    Also what lua checker did you use with Notepad++?
    Last edited by Kiingy; 2016-04-18 at 10:56 AM.

  6. #126
    Quote Originally Posted by kiingy View Post
    whats the best way to register multiple events? At the moment I'm just adding a new line:

    Blah_EventFrame:RegisterEvent("New event here")

    while it's fine for two but once you start watching for multiple events it gets messy.
    That's the only way you can register for events, so if your addon is watching several events, you are going to have a block of RegisterEvent lines.

    Quote Originally Posted by kiingy View Post
    Also what lua checker did you use with Notepad++?
    It's been a while since I set it up, so the details are hazy. Make sure you have NppExec installed (Plugins -> Plugin Manager) and go here to install a "FindGlobals" script, which will highlight all your globals with the added benefit of a basic error checker. Make sure you read the comments for Notepad++ specific stuff.
    Originally Posted by Zarhym (Blue Tracker)
    this thread is a waste of internet

  7. #127
    Deleted
    So been trying to find out how to make a UI addon for me to use on my Youtube channel so i have a custom UI still not sure how to make one and if there is someone out there that can help me make one for me that would be lovely

  8. #128
    Quote Originally Posted by Panthegaming View Post
    So been trying to find out how to make a UI addon for me to use on my Youtube channel so i have a custom UI still not sure how to make one and if there is someone out there that can help me make one for me that would be lovely
    You need to be a lot more specific.
    "UI addon" can describe quite a lot.
    Is there any particular information you are trying to relay to your audience.
    Are you looking to theme around, or to advertise your channel or a guild etc with some graphics.

    As you can't give us links yet, then tell us the platform and name of a streamer who has examples of what you want.
    Names or dates the videos too.
    Last edited by ComputerNerd; 2018-02-05 at 06:53 PM.
    Quote Originally Posted by DeadmanWalking View Post
    Your forgot to include the part where we blame casuals for everything because blizzard is catering to casuals when casuals got jack squat for new content the entire expansion, like new dungeons and scenarios.
    Quote Originally Posted by Reinaerd View Post
    T'is good to see there are still people valiantly putting the "Ass" in assumption.

  9. #129
    Deleted
    Quote Originally Posted by ComputerNerd View Post
    You need to be a lot more specific.
    "UI addon" can describe quite a lot.
    Is there any particular information you are trying to relay to your audience.
    Are you looking to theme around, or to advertise your channel or a guild etc with some graphics.

    As you can't give us links yet, then tell us the platform and name of a streamer who has examples of what you want.
    Names or dates the videos too.
    Sure i can and what i mean is more like redoing the whole ui so like elvui does but for a custom one with a theme in mind and the theme is Panther's and ike on the Corner of the box for when you close it i would like a Claws shred on it and as of right now i can show you my ui

  10. #130
    Deleted
    Quote Originally Posted by ComputerNerd View Post
    You need to be a lot more specific.
    "UI addon" can describe quite a lot.
    Is there any particular information you are trying to relay to your audience.
    Are you looking to theme around, or to advertise your channel or a guild etc with some graphics.

    As you can't give us links yet, then tell us the platform and name of a streamer who has examples of what you want.
    Names or dates the videos too.

    Sure i can and what i mean is more like redoing the whole ui so like elvui does but for a custom one with a theme in mind and the theme is Panther's and ike on the Corner of the box for when you close it i would like a Claws shred on it and as of right now i can show you my ui

  11. #131

    Online Writing Services All Around The World

    Assignment Writers UAE is providing online services all around the world. They provide cheap assignment help and offer writing services all over UAE, especially Dubai, Sharjah, and Abu Dhabi. If you are a student and facing problems in writing assignments on your own, then the best option to get an online writing service at a low cost is assignmentwriter.ae

  12. #132
    Thank for that

    Quote Originally Posted by Tangent View Post
    Theres a Visual studio based wow addon creator called "Addon Studio". It lets you create the windows and menus in a visual way such as with visual basic and similar languages. Has all Lua built in to it for help with auto correction and things like that. Auto generates TOC and things like that I believe also.
    Oh good to know thank

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •