Thread Tools Display Modes
07-10-08, 12:22 PM   #1
Inviticus
A Murloc Raider
Join Date: Jul 2008
Posts: 7
Help with first mod

Hi. I'm trying to create my first addon; basically just a function that designates certain castsequences according to the class of my target. I'm new to this, though. I'd just like to know how to go about making this useable in-game.
Any help would be appreciated.

Code:
local TotemByTarget = {}

function TotemByTarget:SetUp()	local targetClass = UnitClass("target")	/castsequence reset=4, cseq.(targetClass)[1], cseq.(targetClass)[2], cseq.(targetClass)[3], cseq.(targetClass)[4];end


local PCT = "Poison Cleansing Totem"
local HST = "Healing Stream Totem"
local ST = "Searing Totem"
local MT = "Magma Totem"
local GT = "Grounding Totem"
local TT = "Tremor Totem"
local NRT = "Nature Resistance Totem"
local FrRT = "Frost Resistance Totem"
local FiRT = "Fire Resistance Totem"
local SST = "Stoneskin Totem"
local ET = "Earthbind Totem"
local WT = "Wrath of Air Totem"

local cseq = {}
cseq.Rogue = [PCT,MT,ET,WT]
cseq.Shaman = [GT,NRT,ST,SST]
cseq.Mage = [GT,FiRT,ET,HST]
cseq.Warlock = [TT,GT,HST,ST]
cseq.Warrior = [ET,MT,HST,ST]
cseq.Druid = [SST,HT,ST,WT]
cseq.Hunter = [PCT,HST,ST,ET]
cseq.Paladin = [WT,ET,HST,ST]


Like I said, I'm new to this. I understand I've probably made some mistakes in the script as well.

To clarify, I'd like to be able to access this function with a macro.
  Reply With Quote
07-10-08, 02:12 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
First of all, you cannot use slash commands like /castsequence in an addon. Second of all, you will not be able to do what you wish to accomplish based on the limitations of the client, secure actions in combat, and Blizzard's stance of UI not AI (meaning, addons can't select what you do, merely inform you on what you should do).

Best you could get is an addon highlighting certain buttons on your screen depending on the class of your target, I think.

Someone with more knowledge than I should be through here shortly, though.
__________________
"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
07-10-08, 02:23 PM   #3
Inviticus
A Murloc Raider
Join Date: Jul 2008
Posts: 7
Ah. I wasn't aware of that. Thank you for the information.

I do like the idea of highlighting actionbar buttons, if someone wouldn't mind helping me get started.

Last edited by Inviticus : 07-10-08 at 02:26 PM.
  Reply With Quote
07-10-08, 04:58 PM   #4
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
Hmm... I don't understand why Blizzard would block something like that. All it is doing is finding the current target and changing the macro according to that. I know IHML changes its button based on SubZone. (And it's a macro-based addon.)

The only other thing close to this is making a macro for each class. And maybe you can find an addon that slides out, but only shows the last used button (like Autobar) and put the macros in there.

EDIT: For an addon suggestion based on the description above, look at Poppins.

Hope this helps.
__________________
Never be satisfied with satisfactory.

Last edited by Cralor : 07-10-08 at 05:00 PM.
  Reply With Quote
07-10-08, 05:53 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by Cralor View Post
Hmm... I don't understand why Blizzard would block something like that. All it is doing is finding the current target and changing the macro according to that. I know IHML changes its button based on SubZone. (And it's a macro-based addon.)
UI not AI. IHML does not update its macro in combat, either.
__________________
"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

WoWInterface » Developer Discussions » Lua/XML Help » Help with first mod

Thread Tools
Display Modes

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