AutoIt functions to tell if a slot is empty/is a gem--how to find out if blue/yellow? menu

User Tag List

Results 1 to 5 of 5
  1. #1
    projectbarcelona's Avatar Member
    Reputation
    2
    Join Date
    Mar 2012
    Posts
    21
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    AutoIt functions to tell if a slot is empty/is a gem--how to find out if blue/yellow?

    So I wrote a simple AutoIt bot to do Sarkoth very similarly to the ones that have been posted on the site already. It runs Sarkoth, teleports to town, checks if your backpack is full, when it is sells all items except for gems/tome of secrets then stashes gems/tome of secrets, exits the game. Rinse and repeat.

    The issue I'm having is that I would rather salvage the blue items rather than just vendor them as I can get more on the AH for their salvaged commodities. I can't figure out a way to determine if an item is blue with AutoIt [or I guess any screenscraping method] so posting here for help.

    Here are my existing functions, take in x & y [for example top left item is 1,1] and added a slow parameter since there seemed to be an odd race condition/queuing issue happening where AutoIt was screwing up when I did a lot of PixelSearch() calls. Added some delay seemed to fix it.

    check_for_sellable_item
    Code:
    Func check_for_sellable_item($x,$y,$slow)
    	If $slow Then
    		Sleep(Random(1000,1250))
    	Else
    		Sleep(Random(125,175))
    	EndIf
    	$old_checksum = PixelChecksum(1015 + (($x - 1) * 35) - 20,433 + (($y - 1) * 34) - 20,1015 + (($x - 1) * 35) - 15,433 + (($y - 1) * 34) + 15)
    	MouseMove(1015 + (($x - 1) * 35) - 2 + Random(0,5),433 + (($y - 1) * 34) - 2 + Random(0,5),0)
    	If $slow Then
    		Sleep(Random(1000,1250))
    	Else
    		Sleep(Random(125,175))
    	EndIf
    	$new_checksum = PixelChecksum(1015 + (($x - 1) * 35) - 20,433 + (($y - 1) * 34) - 20,1015 + (($x - 1) * 35) - 15,433 + (($y - 1) * 34) + 15)
    	return $old_checksum <> $new_checksum
    EndFunc
    check_for_gem_color
    Code:
    Func check_for_gem_color($x,$y)
    	$shade_variance = 40
    
    	$check = PixelSearch(1015 + (($x - 1) * 35),433 + (($y - 1) * 34),1015 + (($x - 1) * 35),433 + (($y - 1) * 34),0x7F4100,$shade_variance)
    	If Not @error Then
    		Return true
    	EndIf
    
    	$check = PixelSearch(1015 + (($x - 1) * 35),433 + (($y - 1) * 34),1015 + (($x - 1) * 35),433 + (($y - 1) * 34),0xA56100,$shade_variance)
    	If Not @error Then
    		Return true
    	EndIf
    
    	$check = PixelSearch(1015 + (($x - 1) * 35),433 + (($y - 1) * 34),1015 + (($x - 1) * 35),433 + (($y - 1) * 34),0x6E00A1,$shade_variance)
    	If Not @error Then
    		Return true
    	EndIf
    
    	$check = PixelSearch(1015 + (($x - 1) * 35),433 + (($y - 1) * 34),1015 + (($x - 1) * 35),433 + (($y - 1) * 34),0x9000D6,$shade_variance)
    	If Not @error Then
    		Return true
    	EndIf
    
    	$check = PixelSearch(1015 + (($x - 1) * 35),433 + (($y - 1) * 34),1015 + (($x - 1) * 35),433 + (($y - 1) * 34),0x820508,$shade_variance)
    	If Not @error Then
    		Return true
    	EndIf
    
    	$check = PixelSearch(1015 + (($x - 1) * 35),433 + (($y - 1) * 34),1015 + (($x - 1) * 35),433 + (($y - 1) * 34),0xC90808,$shade_variance)
    	If Not @error Then
    		Return true
    	EndIf
    
    	$check = PixelSearch(1015 + (($x - 1) * 35),433 + (($y - 1) * 34),1015 + (($x - 1) * 35),433 + (($y - 1) * 34),0x236823,$shade_variance)
    	If Not @error Then
    		Return true
    	EndIf
    
    	$check = PixelSearch(1015 + (($x - 1) * 35),433 + (($y - 1) * 34),1015 + (($x - 1) * 35),433 + (($y - 1) * 34),0x30A630,$shade_variance)
    	If Not @error Then
    		Return true
    	EndIf
    
    	Return false
    EndFunc
    Should also note I have this working only for the 1360x768 resolution, feel free to modify for any others

    AutoIt functions to tell if a slot is empty/is a gem--how to find out if blue/yellow?
  2. #2
    who knows's Avatar Contributor
    Reputation
    110
    Join Date
    Nov 2007
    Posts
    284
    Thanks G/R
    2/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't even need to read your code and I see you're already using the built in Pixelsearch.

    Just simply pixel search the items icon, or the "background" of the name of the item. (When you hover-over the background of the item is coloured, search there.)
    My Diablo 3 Gear Swap Program:
    https://www.ownedcore.com/forums/diablo-3/diablo-3-bots-programs/352782-free-wks-gear-swap-bot.html

  3. #3
    projectbarcelona's Avatar Member
    Reputation
    2
    Join Date
    Mar 2012
    Posts
    21
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by who knows View Post
    I don't even need to read your code and I see you're already using the built in Pixelsearch.

    Just simply pixel search the items icon, or the "background" of the name of the item. (When you hover-over the background of the item is coloured, search there.)
    The problem with that is the items are misshaped so the blue was appear in different pixels on each item. Your response will probably be: just search the entire item square for a certain shade of blue which worries me as a lot of non blue items have some kind of blue coloring in the item image.

  4. #4
    Shimizoki's Avatar Knight-Lieutenant
    Reputation
    32
    Join Date
    Jun 2012
    Posts
    358
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    ;Magic
    While $VendorMagic
        Sleep(Random(100, 300))
        $MagicPixel = PixelSearch(1398*$x_ratio, 572*$y_ratio, 1914*$x_ratio, 888*$y_ratio, 0x182037, 2)
        If Not @error Then
            MouseClick("right", $MagicPixel[0], $MagicPixel[1])
        Else
            ExitLoop
        EndIf
    WEnd
    This is what I am using to vendor my blues, I have not yet to my knowledge had any issues with selling something of the wrong color. I did at first, but after quite a bit of tweaking I found that this pixel color/tolerance will sell all blues in no matter what shape and size, but not anything else(with my specs). You just have to stash your gems and tomes before you use it else you will try to vendor/salvage tomes.
    Last edited by Shimizoki; 06-13-2012 at 11:10 AM.
    -Darkling Lord

  5. #5
    PragmaThrice's Avatar Private
    Reputation
    1
    Join Date
    Jun 2012
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If I was writing it from scratch I would have taken multiple locations around the perimeter of the item and averaged the blue values to see if they match within a certain threshold. But Darkling's approach is much more elegant.

Similar Threads

  1. can some 1 tell me what the new color code for Gem text?
    By dgnguyenz in forum D3 Gold profiles
    Replies: 4
    Last Post: 09-11-2012, 02:43 PM
  2. IsInGame() an Autoit Function.
    By Poodoo in forum D3 Gold profiles
    Replies: 2
    Last Post: 06-17-2012, 09:54 AM
  3. How to find Tls slot for wowObjects?
    By masho in forum WoW Memory Editing
    Replies: 12
    Last Post: 04-11-2009, 12:30 AM
  4. [AutoIt] Some functions
    By ironmaiden187 in forum WoW Memory Editing
    Replies: 6
    Last Post: 03-16-2009, 06:21 PM
All times are GMT -5. The time now is 09:02 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search