Page 1 of 2

Help with a macro

PostPosted: Wed Sep 16, 2015 12:54 am
by FlashyBR
Hey guys, I trying to make a macro to my paladin that do this:

Start attack > Use Seal of Righteousness > Use Judgement > Use Seal of the Crusader


At the moment the macro is it:

Code: Select all
/script AttackTarget(); i=1 if (i == 1 ) then CastSpellByName("Seal of Righteousness") i=i+1; else if (i == 2) then CastSpellByName("Judgement") i=i+1; else if (i == 3) then CastSpellByName("Seal of the Crusader") i=1; end; end



But it not working =(

Please can somebody help me make this macro ? If possible adding something that will only use the spell if it's not on cooldown ?

Re: Help with a macro

PostPosted: Wed Sep 16, 2015 2:49 am
by FlashyBR
bump

Re: Help with a macro

PostPosted: Wed Sep 16, 2015 7:27 am
by LYQ
on every macro call you reset the value of i to 1. That's the main issue here, I suggest using another variable name though since i is the standarf index varName for most loops and maybe it could cause anywhere problems.

try something like

/run AttackTarget() if varName == nil then varName = 1 end -- your code following to that

I'm always using /run since it takes less characters fyi, you can still use script

if varName == nil then varName = 1 end means that varName wasn't setup before and therefore it will set it to 1 - this will only be called on the first time.
if you want to reset this rotation you would have to make the variable = nil again afterwards, but you will never be able to make a proper castsequence macro if this was your idea.

btw: I didn't look at the rest of the macro, change your macro index and if you have more problems say exactly what's going wrong and what should happen instead

Re: Help with a macro

PostPosted: Wed Sep 16, 2015 1:59 pm
by FlashyBR
Hmmm, i understand, ill edit the macro using this.

but you will never be able to make a proper castsequence macro if this was your idea.


But how i can do a macro to do that castsequence ?

Re: Help with a macro

PostPosted: Wed Sep 16, 2015 2:25 pm
by LYQ
what I meant with that quoted sentence is, you can't make a castsequence macro working 100% perfect in vanilla since you don't have all the ressources(API functions) to consider every situation in which you are using this macro.

eg.
if you make such a simple macro by simply counting up like yours

if you press the macro but you are not in range it will still count up
it you press the macro but the spell is still on cooldown it will still count up
if it has no cooldown but you don't have enough mana/rage it will count up

and so on.

if you look it up some of my mentioned situations will be counterable, but certainly not all of them.
I've looked into this few years ago and I stopped with this conclusion, so I can't remember which situations you can check and which not but I can remember that some of them were simply not doable.
but if I'm wrong feel free to deliver a perfect working castsequence and correct me

Re: Help with a macro

PostPosted: Wed Sep 16, 2015 2:30 pm
by FlashyBR
Hmm, understand, but i can make a not 100% castsequence that way with your corrections ?

Re: Help with a macro

PostPosted: Wed Sep 16, 2015 2:42 pm
by FlashyBR
I make the new macro:

Code: Select all
/run AttackTarget() if varName == nil then varName = 1 end
/run if (varName == 1 ) then CastSpellByName("Seal of Righteousness") varName=varName+1; else if (varName == 2) then CastSpellByName("Judgement") varName=varName+1; else if (varName == 3) then CastSpellByName("Seal of the Crusader") varName = nil; end; end



But it show a error:

Image


Please, can you help me, if the macro dont count the cooldown, i want to test it anyway.

Re: Help with a macro

PostPosted: Wed Sep 16, 2015 3:08 pm
by LYQ
yeah sure that would work

try that

/run AttackTarget() if ind == nil then ind=1 end if (ind==1) then CastSpellByName("Seal of Righteousness") ind=ind+1 elseif (ind==2) then CastSpellByName("Judgement") ind=ind+1 elseif (ind==3) then CastSpellByName("Seal of the Crusader") ind=1 end

I corrected another error you were making
there is a difference between "elseif" and "else if"

eg.

if something then
-- it's something
elseif somethingelse then
-- it's somethingelse, it can not be something
else
-- it's something completely other
-- if not something or somethingelse this code will always run
if somethingelseelse then
-- it's not something, not somethingelse but it's somethingelseelse :D
end
end
if you get what I mean with that (wanna be-)simple example.

liong story short: you were using "else if" but you meant "elseif"
:D

Re: Help with a macro

PostPosted: Wed Sep 16, 2015 3:12 pm
by Coreborn
There is a better way than using macros for castsequenses.
http://wow.curseforge.com/addons/project-254/

Re: Help with a macro

PostPosted: Wed Sep 16, 2015 3:22 pm
by FlashyBR
LYQ wrote:yeah sure that would work

try that

/run AttackTarget() if ind == nil then ind=1 end if (ind==1) then CastSpellByName("Seal of Righteousness") ind=ind+1 elseif (ind==2) then CastSpellByName("Judgement") ind=ind+1 elseif (ind==3) then CastSpellByName("Seal of the Crusader") ind=1 end

I corrected another error you were making
there is a difference between "elseif" and "else if"

eg.

if something then
-- it's something
elseif somethingelse then
-- it's somethingelse, it can not be something
else
-- it's something completely other
-- if not something or somethingelse this code will always run
if somethingelseelse then
-- it's not something, not somethingelse but it's somethingelseelse :D
end
end
if you get what I mean with that (wanna be-)simple example.

liong story short: you were using "else if" but you meant "elseif"
:D



Yes i understand, to tell the truth im web developer, but i see the syntax on wowwikia and there was else if separated :P

Thank for your help, ill modify with your code :mrgreen: