WoWInterface (
-   Macro Help (
-   -   (Relatively) simple script help (

Baeldun 07-26-18 06:24 PM

(Relatively) simple script help
Hi all,

VERY knowledgeable forum here! Hoping you guys can help.

Link to post on official wow forums:

Text of that post here in case you don't want to click over:

Addon AutoVendor allows me to add/remove things from a list of 'safe to vendor' items. Anything on this list is automatically vendored for me.

To get items on this list is manual, by typing "/av junk " and then shift clicking the item, which adds the item name, and pressing enter.

Example "/av junk [Pygmy Oil]" will add it to the list.

One note is that you cannot simply TYPE the [Pygmy Oil], it must be an item link.

What I want is to create a macro where I can hover over the item, press the macro button, and have it type out the "/av junk " and link the item I'm hovered over.

I didn't get much help from that forum (Not sure why I thought I would), so I'm hoping you guys can assist.

Is what I want to do even possible?

Xrystal 07-26-18 07:52 PM

I'm not sure macros are capable of doing that. But, what you could do is contact the developer of the addon and see if they can add that feature in.

VincentSDSH 07-26-18 07:59 PM

I don't see why not. You'd just have to grab the itemlink from the tooltip (local itemName, ItemLink = GameTooltip:GetItem() ). If you know the call that occurs from the command line code you can write a tiny macro script to call it and pass in the item link.

Edit: Nope, you can't. The AV:ToggleJunk() function contains the below line, which could be formed to pass in item name and itemid from gametooltip:getitem()...
Lua Code:
  1. listToggle(self.db.profile.junk, 'junk list', itemId, itemName)

...however, listToggle is a local function, so you can't call it from a /script macro.
Lua Code:
  1. local function listToggle(list, listName, itemId, itemName)

You'll have to contact the author to have them add the function, or you could a function yourself to your local copy of the code.

This might work. It's dry-coded (I can't test it atm) but it might work. Your macro should look like: /script AV:ToggleJunkFromTooltip()
Lua Code:
  1. function AV:ToggleJunkFromTooltip()
  2.     local itemName, ItemLink = GameTooltip:GetItem()
  3.     if itemLink then
  4.         local itemId = tonumber(strmatch(msg, "item:(%d+)"))
  5.         listToggle(self.db.profile.junk, 'junk list', itemId, itemName)
  6.     end
  7. end

Baeldun 07-26-18 08:45 PM

Thanks for the responses guys.

Although not the answers I was hoping for, it's nice to know and not be in the dark.

VincentSDSH 07-26-18 09:01 PM

That bit of code I put up, you can edit the file yourself and just paste that is on the end, then put the /script snippet into a macro and you have the functionality you wanted, even if the author has absconded to count the fjords instead if updating the addon.

All times are GMT -6. The time now is 11:31 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI