Thread Tools Display Modes
08-07-24, 03:17 AM   #1
LuaLoler
A Kobold Labourer
Join Date: Aug 2024
Posts: 1
LUA equip gear and use item in bag Classic SoD

Is it possible to scan the bags for item X and equip it (if item is BoE you need to click accept on this item will be bound to you if equipped)?

I have managed to equip a white item in bag.

I have an issue where I want to use an item in my bag (an item that learns a rune). However it seems like Blizz has restricted the action of using an item through a LUA function. The workaround is to create a macro with /use itemID.

However the only way to activate this macro is to manually click it. I'm wondering if there is a workaround for this?

I want the LUA script to:

1. Equip hands if they exists in bag
2. Learn (use) item that learns the rune if it exists in bag
3. Enchant hands with the newly learned rune


I have gotten halfway but I'm hard stuck on 2 and 3... Wondering if anyone experienced knows if this is possible to achieve


Thanks =)
  Reply With Quote
08-08-24, 09:19 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,358
Doing each individual action separately is easy, but stringing them together in a single action my not be possible as each step, if not involving a protected function, requires a hardware event (user action like clicking a button or keypress).

Back when I played first phase of SoD, I settled on modifying the rune system so you click a rune and it automatically applies, skipping clicking on the equipment slot and confirmation.
Lua Code:
  1. if C_Engraving then
  2.     hooksecurefunc(C_Engraving,"CastRune",function()
  3.         local rune=C_Engraving.GetCurrentRuneCast();
  4.         if rune and SpellCanTargetItem() then
  5.             PickupInventoryItem(rune.equipmentSlot);
  6.             if StaticPopup_FindVisible("BIND_ENCHANT") then
  7.                 BindEnchant();
  8.                 StaticPopup_Hide("BIND_ENCHANT");
  9.             elseif StaticPopup_FindVisible("REPLACE_ENCHANT") then
  10.                 ReplaceEnchant();
  11.                 StaticPopup_Hide("REPLACE_ENCHANT");
  12.             end
  13.         end
  14.     end);
  15. end

This is safe to run on non-SoD servers as it'll just skip everything.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » LUA equip gear and use item in bag Classic SoD


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