LiteAssist

2 - Implement a second macro

LiteAssist does what I need, but I'm curious to learn if it's possible to leverage it to do a little more.

I have a shadow priest, and I would like to mind sear using the assisted person.  The action would look like:

  /cast [@{LiteAssistUnit}] Mind Sear

I could create LiteAssistMacro to implement this, but I don't want to replace the default assist functionality.  I'd want to cast this spell but not change my targetting in any way.  Is there a way?

---

Right now LiteAssist copies LiteAssistMacro and internally replaces {LiteAssistUnit} with the unit name.

One idea is for LiteAssist to _edit_ a macro like LiteAssistMacro2.

The most blunt way that solves my particular problem is for a two-line macro to be created by the user:

  -- /cast [@{LiteAssistUnit}] Mind Sear
  /cast [@{LiteAssistUnit}] Mind Sear

LiteAssist can understand that the top line is for its internal use, and the second line can be deleted/overwritten.  So if I use LiteAssist on a player called PlayerFoo, the above macro would be edited to become:

  -- /cast [@{LiteAssistUnit}] Mind Sear
  /cast [@PlayerFoo] Mind Sear

---

The reason I suggest this for LiteAssist is that it does everything else perfectly - the hotkeys to select/deselect a target, doing the appropriate thing when in combat, setting things out of combat.

However, if this functionality is not appropriate for your AddOn, then perhaps I could write functionality like this.  I'm a pretty new programmer though.  How would I get access to the variable {LiteAssistUnit} ?

---

An alternate idea is for LiteAssist to simply implement a second hidden macro and use it in exactly the same manner as it does now.  The hidden macro would be copied internally and edited like it does with LiteAssistMacro.  Existing set/unset hotkeys would apply to that second macro, but a separate activation hotkey would exist.

This would work, but it isn't optimal for me since I'd rather have something clickable on my bars (with a hotkey) than just a hotkey (with nothing visible).

Oh!  Maybe it would work, if there were /LiteAssistDo2 .. then I could make a macro for that.

User When Change
Xodiv Aug 27, 2012 at 09:30 UTC
Xodiv Oct 31, 2011 at 06:15 UTC
spiralofhope Oct 28, 2011 at 14:07 UTC
Xodiv Oct 20, 2011 at 00:58 UTC
Xodiv Oct 20, 2011 at 00:28 UTC
spiralofhope Oct 19, 2011 at 18:24 UTC Changed description:
  An alternate idea is for LiteAssist to simply implement a second hidden macro and use it in exactly the same manner as it does now.  The hidden macro would be copied internally and edited like it does with LiteAssistMacro.  Existing set/unset hotkeys would apply to that second macro, but a separate activation hotkey would exist.

  This would work, but it isn't optimal for me since I'd rather have something clickable on my bars (with a hotkey) than just a hotkey (with nothing visible).
+
+ Oh!  Maybe it would work, if there were /LiteAssistDo2 .. then I could make a macro for that.
spiralofhope Oct 19, 2011 at 18:20 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

  • 4 comments
  • Avatar of Xodiv Xodiv Oct 31, 2011 at 06:07 UTC - 0 likes

    That all sounds pretty good, well done on coming up with a smart solution!

    I do see a potential problem with your solution though, which is that you're most likely to use your assist macro in combat, and you can't edit macros in combat so your devpad script won't work. I don't know it might even throw an error, which would be super annoying, but most likely devpad just exits if it detects the UI combat lockdown is active.

    If possible you would be better to use the LiteAssist_RegisterCallback(fn) facility. It definitely works because without it LiteAssistBroker wouldn't be updating in my Titan Panel, and it is.

    I haven't used DevPad, although now I'm definitely going to try it because it seems a lot better than WoWLua which I have been using for in-game tinkering. I suspect the problem is that your function is only valid inside the DevPad environment, but I don't really know for sure.

    As a very basic test you can do something like this:

    LiteAssist_RegisterCallback(function (name) message("LA Callback " .. name) end)

    which registers an anonymous inline function to be called. Then if you learn a new assist you should see a popup box show you the text including the LiteAssistUnit name. (Unfortunately the only way to remove this anonymous registration is to reloadui.)

    Another possible reason is that if you are relying on your DevPad script being run at login or reloadui time and doing the register, then it's likely that LiteAssist hasn't been loaded yet (I think it does them in alphabetical order and _DevPad is before LiteAssist).

    I only had a quick look at DevPad but you might be able to do something like this:

    LiteAssist_RegisterCallback(function () DevPad.SafeCall("dp_script_name") end)

  • Avatar of spiralofhope spiralofhope Oct 30, 2011 at 01:44 UTC - 0 likes

    I did it!

    I made a LiteAssistMacro, and inside it, it does the regular /assist {LiteAssistUnit} and I also had it summon up a script in DevPad.

    That DevPad script takes a source macro and edits it into a target macro.

    That target macro gets dropped on my action bar.

    Now I assist as usual, and I'll have that other macro updated. I could leverage this to have any number of macros edited. I don't even have to use a source macro if I don't want.

  • Avatar of spiralofhope spiralofhope Oct 28, 2011 at 14:07 UTC - 0 likes

    @Xodiv: Go

    I apologize for the late reply. Curseforge failed to implement a proper ticket notification system. Pathetic.

    With {LiteAssistUnit} in mind, I did note that I could create a workaround macro which could understand [mod:alt] and the like. It does work, and that would have been my solution.

    However, I was in mood to hack.

    First, I learned how to read and write to macros. I created source and a target macros, and was able to read from the source, do a search/replace and write to the target macro.

    I poked around your code, and found LiteAssist_GetAssistName() .. thanks for implementing that!

    Now I can create the two macros (LiteAssistSource and LiteAssistTarget), and in the source macro I can have

    /cast [@{LiteAssistUnit}] Mind Sear
    

    My code will do a quick edit of the other macro, which I can drop into my toolbar and use like a regular macro.

    I'm taking a short break, then I'll do some thinking as to how I'll actually run my code to do this update.

    [edit]

    It seems like LiteAssist_RegisterCallback(fn) would be what I want, but my function isn't run called when I set a new assist with LiteAssist.

    Last edited Oct 28, 2011 by spiralofhope
  • Avatar of Xodiv Xodiv Oct 20, 2011 at 00:56 UTC - 0 likes

    I think (not in front of WoW at the moment so I can't test it) than you can do what you want with just one LiteAssistMacro and WoWs ability to do different things on alternate (in our case synthetic) mousebutton clicks.

    For the LiteAssistMacro:

     /assist [button:1] {LiteAssistUnit}
     /cast [button:2,@{LiteAssistUnit}] Mind Sear
    

    Then a macro for the assist-targeted Mind Sear would be:

     #showtooltip Mind Sear
     /click LiteAssistDo RightButton
    

    I might need to make a change to the code for this to work. You can do it yourself to test if you like. In the file LiteAssist.lua change the line that says:

     LiteAssistDo:RegisterForClicks("LeftButtonDown")
    

    to

     LiteAssistDo:RegisterForClicks("AnyDown")
    
  • 4 comments

Facts

Last updated
Aug 27, 2012
Reported
Oct 19, 2011
Status
Declined - We decided not to take action on this ticket.
Type
Enhancement - A change which is intended to better the project in some way
Priority
Medium - Normal priority.
Votes
0

Reported by

Possible assignees