Thread Tools Display Modes
07-26-18, 06:24 PM   #1
Baeldun
A Defias Bandit
Join Date: Jul 2018
Posts: 2
Question (Relatively) simple script help

Hi all,

VERY knowledgeable forum here! Hoping you guys can help.

Link to post on official wow forums:https://us.battle.net/forums/en/wow/...?page=1#post-3

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?
  Reply With Quote
07-26-18, 07:52 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
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.
__________________
  Reply With Quote
07-26-18, 07:59 PM   #3
VincentSDSH
Non-Canadian Luzer!
 
VincentSDSH's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 350
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.

Edit2:
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
__________________
AddonsExecutive Assistant User Configurable To-Do ListLegible Mail Choose the Font for Your Mail

Last edited by VincentSDSH : 07-26-18 at 08:11 PM.
  Reply With Quote
07-26-18, 08:45 PM   #4
Baeldun
A Defias Bandit
Join Date: Jul 2018
Posts: 2
Thanks for the responses guys.

Although not the answers I was hoping for, it's nice to know and not be in the dark.
  Reply With Quote
07-26-18, 09:01 PM   #5
VincentSDSH
Non-Canadian Luzer!
 
VincentSDSH's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2006
Posts: 350
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.
__________________
AddonsExecutive Assistant User Configurable To-Do ListLegible Mail Choose the Font for Your Mail
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Macro Help » (Relatively) simple script help

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