hamncheese 8 Report post Posted April 18, 2014 (edited) hope im in the right section this is a continuation from my last thread so im planning to make a script : Scan Bag and identify all the un-id item reason why i made this script: since 0.17a - 0.17d ive been having this frustrasting bug 'Item Stuck On Cursor' that i have never seen in 0.16g this is my whole un-finished script F5:: { PixelSearch, wisdomx, wisdomy, 316, 292, 799, 499, 0x3b337a, 3, fast sleep 500 MouseMove, 462, 368 sleep 500 Loop { iy := ((A_Index - 1) * 29) + 365 ix := ((Ceil(A_Index / 12) - 1) * 29) + 460 mousemove, %ix%, %iy% sleep 500 ImageSearch, unidx, unidy, 316, 292, 799, 499, *n *60 Z:\POE\Path Of Exile\Image\unid.bmp unidxc := unidx unidyc := unidy + 30 { if ErrorLevel = 0 { sleep 500 click right %wisdomx%, %wisdomy% sleep 500 click left %unidxc%, %unidyc% } } If A_Index = 12 Break else Sleep, 200 } } for now i am stuck at how to scan all the bag section, block per block this is the code block about bag scanning or MouseMove Loop { ix := ((A_Index - 1) * 29) + 460 iy := ((Ceil(A_Index / 12) - 1) * 29) + 365 mousemove, %ix%, %iy% sleep 500 if A_Index = 60 Break else sleep 500 } the coord for first Block in Bag = 460, 365 the distance to next Block (x and y are the same) = 29 pixel number of Block 12 x 5 = 60 My problem : the mouse would move correctly from 1st block > 12th Block after this the mouse would move to the second Row but instead of resetting back to the first Column it move to the 13th column i dont know how to make the mouse to 'reset' to come back to the First column after the 12th can anyone help me with this ? Immo has kindly enough to give me some alternative solution using Array ; stashing _xi := 460 ; x-center of first column of inventory _yi := 370 ; y-center of first column of inventory _countCell := 0 Send {Ctrl Down} Sleep 200 for j, ele in Array { for k, ele in Array[j] { if (Array[j, k] = 0) { Click %_xi%, %_yi% Sleep 150 } _xi := _xi + 29 ; Moves mouse forward 29 pixels _countCell += 1 ; counter of inventory cells if _countCell = 12 { _yi := _yi + 29 ; next inventory row _xi := 460 ; Reset to first Column of inventory _countCell := 0 } } } Send {Ctrl Up} Sleep 500 Send {Space} ; close all menus but i have no idea how to work with Array, maybe someone can also help me with this ? Edited April 18, 2014 by hamncheese Quote Share this post Link to post Share on other sites
hamncheese 8 Report post Posted April 18, 2014 i think i got the script working, this is my solution so far : F5:: myindex = 0 Loop { blockinput, on myindex++ ix := ((myindex - 1) * 29) + 460 iy := ((Ceil(A_Index / 12) - 1) * 29) + 365 mousemove, %ix%, %iy% sleep 500 if (myindex = 12) myindex = 0 If A_Index = 60 { Break blockinput, off } else Sleep, 200 } Quote Share this post Link to post Share on other sites
hamncheese 8 Report post Posted April 18, 2014 (edited) ok my nex problem : how to incorporate this script with the default EB behaviour { PixelSearch, townx, towny, 649, 566, 661, 582, 0x6a6a6a, 3, fast if ErrorLevel = 0 { blockinput, on send, {space} Send, i ;PixelSearch, wisdomx, wisdomy, 316, 292, 799, 499, 0x3b337a, 3, fast wisdomx = 754 wisdomy = 483 sleep 500 Loop { myindex++ ix := ((myindex - 1) * 29) + 460 iy := ((Ceil(A_Index / 12) - 1) * 29) + 365 mousemove, %ix%, %iy% sleep 100 ImageSearch, unidx, unidy, 316, 292, 799, 499, *n *60 Z:\POE\Path Of Exile\Image\unid.bmp unidxc := unidx unidyc := unidy + 30 { if ErrorLevel = 0 { mousemove, %wisdomx%, %wisdomy% sleep 200 click right sleep 200 mousemove, %unidxc%, %unidyc% sleep 200 click left sleep 200 } } if (myindex = 12) myindex = 0 If A_Index = 60 { blockinput, off Break } else Sleep, 100 } } } the script would run really good tried this 5-6 times with bag full of un-id item blue/yellow/unique so far running well now im trying to figure out how to make this script run only Once and Upon Entering town anyone can help with this ? Edited April 19, 2014 by hamncheese Quote Share this post Link to post Share on other sites
hamncheese 8 Report post Posted April 19, 2014 (edited) since you didnt follow my hint using clipboard reading for identifying items ^^ you should continue reading pixels f.e. the standardattack button gets greyd out in town thanks immo, im reading that little mouse button image thah gets Yellow in zone, and Grey in town since its a pretty small area to scan i figure its not that heavy on the system anyway, regardless on how i pull the data about empty block i still cant figure out how to make the script run Upon Entering Town and Only Once i figured , put the iventory scan into another script/thread call that script on the main one and use SetTimer ? Edited April 19, 2014 by hamncheese Quote Share this post Link to post Share on other sites
jsk110 1 Report post Posted April 20, 2014 Create a var let's say unid_started = false Check if in town. if in town and unid_started = false then start unid loop and set unid_started = true if not in town set unid_started = false Quote Share this post Link to post Share on other sites
hamncheese 8 Report post Posted April 23, 2014 (edited) i apologize for the late reply, i had to re-format my main box in an attempt to trace what is the cause for this bug ony my end thank you so much Immo, Jsk, i found what was the problem on my end, it was my too heavy ahk script apprently which is odd since the script only eats about 800kb-1,5mb of ram and very little cpu anyway after stripping all the un-necessary script i got it down to 20kb - 600kb of ram altho my Old script does use a lot of imagesearch (small area) for now EB + New script runs merrily without a hitch in all my VM Thank you Alk for taking the time to respond to this thread, yeah the problem was on my end, but i still dont get it... why was 0.16g + Old Script can run flawless while 0.17a-0.17d cannot .... im still hoping for that MouseMove Alk i still think it would a good addition Jsk ure right ... i got the idea (maybe...lol) im going to try that, thank you ! Immo thank you so much for sharing your code, youre a genius ! i didnt thought of using the lastrunlog for cue what state EB is in, Genius man ! btw this is the script that im using atm, the imagesearch bunch into F5, maybe someone with more expertise on AHK can chime in on how to improve my code ? (looking at Immo.. ) SetTitleMatchMode 2 #SingleInstance Force Run, ahk Close POE.ahk settimer, loop1, 5000 Loop1: { IfWinExist, Path of Exile: PathOfExile.exe - Application Error { Controlclick, Button1, Path of Exile: PathOfExile.exe - Application Error,, Left, 1 return } IfWinExist, ExiledBot.exe - Application Error { Controlclick, Button1, ExiledBot.exe - Application Error,, Left, 1 return } IfWinExist, Exception { Controlclick, Button1, Exception,, Left, 1 return } IfWinExist, Exit, Are you sure to Exit { Controlclick, Button1, Exit, Are you sure to Exit, Left, 1 return } IfWinExist, Error, Game not found { Controlclick, Button1, Error, Game not found, Left, 1 return } Process, Exist, pathofexile.exe { If ! errorLevel { TrayTip,, Launch POE Run, C:\Users\xxx\Desktop\PathOfExile.lnk WinWaitActive, Path of Exile, , 10 sleep 5000 winactivate, Exiled Bot sleep 500 Controlclick, Button3, Exiled Bot,, Left, 1 return } } Process, Exist, exiledbot.exe { If ! errorLevel { TrayTip,, Launch EB Run, C:\Users\xxx\Desktop\POE\Path Of Exile\ExiledBot\exiledbot.exe sleep 5000 winactivate, Exiled Bot sleep 500 Controlclick, Button3, Exiled Bot,, Left, 1 return } } ImageSearch, resumex, resumey, 291, 170, 501, 332, *n *30 Z:\POE\Path Of Exile\Image\resume.bmp { if ErrorLevel = 0 { TrayTip,, resume click, %resumex%, %resumey% return } } SendMode Input If WinActive, Path of Exile { Send {ENTER} Send /oos Send {ENTER} return } } F8:: SendMode Input myindex = 0 loop { myindex++ Send {ENTER} Send /trade 100 Send {ENTER} sleep, 1000 Send {ENTER} Send /trade %myindex% Send {ENTER} Sleep, 1000 Send {ENTER} Send {Up 3} Send {ENTER} sleep, 1000 Send {ENTER} Send /trade 100 Send {ENTER} PixelSearch, px, py, 0, 250, 800, 453, 0xB45A96, 3, fast if errorlevel { sleep 1000 } else { ;controlsend,, {F2}, Path of Exile ;Loop, C:\Users\xxx\Documents\SomeRandomProgram\Screenshots\*.png ;{ ; If (A_LoopFileTimeCreated>Rec) ; { ; FPath=%A_LoopFileFullPath% ; Rec=%A_LoopFileTimeCreated% ; } ;} pmsg := ComObjCreate("CDO.Message") pmsg.From := """John Doe"" <[email protected]>" pmsg.To := "[email protected]" pmsg.BCC := "" pmsg.CC := "" pmsg.Subject := "Uve Got Mail" ;You can use either Text or HTML body like pmsg.TextBody := "EmailBody" ;OR ;pmsg.HtmlBody := "<html><head><title>Hello</title></head><body><h2>Hello</h2><p>Testing!</p></body></html>" sAttach := "%FPath%" ; can add multiple attachments, the delimiter is | fields := Object() fields.smtpserver := "smtp.gmail.com" ; specify your SMTP server fields.smtpserverport := 465 ; 25 fields.smtpusessl := True ; False fields.sendusing := 2 ; cdoSendUsingPort fields.smtpauthenticate := 1 ; cdoBasic fields.sendusername := "[email protected]" fields.sendpassword := "password" fields.smtpconnectiontimeout := 60 schema := "http://schemas.microsoft.com/cdo/configuration/" pfld := pmsg.Configuration.Fields For field,value in fields pfld.Item(schema . field) := value pfld.Update() Loop, Parse, sAttach, |, %A_Space%%A_Tab% ;pmsg.AddAttachment(A_LoopField) pmsg.Send() } sleep 1000 If myindex = 6 myindex = 0 else sleep 200 } ~F9::Reload ~F10::Exitapp F5:: { ImageSearch, okx, oky, 160, 224, 620, 611, *n *30 Z:\POE\Path Of Exile\Image\ok.bmp { if ErrorLevel = 0 { Click, %okx%, %oky% sleep 500 Click 300, 438, 2 Send password return } } ImageSearch, loginx, loginy, 184, 386, 620, 611, *n *40 Z:\POE\Path Of Exile\Image\login2.bmp { if ErrorLevel = 0 { traytip,, Password Click 300, 438, 2 Send password ;Click, 571, 417 Controlclick, Button3, Exiled Bot,, Left, 1 return } } ImageSearch, ipx, ipy, 189, 279, 548, 332, *n *30 Z:\POE\Path Of Exile\Image\ipchanged.bmp { if ErrorLevel = 0 { traytip,, ip changed inbox = C:\Users\xxx\Desktop\POE\Path Of Exile\getmail\Inbox username = JohnDoe password = password sleep 5000 run, getmail.exe -u %username% -pw %password% -s 127.0.0.1 -port 1109, %inbox%, hide traytip,, getmail sleep 8000 Loop, %inbox%\*.txt { If (A_LoopFileTimeCreated>Rec) { FPath=%A_LoopFileFullPath% Rec=%A_LoopFileTimeCreated% } } FileRead, MailContent, %Fpath% AfterCodePos := (RegExMatch(MailContent, "Our support staff will never ask you for this unlock code.") - 7) StringMid, unlockCode, MailContent, AfterCodePos, 12, L clipboard = %unlockCode% traytip,, %unlockCode% click, 387, 276 send ^a sleep 200 Send ^v Sleep 200 Click, 566, 362 return } } ImageSearch, sellx, selly, 158, 48, 483, 272, *n *60 Z:\POE\Path Of Exile\Image\sell.bmp { if ErrorLevel = 0 { TrayTip,, Sell Coord update sellynet := selly + 5 sellxnet := sellx + 5 Net := sellynet - 30 IniWrite, %net%, C:\Users\xxx\Desktop\POE\Path Of Exile\ExiledBot\Configuration\default\coordinates.ini, menu, npc_sell_button_y_nessa IniWrite, %net%, C:\Users\xxx\Desktop\POE\Path Of Exile\ExiledBot\Configuration\default\coordinates.ini, menu, npc_sell_button_y_greust IniWrite, %net%, C:\Users\xxx\Desktop\POE\Path Of Exile\ExiledBot\Configuration\default\coordinates.ini, menu, npc_sell_button_y_clarissa send {f11} sleep 1000 return } } } ^!Numpad1:: { TrayTip,, Update 1 default.ipd FileCopy, Z:\POE\Path Of Exile\1 default.ipd, C:\Users\xxx\Desktop\POE\Path Of Exile\ExiledBot\Configuration\default\Pickit\default.ipd, 1 return } ^!Numpad2:: { TrayTip,, Update 2 default.ipd FileCopy, Z:\POE\Path Of Exile\2 default.ipd, C:\Users\xxx\Desktop\POE\Path Of Exile\ExiledBot\Configuration\default\Pickit\default.ipd, 1 return } ^!Numpad4:: { TrayTip,, Update Map1 default.ipd FileCopy, Z:\POE\Path Of Exile\Map1 default.ipd, C:\Users\xxx\Desktop\POE\Path Of Exile\ExiledBot\Configuration\default\Maps\default.ipd, 1 return } numpaddiv:: SendMode Input { Loop { GetKeyState, var, numpaddiv, P If var = U Break { send ^{LButton} Sleep 100 } } } who knows maybe someone can have some ideas from this ugly script lol btw immo, i remember reading one of your post maybe ? about responding to PM, did u manage to get the data for real time chat ? i was thinking of sending portion the Private Message thru email, and responding via email so far i have in one of my script above, inserted in the F8 spam trade, to scan a Private Message Pixel (purple colour) in the chat window and sends a warning email to myself, worked great so far, ben using that small email script for about 1+ month no problem so far, what do u think would it be possible ? Edit: this is the other script that the main is calling just a script to save the mouse position twice with sleep 2 minutes in between if its the same close EB and POE send mail to myself SetTitleMatchMode 2 #SingleInstance Force settimer, Loop1, 1000 Loop1: { traytip,, 1st Coord MouseGetPos, xpos1, ypos1 sleep 120000 traytip,, 2nd Coord MouseGetPos, xpos2, ypos2 If (xpos1 = xpos2 and ypos1 = ypos2) { traytip,, Mouse Idle Closing POE and EB pmsg := ComObjCreate("CDO.Message") pmsg.From := """John Doe"" <[email protected]>" pmsg.To := "[email protected]" pmsg.BCC := "" pmsg.CC := "" pmsg.Subject := "MOUSE IDLE" ;You can use either Text or HTML body like pmsg.TextBody := "MOUSE IDLE Closing EB and POE" ;OR ;pmsg.HtmlBody := "<html><head><title>Hello</title></head><body><h2>Hello</h2><p>Testing!</p></body></html>" sAttach := "%FPath%" ; can add multiple attachments, the delimiter is | fields := Object() fields.smtpserver := "smtp.gmail.com" ; specify your SMTP server fields.smtpserverport := 465 ; 25 fields.smtpusessl := True ; False fields.sendusing := 2 ; cdoSendUsingPort fields.smtpauthenticate := 1 ; cdoBasic fields.sendusername := "[email protected]" fields.sendpassword := "password" fields.smtpconnectiontimeout := 60 schema := "http://schemas.microsoft.com/cdo/configuration/" pfld := pmsg.Configuration.Fields For field,value in fields pfld.Item(schema . field) := value pfld.Update() Loop, Parse, sAttach, |, %A_Space%%A_Tab% ;pmsg.AddAttachment(A_LoopField) pmsg.Send() WinKill, Path of Exile WinKill, Exiled Bot IfWinExist, Exit, Are you sure to Exit { Controlclick, Button1, Exit, Are you sure to Exit, Left, 1 } } } Edited April 23, 2014 by hamncheese Quote Share this post Link to post Share on other sites
hamncheese 8 Report post Posted April 23, 2014 Immo how u handle LastRunLog gave me an idea im going to try look for EB state when on Login screen using LastRunLog 2014-04-23 13:36:51 [info] -> Logging into the game and do an imagesearch loop only when that state is the last line inside LastRunLog the purpose of the imagesearch is to look for POE state such as : - ure logging from new ip please input password - pressing Ok button - ure logging from new ip please input unlock code from email what do u think ? or is there other way of getting that state ? Quote Share this post Link to post Share on other sites
hamncheese 8 Report post Posted April 24, 2014 (edited) Immo thank you for replying 1. about acting on PM - i tried EB-Tools V2.4 but i cant find the option for it - what i have in mind is the ability to reply to PM using Email (i dont know if theres a better method for reply ing to PM) 2. about IP changes, ure right ! i just noticed this hmm so parsing .txt file is lighter to the system than using imagesearch ? ps: i know u have made a very good application with EB-Tools, but what im interested is i want to learn about AHK . introduction to Exiledbot is also my first introduction to AHK, i have never dabble in coding before this, so please forgive me if some of my questions are too brash / unacceptable, i dont know any better. also if this forum is not the right place to ask any questions about AHK please do inform me, so i can refrain from asking further question again thank you immo Edited April 24, 2014 by hamncheese Quote Share this post Link to post Share on other sites
hamncheese 8 Report post Posted April 25, 2014 (edited) Immo thank you for the reply parsing the latest line in a text file is harder than i thought ok i think i got the script running so far this is what i got and i absolutely dont know if this is the efficient way to do this or not, please if anyone can chime in to improve this script, please dont hesitate SendMode Input SetTitleMatchMode 2 settimer, loop1, 5000 client = C:\Users\xxx\Desktop\POE\Path Of Exile\Path of Exile\logs\client.txt lastrunlog = C:\Users\xxx\Desktop\POE\Path Of Exile\ExiledBot\Log\lastrun.log poepswd = mailuser = mailpswd = inbox = C:\Users\xxx\Desktop\POE\Path Of Exile\getmail\Inbox Filedelete, %client% FileDelete, %lastrunlog% F9::reload F10::exitapp Loop1: { Loop, Read, %client% { lastline := A_LoopReadLine lastrow := A_Index } IfInString, lastline, You are logging in from a new location { ImageSearch, okx, oky, 160, 224, 620, 611, *n *30 Z:\POE\Path Of Exile\Image\ok.bmp { if ErrorLevel = 0 { Click, %okx%, %oky% return } } traytip,, %lastline% click, 300, 438, 4 sleep 200 Send %poepswd% sleep 200 Controlclick, Button3, Exiled Bot,, Left, 2 sleep 200 return } IfInString, lastline, The password is not correct { ImageSearch, okx, oky, 160, 224, 620, 611, *n *30 Z:\POE\Path Of Exile\Image\ok.bmp { if ErrorLevel = 0 { Click, %okx%, %oky% return } } traytip,, %lastline% click, 300, 438, 4 sleep 200 Send %poepswd% sleep 200 Controlclick, Button3, Exiled Bot,, Left, 2 return } IfInString, lastline, Abnormal disconnect { ImageSearch, okx, oky, 160, 224, 620, 611, *n *30 Z:\POE\Path Of Exile\Image\ok.bmp { if ErrorLevel = 0 { Click, %okx%, %oky% return } } traytip,, %lastline% click, 300, 438, 4 sleep 200 Send %poepswd% sleep 200 Controlclick, Button3, Exiled Bot,, Left, 2 return } IfInString, lastline, Your account has been locked { ImageSearch, okx, oky, 160, 224, 620, 611, *n *30 Z:\POE\Path Of Exile\Image\ok.bmp { if ErrorLevel = 0 { Click, %okx%, %oky% return } } traytip,, %lastline% inbox = C:\Users\xxx\Desktop\POE\Path Of Exile\getmail\Inbox sleep 5000 run, getmail.exe -u %mailuser% -pw %mailpswd% -s 127.0.0.1 -port 1109, %inbox%, hide traytip,, getmail sleep 8000 Loop, %inbox%\*.txt { If (A_LoopFileTimeCreated>Rec) { FPath=%A_LoopFileFullPath% Rec=%A_LoopFileTimeCreated% } } FileRead, MailContent, %Fpath% AfterCodePos := (RegExMatch(MailContent, "Our support staff will never ask you for this unlock code.") - 7) StringMid, unlockCode, MailContent, AfterCodePos, 12, L clipboard = %unlockCode% traytip,, %unlockCode% click, 387, 276 send ^a sleep 200 Send ^v Sleep 200 Click, 566, 362 ImageSearch, okx, oky, 160, 224, 620, 611, *n *30 Z:\POE\Path Of Exile\Image\ok.bmp { if ErrorLevel = 0 { Click, %okx%, %oky% return } } return } } Edited April 26, 2014 by hamncheese Quote Share this post Link to post Share on other sites
hamncheese 8 Report post Posted April 26, 2014 to retrieve the last line: ; Retrieve the last line from clients.txt Loop, read, %_poepath%\logs\Client.txt last_line1 := A_LoopReadLine thank you immo ! yay it seems i got it right this time lol Quote Share this post Link to post Share on other sites
hamncheese 8 Report post Posted April 26, 2014 Immo what do u think about this, i found some Fuction for reading only the last line, from ppl in the AHK forum Tail from Laszlo StrTail from Tuncay Library for text manipulation from Heresy Quote Share this post Link to post Share on other sites
hamncheese 8 Report post Posted April 26, 2014 damn that looks awesome thank you for sharing this Immo Quote Share this post Link to post Share on other sites