View Single Post
02/26/23, 11:19 AM   #7
ExoY
 
ExoY's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2020
Posts: 88
Originally Posted by sinnereso View Post
Code:
function RidinDirty.GetGems()
	for slotId = 0, GetBagSize(BAG_BACKPACK) do
		if IsItemSoulGem(SOUL_GEM_TYPE_FILLED, BAG_BACKPACK, slotId) then
			gemId = slotId
			df("found gems %s", gemId) -- <<<<<< returning 0 to chat as well which makes no sense to me.. it should be the slot# i would think
			return gemId
		end
        end
end
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....
  Reply With Quote