• 1 page(s)
Help with AddOn Coding

I've been working on an AddOn to switch between Find Herbs and Find Minerals (It's my first AddOn and I'm lazy), but I'm not sure how to automatically disengage the switching during a battle, which is rather annoying.  The reason I can't is because I'm not sure how the AddOn would realize that I'm in combat.  Can anyone help?

Also, it would seems that there are no real guides to programming simple addons, or at least to the language involved.  Does anyone have a small guide?

Thanks.

Report this thread post

Not a programmer but maybe InCombatLockdown() will help.

Moderator, Curse.com

This thread and this thread will answer most addon troubles.

Report this thread post

What you want is a macro.

Code:
/cast Find Herbs

/cast Find Minerals

Link for guide: http://www.wowwiki.com/Portal:Interface_customization

You would also benefit from the book World of Warcraft Programming by James Whitehead II and Matthew Orlando. I found it at my local Chapters, but you can order it from Amazon.

Project Lead for SmartRes and MrBigglesworthDeath. SmartRes2 coming soon!

 

Report this thread post

  Quote:
Originally Posted by camealion Go to post by >camealion

Not a programmer but maybe InCombatLockdown() will help.

I'll try it, and let you know if it works.  I'm still kinda new, so does it need a function or script tag?

  Quote:
Originally Posted by myrroddin Go to post by >myrroddin

What you want is a macro.

 

Code:
/cast Find Herbs

/cast Find Minerals


 

 

Link for guide: http://www.wowwiki.com/Portal:Interface_customization

You would also benefit from the book World of Warcraft Programming by James Whitehead II and Matthew Orlando. I found it at my local Chapters, but you can order it from Amazon.

The thing is, I want it to automatically switch. Like I said, I'm lazy, and also I want the practice for writing AddOns.  You have to start somewhere, right?

 

Edit in: I checked that guide, and couldn't find anything that was going to teach much of the language.  It is a good help for a first step, though.


[edited by: MasterCaura at 9:15 PM (GMT -6) on 29 Jun 2009]

Report this thread post

Well, first off, you can't automatically do anything with an addon. That kind of functionality was blocked waaaaay back with patch 1.10, long before even Burning Crusade. You must have some user input, whether it is a key or keys being pushed or a mouse button clicked. However, you can get an addon to fire a macro. That's a bit complex to write here, so again, I will point you to the book I mentioned, which teaches you pretty much everything you need to know.

That said, in order to detect if you are in combat, you would want

Code:
function MyAddon:CheckingForCombat()

    self:RegisterEvent("PLAYER_REGEN_ENABLED") -- normal engergy gains like Mana and especially Health only occur outside of combat

    self:RegisterEvent("PLAYER_REGEN_DISABLED") -- Health regen is disabled during combat. best way to check for combat, really

    if event == "PLAYER_REGEN_DISABLED" then

        -- do stuff while in combat

   else

       --- do stuff out of combat

    end

end


[edited by: myrroddin at 10:00 PM (GMT -6) on 29 Jun 2009]

Project Lead for SmartRes and MrBigglesworthDeath. SmartRes2 coming soon!

 

Report this thread post

Well, by auto, I mean more that it's on a timer, so... that's not technically barred, as I recall.

Thanks for the 'battle-realizor' though.  It really helped.

Report this thread post

Timers are barred... as it makes things automated which are blocked...

Report this thread post
  • 1 page(s)
Subscribe to this thread: (you will receive emails when new posts are made)