Quantcast

Added a small wait loop for items that are still loading

Kevin Lyles [02-03-10 - 05:00]
Added a small wait loop for items that are still loading
Filename
ItemScanner.lua
diff --git a/ItemScanner.lua b/ItemScanner.lua
index 465803a..e29efe2 100644
--- a/ItemScanner.lua
+++ b/ItemScanner.lua
@@ -1,6 +1,7 @@
 local minItem, maxItem = 1, 99999
 local CONSECUTIVE_INVALID_TO_IGNORE = 5
 local VALID_DELAY = 0.025
+local INVALID_DELAY = 5

 local function scanItemLink(link)
 	local textL, textR
@@ -9,8 +10,16 @@ local function scanItemLink(link)
 	ItemScannerHiddenTooltip:ClearLines()
 	ItemScannerHiddenTooltip:SetHyperlink(link)

-	if ItemScannerHiddenTooltipTextLeft1:GetText():find(RETRIEVING_ITEM_INFO) then
-		return false
+	local startTime = GetTime()
+	while ItemScannerHiddenTooltipTextLeft1:GetText():find(RETRIEVING_ITEM_INFO) do
+		coroutine.yield()
+		if GetTime() - startTime >= INVALID_DELAY then
+			-- If we got anything useful, keep it
+			if numLines > 1 then
+				break
+			end
+			return false
+		end
 	end

 	IS_item_info[link] = {