solidacid Posted July 24, 2008 Share Posted July 24, 2008 (edited) hey.im working on a script that collects data from a game for further processing(a big database on my website).it's a script that "plays" the singleplayer version of Diablo II: lord of destrutionand collects data while doing it,it repeatedly kills certain monsters("Mobs") in the game and harvests data like: what they drop, how frequently they drop cetain things, the estimated value of each kill(in terms of items). while also calculating things like: mob health, mob resistance to certain attacks, while logging it all to several .ini files.the script will be running for a cuple of weeks on several of my spare Pc's(all build from old computer parts i got for free muttley )to identify what items drop, i made a mod for the game(blizzard made that possible 2 weeks ago ) that colors the text of certain item groups(like swords red, shields blue, gems and runes purple and so on.)now, what i need help with is the "looting" part of my script.in diablo dropped items show up as text, but ONLY when mousing over them or when holding down ALTwhen i DON'T hold down ALT dropped items look like this:when i DO hold down ALT dropped tems look like this:i need to pick up all items that have Red or Purple(the mod is not fully done yet, i still need to adjust the last few things to be red and purple) text,i tried some different approaches, i tried this:expandcollapse popupHotKeySet("{END}", "Terminate") Opt("MouseCoordMode", 0) WinActivate("Diablo II") mousemove(1,1) WinSetOnTop("Diablo II", "Diablo II", 1) Func Terminate() Exit 0 Send("{ALTUP}") EndFunc ;Variabler: $loots = 50 ;hvor mange gange den skal kigge efter ting $lootcolor = 0xFe31Fe; farven på items der skal lootes exam: 0x42fb64 $left = 340 ;hvor scanningen skal starte $top = 300 ;hvor scanningen skal starte $right = 440 ;hvor scanningen skal slutte $botton = 400 ;hvor scanningen skal slutte $variation = 100 ;hvor langt fra den søgte farve må være fra den angivede $step = 0 ;hvor mange pixels der skal springes over for $i = 1 to $loots WinWaitActive("Diablo II") send("{ALTDOWN}") sleep(1) $result = PixelSearch($left,$top,$right,$botton,$lootcolor,$variation,$step) ;søg efter pixels med den rigtide farve if @error = 1 Then ;er farven fundet? msgbox(0, "fejl", "farven blev slet ikke fundet", 3000) ; nej, smid en fejl-besked Else ;farven er fundet (yay :D) send("{ALTUP}") $confirm = PixelSearch($left,$top,$right,$botton,$lootcolor,$variation,$step) ;søg efter farven, er det samme pixel? if @error = 1 Then ;er farven bekræftet? if $result[0] = $confirm[0] Then ;passer koordinaterne? if $result[1] = $confirm[1] Then ;passer koordinaterne? beep(500, 50) send("{ALTDOWN}") ;hold "ALT" nede for at få item tooltippet frem mousemove($confirm[0],$confirm[1]) ;bevæg musen til tingen mouseclick("left") ;klik på den (saml den op) send("{ALTUP}") EndIf endif $error = "item IKKE bekræftet" ; nej, Else ;msgbox(0, "fejl", "farven blev ikke fundet anden gang", 3000) endif endif next(SORRY FOR DANISH COMMENTS)it SHOULD hold down ALT and do a pixelseach for the chosen color($lootcolor). if it finds the color release ALT an check if it's still there.if it is, move the mouse there and click.repeat about 10 timesone of the problems is that even when i use the eyedropper tool in photoshop to get the color of the red text so i can put it in my script, the script does not find the colori hope you can help me make a working script.(wow that took a long time to write)SolidacidEDIT: OMG im happy i copy-pasted all this to word before posting it(server error 500) Edited July 24, 2008 by solidacid Link to comment Share on other sites More sharing options...
d3mon Posted July 24, 2008 Share Posted July 24, 2008 Before ask for pixelsearch go to frequently asked questions and read the 7reply : http://www.autoitscript.com/forum/index.php?showtopic=37289Thanks ! No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE Link to comment Share on other sites More sharing options...
solidacid Posted July 24, 2008 Author Share Posted July 24, 2008 Before ask for pixelsearchim not asking HOW to do a pixelseach, thats easy.im asking for help making my script do what i want it to,the script does run and there is no errors, im just not getting the desired effect.and im trying to igure out how to get the red texts color in hex. i tried using the eyedropper from photoshop(wich conveniently is outputted as hex) but the program needs a variation of 500(!!!) to even find the color.so, my question is:how do i get the correct color of the red text? and get my program to actually find it? Link to comment Share on other sites More sharing options...
Smiley357 Posted July 24, 2008 Share Posted July 24, 2008 My suggestion would be to use the AutoIt Window Info hold alt down and move over the red text and see what color it is. Then in pixelsearch have the shade-variation around 5 and keep moving up until it detects it. But im still learning myself. Good luck Link to comment Share on other sites More sharing options...
solidacid Posted July 24, 2008 Author Share Posted July 24, 2008 i think i found the reason my script isn't working. i created a small scrift to check the color of the pixel under the mouse, i tested it in paint and it worked great. so, i tried holding the mouse still over a big (consistently)red blob, my programm outputted a light green(?!) i moved the mouse 1 pixel(still in the red area) and it outputted blue instead? im getting incorrect colors from diablo, any ideas muttley what might be the problem? and how to solve it? im sure that if i find out how to get the right colors from diablo, i can make the script work on my own Link to comment Share on other sites More sharing options...
solidacid Posted July 24, 2008 Author Share Posted July 24, 2008 bumping back to page 1 Link to comment Share on other sites More sharing options...
solidacid Posted July 24, 2008 Author Share Posted July 24, 2008 bumping back to page 1 Link to comment Share on other sites More sharing options...
enaiman Posted July 25, 2008 Share Posted July 25, 2008 (edited) PixelChecksum ... by the way, it's not polite at all to repeatedly bump your post Edited July 25, 2008 by enaiman SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
muzle6074 Posted July 25, 2008 Share Posted July 25, 2008 lol i use the official version of this bot (mmbot). Link to comment Share on other sites More sharing options...
solidacid Posted July 25, 2008 Author Share Posted July 25, 2008 (edited) it's not polite at all to repeatedly bump your posti know, and im sorry but i really need this to work.how exacly is a checksum going to help me?PixelChecksum only returns a checksum(for checking if the picture changed)it does not return the color of the pixel.lol i use the official version of this bot (mmbot).mmbot is for online use and it uses illegal hacks,im not interested in "cheating" in the online version.also, lots of people have been banned for using mmbot.all i need to know is:how do i get the actual color of a certain pixel? when i mouse over a pixel that i know is red, autoit reads it as green, move the mouse 1 pixel to another pixel of the same color and autoit reads that as blue and so on Edited July 25, 2008 by solidacid Link to comment Share on other sites More sharing options...
enaiman Posted July 27, 2008 Share Posted July 27, 2008 OK - maybe PixelChecksum is not the best idea for you - I've been tricked by this: how do i get the actual color of a certain pixel? when i mouse over a pixel that i know is red, autoit reads it as green, move the mouse 1 pixel to another pixel of the same color and autoit reads that as blue and so onI guess your problem stays in this: You're sending "Alt down" and you look for a TEXT color, you find it (maybe) and after that you send "Alt Up" and you want to confirm the color ... WHICH COLOR do you want to confirm? the text color? - it's gone once you release Alt and the same pixel's color will be different (text/no text). SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now