Quantcast
Delete cursor item not working correctly - WoWInterface
Thread Tools Display Modes
11-23-20, 08:07 PM   #1
Walkerbo
A Cliff Giant
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 73
Delete cursor item not working correctly

Hi all

I am the author of a small addon called Aardvark; the addon will auto destroy listed items when a vendor window is opened.

Since 90002 when I visit a vendor the destroy item messages print but the items themselves are not deleted; no matter how many times I close and reopen the vendor window the messages print about the items never leave my bags.
I can run the destroy function manually after I have already opened the vendor window and then the items are destroyed.

This is the error I get;
Lua Code:
  1. 1x [ADDON_ACTION_BLOCKED] AddOn 'Aardvark' tried to call the protected function 'UNKNOWN()'.
  2. [string "@!BugGrabber\BugGrabber.lua"]:519: in function <!BugGrabber\BugGrabber.lua:519>
  3. [string "=[C]"]: ?
  4. [string "=[C]"]: in function `DeleteCursorItem'
  5. [string "@Aardvark\Aardvark-AR 10.8.9.0.lua"]:2112: in function <Aardvark\Aardvark.lua:2084>
  6. [string "@Aardvark\Aardvark-AR 10.8.9.0.lua"]:2490: in function <Aardvark\Aardvark.lua:2482>

I cannot work out why I get the UNKNOWN() error, or why it works fine if the vendor window is already opened.

This is my destroy function which fires on the "MERCHANT_SHOW" event;
Lua Code:
  1. local function avkDestroy()
  2.     local destroyedItemCount = 0 -- Destroyed items counting variable
  3.     local destroyedSlotCount = 0
  4.     -- Destroyed slots counting variable
  5.     for destroyBag = 0, 4 do -- Check each bag
  6.         destroyBagSlot = GetContainerNumSlots(destroyBag)
  7.         for destroySlot = 0, destroyBagSlot do -- Check each bag slot
  8.             currentItemID = GetContainerItemID(destroyBag, destroySlot)
  9.             if currentItemID then -- If current bag slot has an item then get the item info
  10.                 local _, itemLink, _, _, _, _, _, _, _, _, itemValue = GetItemInfo(currentItemID)
  11.                 local _, itemCount, _, _, _, _, _, _ = GetContainerItemInfo(destroyBag, destroySlot)
  12.                 if
  13.                     checkItemOnGlobalProtectList(currentItemID) or
  14.                         checkItemOnCharacterProtectList(currentItemID) and itemValue == 0
  15.                  then
  16.                     if AVKGlobalSettings.Destroy.dddm and AVKGlobalSettings.Protect.pdpm then -- Print protected item
  17.                         if itemLink then
  18.                             print(" - Protected: " .. itemLink .. " not destroyed.")
  19.                         end
  20.                     end
  21.                 elseif checkItemOnGlobalDestroyList(currentItemID) or checkItemOnCharacterDestroyList(currentItemID) then
  22.                     destroyedItemCount = destroyedItemCount + itemCount
  23.                     destroyedSlotCount = destroyedSlotCount + 1
  24.                     -- If item Destroy messages are on print
  25.                     if AVKGlobalSettings.Destroy.dddm then -- Print each item destroyed
  26.                         print(" - Destroyed: " .. itemCount .. " " .. itemLink)
  27.                     end
  28.                     PickupContainerItem(destroyBag, destroySlot)
  29.                     DeleteCursorItem() -- Destroy current item
  30.                 end
  31.             end
  32.         end
  33.     end
  34.     if destroyedSlotCount ~= 0 then -- If items were destroyed print out total -- If no items destroyed print out bag space message
  35.         print(
  36.             ColourList.textBluePrefixSuffix ..
  37.                 ColourList.textRed ..
  38.                     "Items destroyed :-|r " ..
  39.                         destroyedItemCount .. ColourList.textRed .. "  ~  Bagslots cleared :-|r " .. destroyedSlotCount
  40.         )
  41.     elseif AVKGlobalSettings.Destroy.dntdm then
  42.         print(ColourList.textBluePrefixSuffix .. ColourList.textRed .. "Nothing destroyed. No bag space saved.")
  43.     end
  44. end

And here is my full code.

I am really stumped with this one, and I am looking for some help to get this going again.
__________________
"As someone once told me, frames are just special types of tables."
Fizzlemizz
  Reply With Quote
11-23-20, 10:22 PM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 529
9.0.2 has protected DeleteCursorItem(), it now requires a hardware event.

This is the error I get when Scrap tries to delete an item (reported by Swatter from the Auctioneer package):

"Warning: AddOn Scrap attempted to call a protected function (DeleteCursorItem()) which may require interaction."

BugGrabber is incorrectly reporting a hidden function within DeleteCursorItem. When you see UNKNOWN() in an error report, it's actually a function within the C code, which is not exposed ingame.

Last edited by Kanegasi : 11-23-20 at 10:24 PM.
  Reply With Quote
11-24-20, 03:59 AM   #3
Walkerbo
A Cliff Giant
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 73
Thanks for making me aware of this change.

Has this change got anything to do the crackdown on multiboxing?

I have a slash command that does run the function but I suppose that there is no way to automate that slash command.

Where is the forum where we can raise issues or questions to the wow api team?
__________________
"As someone once told me, frames are just special types of tables."
Fizzlemizz
  Reply With Quote
11-24-20, 06:40 PM   #4
Ketho
A Molten Giant
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 961
I actually reported it not being protected as a bug because it could delete literally everything

https://github.com/Stanzilla/WoWUIBugs/issues/13
  Reply With Quote
11-25-20, 04:42 AM   #5
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 529
I don't mean to be rude, but at some point, the convenience of addons should win over the inconvenience of someone blindly running a random script or installing a random weakaura.
  Reply With Quote
11-25-20, 10:53 PM   #6
Walkerbo
A Cliff Giant
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 73
Hi Ketho

I agree with Kanegasi, making this a protected function exacerbates the painful manual typing of "delete" for each and every item that cannot be sold.

It gets a bit much that we have to take such nanny state actions to prevent others from running random scripts.

If we end up creating rules based on the lowest IQ we will end up all wrapped in cotton wool.
__________________
"As someone once told me, frames are just special types of tables."
Fizzlemizz
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Delete cursor item not working correctly

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