Log in

View Full Version : Anyone good with /script?



Kel
10-30-2008, 07:11 AM
I'm working on a new duo team and trying to get a macro sorted so that I can change who my alt assists without needed to take up focus (or possibly even targeting). Trouble is I'm not very good with the /script command and can't understand what the different parts of it mean. So I'm hoping someone here knows more about it than me and can shed a little light on how I can do what I want to do, or if it's just not possible.

What I want to do:
I'd like to have a set-up so that my main character can be used for healing (preferably with being able to target firendly players in order to do so) and my alt will attack her current target, or assist a group member other than myself to get a new target. Trouble is that group member might not always be the same character (or in the same group slot) and so I'd need to add the character name into my targeting/assist macro (which I could do manually, but that takes more effort...).

What I have so far:
I've managed to make two macros, one is the scrip and modifies part of the other macro, which is the targeting macro. I stole this from somewhere else, so I don't really know why it does what it does.

First macro (pick my target)
/script EditMacro(GetMacroIndexByName("Assist"),"Assist", nil,"/assist "..UnitName("target"), 1)

Second macro (assist)
/assist <name of target when I clicked first macro is inserted here>

This works, and I could probably make a workable assist for my alt with it. But what I'd really like to do is have the second macro do more than just assist, for example I'd like to make the second macro something like:
/cast [target=<name from script in first macro>,help] Rejuvenation

However, the /script macro won't seem to let me add anything after the ..UnitName("target") part and have it included in the macro. I'm not sure if that's because I'm not entering it correctly, or because it's just not possible.

Any help would be appreciated.

Tynk
10-30-2008, 08:29 AM
First I need to say thank you, that is a very nice script you have there, had not even thought about doing it that way.

So, lets start with breaking it down. More information on this function can be found at Wowwiki
EditMacro ('http://www.wowwiki.com/API_EditMacro')(index, "name", iconIndex, "body", isLocal, perCharacter)

While this function is "editing" the macro, it looks as though it is actually writing the macro.
So you will need to change the below part of it to your full macro.

"/assist "..UnitName("target")

Try something like this.



/script EditMacro(GetMacroIndexByName("Assist"),"Assist", nil,"/cast [target=" ..UnitName("target")",help] Rejuvenation", 1)


This should do what ya need. If you want to change the macro name you could change the "Assist" to what ever macro you want.

Kel
10-30-2008, 09:21 AM
Thanks for the fast response :)

I think I tried something similar to that yesterday (though I wasn't really thinking logically about it, so it may not have been exactly that change) and broke the macro.

I think the problem is the ",help" as it probablly thinks that is specifying the isLocal part (though I'm sure I tried it with just ] too with no luck).

I'm thinking of trying something along the lines of the following when I get home, but I have no idea if it will work any better (as this is mashed from one fore chat messages).

/run a="/cast [target=" b=UnitName("target") c=",help] Rejuvenation" EditMacro(GetMacroIndexByName("Rejuv"),"Rejuv", nil,"a..""..b..""..c", 1, 1)

But the chat one has the variables in brackets, so it would be ("a..""..b..""..c), as this function needs the body part to be in " anyway I'm not sure how it will handle that. Possible double-double quotes would work, but I doubt it as I think it would just take the first pair to be empty.

Anyway, I'll play around some more when/if I get time tonight, until then feel free to add any advice :)

Tynk
10-30-2008, 10:39 AM
the " used in the macro designates that a string is enclosed and should be passed as is. So the way you have it written, the macro would look exactly like this...
Macro Name: Rejuv
Macro Body: a....b....c

and would function as /say a....b....c