Autoit Imagesearch Problem - Searching unid items in Inventory menu

User Tag List

Results 1 to 2 of 2
  1. #1
    hesi's Avatar Sergeant
    Reputation
    56
    Join Date
    Feb 2011
    Posts
    63
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Autoit Imagesearch Problem - Searching unid items in Inventory

    Hi all!

    First of all, I guess this is not the correct section to ask, because its not a "Memory Editing" question.
    Anyway, feel free to move my topic, if you got a better section :-)

    To shortly introduce my current project: IDandSell is the name of it.
    I try to create a tool, that checks the D3 inventory for unid items, to identify them and store/sell them to merchants with specific stats given.

    It is Autoit and "ImageSearch" based (better say: ImageSearchArea based).

    This is the latest problem:

    The D3 inventory has 6 rows and 10 columns (or vice versa?) = 60 slots to scan (1.1-1.6...10.1-10.6).
    The scanner successfully finds unid 1x1 slot and 1x2 slot items.
    But just from 1.1-1.4...10.1-10.4 ... not the full inventory.

    Here is my scan function + coords (its windowd 1920x1200)

    Code:
    $d3unidpic = @ScriptDir & "\pics\unid3_1920_1200.png"
    
    Func getuniditems(ByRef $unid)
       Local $begin
       $timeout = 10
       for $i = 1 to 10 step 1
    	  for $e = 1 to 6 step 1
    		 TrayTip("IDandSell","Searching unid's at: " & $i & " " & $e & @CRLF & "Found: " & $uniditems[0][0],5)
    		 local $x, $y, $xa, $xe, $ya, $ye
    		 returncoords($i,$e,$xa,$xe,$ya,$ye)
    		 $begin = TimerInit()
    		 while 1
    			$res = _ImageSearchArea($d3unidpic,1,$xa,$ya,$xe,$ye,$x,$y,100)
    			Sleep(10)
    			If $res = 1 Then
    			   $id1 = UBound($unid) + 1
    			   $id2 = UBound($unid,2) + 1
    			   ReDim $unid[$id1][$id2]
    			   $unid[0][0] += 1
    			   $unid[$id1-1][0] = $x
    			   $unid[$id2-1][1] = $y
    			   botLOG(1,"unid item #" & $unid[0][0] & " at [" & $x & ":" & $y & "]")
    			   Exitloop
    			Else
    			   if TimerDiff($begin) > $timeout Then
    				  ExitLoop
    			   EndIf
    			   Sleep(10)
    			EndIf
    		 WEnd
    	  Next
       Next
       if $unid[0][0] > 0 Then
    	  return 1
       EndIf
       return 0   
    EndFunc
    Code:
    Func returncoords($a,$b,ByRef $x1,ByRef $x2, ByRef $y1, ByRef $y2)
       Switch $a
       Case 1
    	  $x1 = 1382
    	  $x2 = 1430
       Case 2
    	  $x1 = 1436
    	  $x2 = 1480
       Case 3
    	  $x1 = 1485
    	  $x2 = 1531
       Case 4
    	  $x1 = 1536
    	  $x2 = 1578
       Case 5
    	  $x1 = 1587
    	  $x2 = 1632
       Case 6
    	  $x1 = 1639
    	  $x2 = 1681
       Case 7
    	  $x1 = 1689
    	  $x2 = 1732
       Case 8
    	  $x1 = 1740
    	  $x2 = 1783
       Case 9
    	  $x1 = 1790
    	  $x2 = 1832
       Case 10
    	  $x1 = 1840
    	  $x2 = 1881
       EndSwitch
       Switch $b
       Case 1
    	  $y1 = 644
    	  $y2 = 712
       Case 2
    	  $y1 = 692
    	  $y2 = 759
       Case 3
    	  $y1 = 743
    	  $y2 = 810
       Case 4
    	  $y1 = 793
    	  $y2 = 861
       Case 5
    	  $y1 = 843
    	  $y2 = 910
       Case 6
    	  $y1 = 894
    	  $y2 = 940
       EndSwitch
    EndFunc

    Code:
    Func _ImageSearchArea($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance, $transparency = 0)
    	;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)
    	If Not ($transparency = 0) Then $findImage = "*" & $transparency & " " & $findImage
    	If $tolerance > 0 Then $findImage = "*" & $tolerance & " " & $findImage
    	$result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)
    
    	; If error exit
    	If $result[0] = "0" Then Return 0
    
    	; Otherwise get the x,y location of the match and the size of the image to
    	; compute the centre of search
    	$array = StringSplit($result[0], "|")
    
    	$x = Int(Number($array[2]))
    	$y = Int(Number($array[3]))
    	If $resultPosition = 1 Then
    		$x = $x + Int(Number($array[4]) / 2)
    		$y = $y + Int(Number($array[5]) / 2)
    	EndIf
    	Return 1
    EndFunc   ;==>_ImageSearchArea
    This is the test-inventory: Autoit Imagesearch Problem - Searching unid items in Inventory-testinv-jpg


    And this is the logfile:


    Code:
    IDandSell 0.1 beta started (29/12/2012 - 14:54:43)
    --------------------------------------------------
     
    OS: WIN_7/X64 (Build: 7601 Language: German)
    Desktop: 1920/1200 Colordepth: 32bit
     
    --------------------------------------------------
     
     
    [14:54:45] unid item #1 at [1457:691]
    [14:54:45] unid item #2 at [1508:691]
    [14:54:45] unid item #3 at [1508:791]
    [14:54:45] unid item #4 at [1559:691]
    [14:54:46] unid item #5 at [1559:791]
    [14:54:46] unid item #6 at [1660:691]
    [14:54:46] unid item #7 at [1711:691]
    [14:54:46] unid item #8 at [1761:691]
    [14:54:46] unid item #9 at [1761:791]
    [14:54:47] unid item #10 at [1812:691]
    [14:54:47] unid item #11 at [1812:791]
    [14:54:47] unid item #12 at [1863:691]
    [14:54:47] unid item #13 at [1863:791]
    [14:54:47] scanner: 13 unid items found

    I tripple²²²² checked the coordinates (also with mousemoves between scans), but i can't find any errors.
    Is it possible that the ImageSearchArea function is broken? I hope not.


    Additional Info: I use Win7 Ultimate x64, Autoit x86 build and latest imagesearch.au3 (i guess).

    Maybe you can help me to solve my problem.

    Thanks in advance.
    hesi

    Autoit Imagesearch Problem - Searching unid items in Inventory
  2. #2
    KillerJohn's Avatar TurboHUD HUDmaster CoreCoins Purchaser Authenticator enabled
    Reputation
    3696
    Join Date
    Jul 2012
    Posts
    2,532
    Thanks G/R
    46/3338
    Trade Feedback
    0 (0%)
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I can't help you, but I have a question: why pixel-based and not memory-read? With memory read and some kind of input synth (OR even AutoIt and simple MouseMove/Click) you can do this very simple, fast, reliable, resolution-independent, etc... I've a tool for this in C#, and it's ~300 lines of code.

Similar Threads

  1. [PROBLEM] NBDC 47 items price missing...
    By viKKmaN in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 02-21-2009, 10:05 PM
  2. Problems with adding items.
    By Virgillost in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 10-14-2008, 07:51 AM
  3. PRoblem with adding item to npc, and buy it ..
    By kiite91 in forum WoW EMU Questions & Requests
    Replies: 4
    Last Post: 09-30-2008, 08:06 AM
  4. Few Problems and missing items from server.
    By tarleton in forum WoW EMU Questions & Requests
    Replies: 1
    Last Post: 08-26-2008, 07:21 AM
  5. Problems With ''Adding'' Items
    By sara in forum World of Warcraft Emulator Servers
    Replies: 9
    Last Post: 09-09-2007, 04:23 PM
All times are GMT -5. The time now is 11:07 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search