View Single Post
02/26/23, 12:10 PM   #9
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 277
Originally Posted by ExoY View Post
I just copied your snipped and it does what it is supposed to do. provided slot id of full soul gems.
(Doesnt differentiate between crown and normal though)

Anyhow. Firstly, you again have a global variable leakage with gemId, which is not good practise. Try to always remember to make those variables local.

Secondly, if something isnt working, I dont recommend just putting debug messages anywhere. Properly pin point the problem by testing each function in its most simplest way, e.g. with chat script to make sure you use them correctly etc....
so this is working for main hand but if i change "EQUIP_SLOT_MAIN_HAND" back to "weapon" which is directly from the function calling this code it doesnt work. but this does work for main hand:

Code:
function RidinDirty.GetGems(slotId)
	for slotId = 0, GetBagSize(BAG_BACKPACK) do
		if IsItemSoulGem(SOUL_GEM_TYPE_FILLED, BAG_BACKPACK, slotId) then
			--local gemSlot = slotId
			df("found gems %s", slotId) -- <<<<<< returning 0 to chat instead of the slot #
			ChargeItemWithSoulGem(BAG_WORN, EQUIP_SLOT_MAIN_HAND, BAG_BACKPACK, slotId)
			--return gemSlot
		end
	end
end
  Reply With Quote