mvriesen2004 Posted November 6, 2006 Posted November 6, 2006 (edited) Hi All First of all, let me say this is a VERY cool program for macro programming. I am trying to create a MacroBot and am having trouble processing pixel colors. If you look at the Func start() part of the code, the bot should stay locked on a mob until its HP drops to zero. However, the bot tends to target and retarget even though the mob has HP. Infact, if I disable the attack, the bot simple moves from target to target when it should simple stay on the same target. Any idea what I might be doing wrong? Thanks!!!!! expandcollapse popup#include <GUIConstants.au3> #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=e:\003-mark@backup\archbot\koda_1.6.0.2\forms\archlordbot.kxf $frmArchLordBot = GUICreate("ArchLordBot v0.1", 600, 447, 190, 111) GUISetBkColor(0xF1EFE2) $gbBuffs = GUICtrlCreateGroup("Buffs ...", 16, 8, 185, 209) GUICtrlSetBkColor(-1, 0xF1EFE2) GUICtrlCreateGroup("", -99, -99, 1, 1) $lblBuffCoolDown = GUICtrlCreateLabel("Cool Down", 128, 24, 56, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $lblBuffKey = GUICtrlCreateLabel("Key", 88, 24, 22, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $cbBuff1 = GUICtrlCreateCheckbox("Buff #1", 24, 48, 57, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbBuffKey1 = GUICtrlCreateInput("", 88, 48, 33, 21) $tbBuffCD1 = GUICtrlCreateInput("", 128, 48, 65, 21) $cbBuff2 = GUICtrlCreateCheckbox("Buff #2", 24, 72, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbBuffKey2 = GUICtrlCreateInput("", 88, 72, 33, 21) $tbBuffCD2 = GUICtrlCreateInput("", 128, 72, 65, 21) $cbBuff3 = GUICtrlCreateCheckbox("Buff #3", 24, 96, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbBuffKey3 = GUICtrlCreateInput("", 88, 96, 33, 21) $tbBuffCD3 = GUICtrlCreateInput("", 128, 96, 65, 21) $cbBuff4 = GUICtrlCreateCheckbox("Buff #4", 24, 120, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbBuffKey4 = GUICtrlCreateInput("", 88, 120, 33, 21) $tbBuffCD4 = GUICtrlCreateInput("", 128, 120, 65, 21) $cbBuff5 = GUICtrlCreateCheckbox("Buff #5", 24, 144, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbBuffKey5 = GUICtrlCreateInput("", 88, 144, 33, 21) $tbBuffCD5 = GUICtrlCreateInput("", 128, 144, 65, 21) $cbBuff6 = GUICtrlCreateCheckbox("Buff #6", 24, 168, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbBuffKey6 = GUICtrlCreateInput("", 88, 168, 33, 21) $tbBuffCD6 = GUICtrlCreateInput("", 128, 168, 65, 21) $cbBuffsUseShift = GUICtrlCreateCheckbox("Use Shift Key", 24, 192, 97, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $gbPots = GUICtrlCreateGroup("Pots ...", 208, 8, 185, 209) GUICtrlSetBkColor(-1, 0xF1EFE2) GUICtrlCreateGroup("", -99, -99, 1, 1) $lblPotKey = GUICtrlCreateLabel("Key", 280, 24, 22, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $cbPot1 = GUICtrlCreateCheckbox("Pot #1", 216, 48, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbPotKey1 = GUICtrlCreateInput("", 280, 48, 33, 21) $tbPotCD1 = GUICtrlCreateInput("", 320, 48, 65, 21) $cbPot2 = GUICtrlCreateCheckbox("Pot #2", 216, 72, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbPotKey2 = GUICtrlCreateInput("", 280, 72, 33, 21) $lblPotCD = GUICtrlCreateLabel("Cool Down", 320, 24, 56, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbPotCD2 = GUICtrlCreateInput("", 320, 72, 65, 21) $cbPot3 = GUICtrlCreateCheckbox("Pot #3", 216, 96, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbPotKey3 = GUICtrlCreateInput("", 280, 96, 33, 21) $tbPotcd3 = GUICtrlCreateInput("", 320, 96, 65, 21) $cbPot4 = GUICtrlCreateCheckbox("Pot #4", 216, 120, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbPotKey4 = GUICtrlCreateInput("", 280, 120, 33, 21) $tbPotCD4 = GUICtrlCreateInput("", 320, 120, 65, 21) $cbPot5 = GUICtrlCreateCheckbox("Pot #5", 216, 144, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbPotKey5 = GUICtrlCreateInput("", 280, 144, 33, 21) $tbPotCD5 = GUICtrlCreateInput("", 320, 144, 65, 21) $cbPot6 = GUICtrlCreateCheckbox("Pot #6", 216, 168, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbPotKey6 = GUICtrlCreateInput("", 280, 168, 33, 21) $tbPotCD6 = GUICtrlCreateInput("", 320, 168, 65, 21) $cbPotsUseShift = GUICtrlCreateCheckbox("Use Shift Key", 216, 192, 97, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $gbSkill = GUICtrlCreateGroup("Skills ...", 400, 8, 185, 209) GUICtrlSetBkColor(-1, 0xF1EFE2) GUICtrlCreateGroup("", -99, -99, 1, 1) $lblSkillKey = GUICtrlCreateLabel("Key", 472, 24, 22, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $lblSkillCD = GUICtrlCreateLabel("Cool Down", 512, 24, 56, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $cbSkill1 = GUICtrlCreateCheckbox("Skill #1", 408, 48, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbSkillKey1 = GUICtrlCreateInput("", 472, 48, 33, 21) $tbSkillCD1 = GUICtrlCreateInput("", 512, 48, 65, 21) $cbSkill2 = GUICtrlCreateCheckbox("Skill #2", 408, 72, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbSkillKey2 = GUICtrlCreateInput("", 472, 72, 33, 21) $tbSkillCD2 = GUICtrlCreateInput("", 512, 72, 65, 21) $cbSkill3 = GUICtrlCreateCheckbox("Skill #3", 408, 96, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbSkillKey3 = GUICtrlCreateInput("", 472, 96, 33, 21) $tbSkillCD3 = GUICtrlCreateInput("", 512, 96, 65, 21) $cbSkill4 = GUICtrlCreateCheckbox("Skill #4", 408, 120, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbSkillKey4 = GUICtrlCreateInput("", 472, 120, 33, 21) $tbSkillCD4 = GUICtrlCreateInput("", 512, 120, 65, 21) $cbSkill5 = GUICtrlCreateCheckbox("Skill #5", 408, 144, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbSkillKey5 = GUICtrlCreateInput("", 472, 144, 33, 21) $tbSkillCD5 = GUICtrlCreateInput("", 512, 144, 65, 21) $cbSkill6 = GUICtrlCreateCheckbox("Skill #6", 408, 168, 65, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbSkillKey6 = GUICtrlCreateInput("", 472, 168, 33, 21) $tbSkillCD6 = GUICtrlCreateInput("", 512, 168, 65, 21) $cbSkillsUseShift = GUICtrlCreateCheckbox("Use Shift Key", 408, 192, 97, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $cbUseReversal = GUICtrlCreateCheckbox("Reverse Direction After", 24, 232, 137, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbKills = GUICtrlCreateInput("", 168, 232, 33, 21) $lblKills = GUICtrlCreateLabel("Kills", 208, 232, 22, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $cbAutoLoot = GUICtrlCreateCheckbox("Auto Loot", 24, 256, 81, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbAutoLoot = GUICtrlCreateInput("", 168, 256, 33, 21) $lblAutoLoot = GUICtrlCreateLabel("Key", 208, 256, 22, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $cbAutoPickup = GUICtrlCreateCheckbox("Auto Pickup", 24, 280, 81, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $cbStopOnRedWeapon = GUICtrlCreateCheckbox("Stop on Red Weapon", 24, 304, 137, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $cbAttackBuffer = GUICtrlCreateCheckbox("Continue Checking After Mob Dies", 24, 328, 185, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) $tbAttackBuffer = GUICtrlCreateInput("", 216, 328, 65, 21) $lblAttackBuffer = GUICtrlCreateLabel("ms", 288, 328, 17, 17) GUICtrlSetBkColor(-1, 0xF1EFE2) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $filemenu = GUICtrlCreateMenu ("&File") ; basic menu $save = GUICtrlCreateMenuitem ("Save",$filemenu) $load = GUICtrlCreateMenuitem ("Load",$filemenu) Global $tBuff1 = TimerInit() Global $tBuff2 = TimerInit() Global $tBuff3 = TimerInit() Global $tBuff4 = TimerInit() Global $tBuff5 = TimerInit() Global $tBuff6 = TimerInit() Global $tPot1 = TimerInit() Global $tPot2 = TimerInit() Global $tPot3 = TimerInit() Global $tPot4 = TimerInit() Global $tPot5 = TimerInit() Global $tPot6 = TimerInit() Global $tSkill1 = TimerInit() Global $tSkill2 = TimerInit() Global $tSkill3 = TimerInit() Global $tSkill4 = TimerInit() Global $tSkill5 = TimerInit() Global $tSkill6 = TimerInit() Global $bFirstBuffs = 1 Global $killCount = 0 Dim $pos[2] Global $color AutoItSetOption("ColorMode", 0) AutoItSetOption("PixelCoordMode") GUISetState() ; make the Window visible $archlord = WinGetTitle("Alef", "") ; getting the full crappy name of Arsch Loot. Sounds like a russion name btw =D HotKeySet("+{F8}", "SetHPColor") HotKeySet("+{F9}", "start") HotkeySet("+{F10}", "idle") HotKeySet("+{F11}", "terminate") While 1 $msg = GUIGetMsg() If $msg = $save Then saveConfig() EndIf If $msg = $load Then loadConfig() EndIf If $msg = $GUI_EVENT_CLOSE Then call("terminate") Endif Wend ;.............................................................................. Func start() $attackstate = 0; While 1 Select Case $attackstate == 0 ;Prepare to attack useBuffs() usePots() $attackstate = 1 Case $attackstate == 1 ;Target a mob Send("+{TAB}") Sleep(500+Random(20,60)) Sleep(1000) If PixelGetColor($pos[0], $pos[1]) == $color Then $attackstate = 2 EndIf Case $attackstate == 2 ; Attack the mob Send("3") Sleep(500+Random(20,60)) useSkills() If PixelGetColor($pos[0], $pos[1]) <> $color Then If GUICtrlRead($cbAttackBuffer) == 1 Then Sleep(GUICtrlRead($tbAttackBuffer)) EndIf $attackstate = 3 EndIf Case $attackstate == 3 spamPickup() reverseDirection() $attackstate = 0 EndSelect WEnd EndFunc ;.............................................................................. Func idle() While 1 WEnd EndFunc ;.............................................................................. Func terminate() exit(0) EndFunc ;.............................................................................. Func useBuffs() If GUICtrlRead($cbBuff1) == 1 Then If TimerDiff($tBuff1) > GUICtrlRead($tbBuffCD1) Then Send(GUICtrlRead($tbBuffKey1)) Sleep(500+Random(20,60)) $tBuff1 = TimerInit() Sleep(1000) EndIf EndIf If GUICtrlRead($cbBuff2) == 1 Then If TimerDiff($tBuff2) > GUICtrlRead($tbBuffCD2) Then Send(GUICtrlRead($tbBuffKey2)) Sleep(500+Random(20,60)) $tBuff2 = TimerInit() Sleep(1000) EndIf EndIf If GUICtrlRead($cbBuff3) == 1 Then If TimerDiff($tBuff3) > GUICtrlRead($tbBuffCD3) Then Send(GUICtrlRead($tbBuffKey3)) Sleep(500+Random(20,60)) $tBuff3 = TimerInit() Sleep(1000) EndIf EndIf If GUICtrlRead($cbBuff4) == 1 Then If TimerDiff($tBuff4) > GUICtrlRead($tbBuffCD4) Then Send(GUICtrlRead($tbBuffKey4)) Sleep(500+Random(20,60)) $tBuff4 = TimerInit() Sleep(1000) EndIf EndIf If GUICtrlRead($cbBuff5) == 1 Then If TimerDiff($tBuff5) > GUICtrlRead($tbBuffCD5) Then Send(GUICtrlRead($tbBuffKey5)) Sleep(500+Random(20,60)) $tBuff5 = TimerInit() Sleep(1000) EndIf EndIf If GUICtrlRead($cbBuff6) == 1 Then If TimerDiff($tBuff6) > GUICtrlRead($tbBuffCD6) Then Send(GUICtrlRead($tbBuffKey6)) Sleep(500+Random(20,60)) $tBuff6 = TimerInit() Sleep(1000) EndIf EndIf EndFunc ;.............................................................................. Func usePots() If GUICtrlRead($cbPot1) == 1 Then If TimerDiff($tPot1) > GUICtrlRead($tbPotCD1) Then Send(GUICtrlRead($tbPotKey1)) Sleep(500+Random(20,60)) $tPot1 = TimerInit() EndIf EndIf If GUICtrlRead($cbPot2) == 1 Then If TimerDiff($tPot2) > GUICtrlRead($tbPotCD2) Then Send(GUICtrlRead($tbPotKey2)) Sleep(500+Random(20,60)) $tPot2 = TimerInit() EndIf EndIf If GUICtrlRead($cbPot3) == 1 Then If TimerDiff($tPot3) > GUICtrlRead($tbPotCD3) Then Send(GUICtrlRead($tbPotKey3)) Sleep(500+Random(20,60)) $tPot3 = TimerInit() EndIf EndIf If GUICtrlRead($cbPot4) == 1 Then If TimerDiff($tPot4) > GUICtrlRead($tbPotCD4) Then Send(GUICtrlRead($tbPotKey4)) Sleep(500+Random(20,60)) $tPot4 = TimerInit() EndIf EndIf If GUICtrlRead($cbPot5) == 1 Then If TimerDiff($tPot5) > GUICtrlRead($tbPotCD5) Then Send(GUICtrlRead($tbPotKey5)) Sleep(500+Random(20,60)) $tPot5 = TimerInit() EndIf EndIf If GUICtrlRead($cbPot6) == 1 Then If TimerDiff($tPot6) > GUICtrlRead($tbPotCD6) Then Send(GUICtrlRead($tbPotKey6)) Sleep(500+Random(20,60)) $tPot6 = TimerInit() EndIf EndIf EndFunc ;.............................................................................. Func useSkills() If GUICtrlRead($cbSkill1) == 1 Then If TimerDiff($tSkill1) > GUICtrlRead($tbSkillCD1) Then Send(GUICtrlRead($tbSkillKey1)) Sleep(500+Random(20,60)) $tSkill1 = TimerInit() EndIf EndIf If GUICtrlRead($cbSkill2) == 1 Then If TimerDiff($tSkill2) > GUICtrlRead($tbSkillCD2) Then Send(GUICtrlRead($tbSkillKey2)) Sleep(500+Random(20,60)) $tSkill2 = TimerInit() EndIf EndIf If GUICtrlRead($cbSkill3) == 1 Then If TimerDiff($tSkill3) > GUICtrlRead($tbSkillCD3) Then Send(GUICtrlRead($tbSkillKey3)) Sleep(500+Random(20,60)) $tSkill3 = TimerInit() EndIf EndIf If GUICtrlRead($cbSkill4) == 1 Then If TimerDiff($tSkill4) > GUICtrlRead($tbSkillCD4) Then Send(GUICtrlRead($tbSkillKey4)) Sleep(500+Random(20,60)) $tSkill4 = TimerInit() EndIf EndIf If GUICtrlRead($cbSkill5) == 1 Then If TimerDiff($tSkill5) > GUICtrlRead($tbSkillCD5) Then Send(GUICtrlRead($tbSkillKey5)) Sleep(500+Random(20,60)) $tSkill5 = TimerInit() EndIf EndIf If GUICtrlRead($cbSkill6) == 1 Then If TimerDiff($tSkill6) > GUICtrlRead($tbSkillCD6) Then Send(GUICtrlRead($tbSkillKey6)) Sleep(500+Random(20,60)) $tSkill6 = TimerInit() EndIf EndIf EndFunc ;.............................................................................. Func spamPickup() If GUICtrlRead($cbAutoPickup) == 1 Then Send("{SPACE}") Sleep(500+Random(20,60)) Send("{SPACE}") Sleep(500+Random(20,60)) Send("{SPACE}") Sleep(500+Random(20,60)) Send("{SPACE}") Sleep(500+Random(20,60)) Send("{SPACE}") Sleep(500+Random(20,60)) EndIf EndFunc ;.............................................................................. Func reverseDirection() If GUICtrlRead($cbUseReversal) == 1 Then If $killCount = GUICtrlRead($tbKills) Then MouseClick("middle") $killCount = 0 ;resetting counter Else $killCount = $killCount + 1 EndIf EndIf EndFunc ;.............................................................................. Func saveConfig() $filename = FileSaveDialog("Choose file...",@ScriptFullPath,"All (*.*)") FileDelete($filename) $file=FileOpen($filename,1) ;Write Buff Settings FileWriteLine($file,GUICtrlRead($cbBuff1)) FileWriteLine($file,GUICtrlRead($tbBuffKey1)) FileWriteLine($file,GUICtrlRead($tbBuffCD1)) FileWriteLine($file,GUICtrlRead($cbBuff2)) FileWriteLine($file,GUICtrlRead($tbBuffKey2)) FileWriteLine($file,GUICtrlRead($tbBuffCD2)) FileWriteLine($file,GUICtrlRead($cbBuff3)) FileWriteLine($file,GUICtrlRead($tbBuffKey3)) FileWriteLine($file,GUICtrlRead($tbBuffCD3)) FileWriteLine($file,GUICtrlRead($cbBuff4)) FileWriteLine($file,GUICtrlRead($tbBuffKey4)) FileWriteLine($file,GUICtrlRead($tbBuffCD4)) FileWriteLine($file,GUICtrlRead($cbBuff5)) FileWriteLine($file,GUICtrlRead($tbBuffKey5)) FileWriteLine($file,GUICtrlRead($tbBuffCD5)) FileWriteLine($file,GUICtrlRead($cbBuff6)) FileWriteLine($file,GUICtrlRead($tbBuffKey6)) FileWriteLine($file,GUICtrlRead($tbBuffCD6)) FileWriteLine($file,GUICtrlRead($cbBuffsUseShift)) ;Write Pot Settings FileWriteLine($file,GUICtrlRead($cbPot1)) FileWriteLine($file,GUICtrlRead($tbPotKey1)) FileWriteLine($file,GUICtrlRead($tbPotCD1)) FileWriteLine($file,GUICtrlRead($cbPot2)) FileWriteLine($file,GUICtrlRead($tbPotKey2)) FileWriteLine($file,GUICtrlRead($tbPotCD2)) FileWriteLine($file,GUICtrlRead($cbPot3)) FileWriteLine($file,GUICtrlRead($tbPotKey3)) FileWriteLine($file,GUICtrlRead($tbPotCD3)) FileWriteLine($file,GUICtrlRead($cbPot4)) FileWriteLine($file,GUICtrlRead($tbPotKey4)) FileWriteLine($file,GUICtrlRead($tbPotCD4)) FileWriteLine($file,GUICtrlRead($cbPot5)) FileWriteLine($file,GUICtrlRead($tbPotKey5)) FileWriteLine($file,GUICtrlRead($tbPotCD5)) FileWriteLine($file,GUICtrlRead($cbPot6)) FileWriteLine($file,GUICtrlRead($tbPotKey6)) FileWriteLine($file,GUICtrlRead($tbPotCD6)) FileWriteLine($file,GUICtrlRead($cbPotsUseShift)) ;Write Skill Settings FileWriteLine($file,GUICtrlRead($cbSkill1)) FileWriteLine($file,GUICtrlRead($tbSkillKey1)) FileWriteLine($file,GUICtrlRead($tbSkillCD1)) FileWriteLine($file,GUICtrlRead($cbSkill2)) FileWriteLine($file,GUICtrlRead($tbSkillKey2)) FileWriteLine($file,GUICtrlRead($tbSkillCD2)) FileWriteLine($file,GUICtrlRead($cbSkill3)) FileWriteLine($file,GUICtrlRead($tbSkillKey3)) FileWriteLine($file,GUICtrlRead($tbSkillCD3)) FileWriteLine($file,GUICtrlRead($cbSkill4)) FileWriteLine($file,GUICtrlRead($tbSkillKey4)) FileWriteLine($file,GUICtrlRead($tbSkillCD4)) FileWriteLine($file,GUICtrlRead($cbSkill5)) FileWriteLine($file,GUICtrlRead($tbSkillKey5)) FileWriteLine($file,GUICtrlRead($tbSkillCD5)) FileWriteLine($file,GUICtrlRead($cbSkill6)) FileWriteLine($file,GUICtrlRead($tbSkillKey6)) FileWriteLine($file,GUICtrlRead($tbSkillCD6)) FileWriteLine($file,GUICtrlRead($cbSkillsUseShift)) FileWriteLine($file,GUICtrlRead($cbUseReversal)) FileWriteLine($file,GUICtrlRead($tbKills)) FileWriteLine($file,GUICtrlRead($cbAutoLoot)) FileWriteLine($file,GUICtrlRead($tbAutoLoot)) FileWriteLine($file,GUICtrlRead($cbAutoPickup)) FileWriteLine($file,GUICtrlRead($cbStopOnRedWeapon)) FileClose($file) EndFunc ;.............................................................................. Func loadConfig() $filename = FileOpenDialog("Choose File...",@ScriptFullPath,"ALL (*.*)") $file = FileOpen($filename, 0) ;Read Buff Settings GUICtrlSetState($cbBuff1,FileReadLine($file)) GUICtrlSetData($tbBuffKey1,FileReadLine($file)) GUICtrlSetData($tbBuffCD1,FileReadLine($file)) GUICtrlSetState($cbBuff2,FileReadLine($file)) GUICtrlSetData($tbBuffKey2,FileReadLine($file)) GUICtrlSetData($tbBuffCD2,FileReadLine($file)) GUICtrlSetState($cbBuff3,FileReadLine($file)) GUICtrlSetData($tbBuffKey3,FileReadLine($file)) GUICtrlSetData($tbBuffCD3,FileReadLine($file)) GUICtrlSetState($cbBuff4,FileReadLine($file)) GUICtrlSetData($tbBuffKey4,FileReadLine($file)) GUICtrlSetData($tbBuffCD4,FileReadLine($file)) GUICtrlSetState($cbBuff5,FileReadLine($file)) GUICtrlSetData($tbBuffKey5,FileReadLine($file)) GUICtrlSetData($tbBuffCD5,FileReadLine($file)) GUICtrlSetState($cbBuff6,FileReadLine($file)) GUICtrlSetData($tbBuffKey6,FileReadLine($file)) GUICtrlSetData($tbBuffCD6,FileReadLine($file)) GUICtrlSetState($cbBuffsUseShift,FileReadLine($file)) ;Read Pot Settings GUICtrlSetState($cbPot1,FileReadLine($file)) GUICtrlSetData($tbPotKey1,FileReadLine($file)) GUICtrlSetData($tbPotCD1,FileReadLine($file)) GUICtrlSetState($cbPot2,FileReadLine($file)) GUICtrlSetData($tbPotKey2,FileReadLine($file)) GUICtrlSetData($tbPotCD2,FileReadLine($file)) GUICtrlSetState($cbPot3,FileReadLine($file)) GUICtrlSetData($tbPotKey3,FileReadLine($file)) GUICtrlSetData($tbPotCD3,FileReadLine($file)) GUICtrlSetState($cbPot4,FileReadLine($file)) GUICtrlSetData($tbPotKey4,FileReadLine($file)) GUICtrlSetData($tbPotCD4,FileReadLine($file)) GUICtrlSetState($cbPot5,FileReadLine($file)) GUICtrlSetData($tbPotKey5,FileReadLine($file)) GUICtrlSetData($tbPotCD5,FileReadLine($file)) GUICtrlSetState($cbPot6,FileReadLine($file)) GUICtrlSetData($tbPotKey6,FileReadLine($file)) GUICtrlSetData($tbPotCD6,FileReadLine($file)) GUICtrlSetState($cbPotsUseShift,FileReadLine($file)) ;Read Skill Settings GUICtrlSetState($cbSkill1,FileReadLine($file)) GUICtrlSetData($tbSkillKey1,FileReadLine($file)) GUICtrlSetData($tbSkillCD1,FileReadLine($file)) GUICtrlSetState($cbSkill2,FileReadLine($file)) GUICtrlSetData($tbSkillKey2,FileReadLine($file)) GUICtrlSetData($tbSkillCD2,FileReadLine($file)) GUICtrlSetState($cbSkill3,FileReadLine($file)) GUICtrlSetData($tbSkillKey3,FileReadLine($file)) GUICtrlSetData($tbSkillCD3,FileReadLine($file)) GUICtrlSetState($cbSkill4,FileReadLine($file)) GUICtrlSetData($tbSkillKey4,FileReadLine($file)) GUICtrlSetData($tbSkillCD4,FileReadLine($file)) GUICtrlSetState($cbSkill5,FileReadLine($file)) GUICtrlSetData($tbSkillKey5,FileReadLine($file)) GUICtrlSetData($tbSkillCD5,FileReadLine($file)) GUICtrlSetState($cbSkill6,FileReadLine($file)) GUICtrlSetData($tbSkillKey6,FileReadLine($file)) GUICtrlSetData($tbSkillCD6,FileReadLine($file)) GUICtrlSetState($cbSkillsUseShift,FileReadLine($file)) GUICtrlSetState($cbUseReversal,FileReadLine($file)) GUICtrlSetData($tbKills,FileReadLine($file)) GUICtrlSetState($cbAutoLoot,FileReadLine($file)) GUICtrlSetData($tbAutoLoot,FileReadLine($file)) GUICtrlSetState($cbAutoPickup,FileReadLine($file)) GUICtrlSetState($cbStopOnRedWeapon,FileReadLine($file)) FileClose($file) EndFunc Func SetHPColor() $pos = MouseGetPos() $color = PixelGetColor ( $pos[0] , $pos[1] ) ConsoleWrite("pos[0] = " + $pos[0] + @CRLF) ConsoleWrite("pos[1] = " + $pos[1] + @CRLF) ConsoleWrite("$color = " + $color + @CRLF) EndFunc Edited November 9, 2006 by mvriesen2004
mvriesen2004 Posted November 9, 2006 Author Posted November 9, 2006 Ok - I'm still having problems with this and it seems that the PixelGetColor is flakey (but the code is much cooler). The pixel color checks in the start() function seem to break lock and allow another mob to be targeted before the current mob is dead. In essence, the color check is failing. Any ideas?
jokke Posted November 9, 2006 Posted November 9, 2006 Well i dont bother to read all your code but you use something like this. Code under is how i managed the problem with my bot. First it scans for monster until it gets a target wich have 100% health. (this works good for not targeting monsters allready inn combat) Then it starts fight. Sending the start-fight function/key until target health is under 99% Then waits for monster to die. Do ;Get target. Send("{SPACE}") ;well i get target with my bot using space. Sleep(Random(1500,2000)) $GetTargetHealth = GetTargetHealth() Until $GetTargetHealth = 100 Do ;Start Fight. Send() ;you combat start key or function. Sleep(Random(1500,2000)) ; this is so bot does not hammer on your send. $GetTargetHealth = GetTargetHealth() ;for knowing when target is dropping health. Until $GetTargetHealth < 99 Do ;Wait for mob to die! Sleep(100) $GetTargetHealth = GetTargetHealth() Until $GetTargetHealth = -1 ; My default value for either no target / dead target. Func GetTargetHealth() ;my health search goes here. EndFunc UDF:Crypter a file encrypt / decrypt tool with no need to remember a password again. Based on Caesar cipher using entire ASCII Table.Script's: PixelSearch Helper, quick and simple way to create a PixelSeach.Chatserver - simplified, not so complicated multi-socket server.AutoIT - Firewall, simple example on howto create a firewall with AutoIt.
mvriesen2004 Posted November 9, 2006 Author Posted November 9, 2006 Thanks for the reply jokke, I learned something. I need to do a check to see if the mob is at 100% so that I don't kill steal other players. I did try the delay when the mob dies, but in some cases I still seem to retarget too soon. This leaves a mob that still has health and it continues to beat on me. Infact, in some cases, the mob has as much as 1/4 of its health which makes me believe that something else is going on. In particular: 1) the PixelGetColor might not be working properly 2) the pixel color may be changing (in the game client due to day/night/weather/shadow) 3) the Timers are triggering activity that I don't understand 4) my code is fubar. I don't think 2 or 3 are happening, but maybe I sould write a script to sample a pixel color and log messages to a data file when it changes. Is there a sample of logging data to a text file? I'll do a search on this site when I get home from work. Anyone else have any ideas? Thanks!!!!
madmax Posted January 16, 2007 Posted January 16, 2007 Try to use a while statement to keep attack your target until the target is dead. While $targetDeadColor <> $MonsterDead Attack ..... Wend
mvriesen2004 Posted January 23, 2007 Author Posted January 23, 2007 Try to use a while statement to keep attack your target until the target is dead.While $targetDeadColor <> $MonsterDead Attack .....WendYeah - I got this working. My problem is that the PixelGetColor function is not synched with the raster update of the display. I ran the script from DrGamut (http://www.autoitscript.com/forum/index.php?showtopic=32377) and got the same result. Thus, the pixel values read in the screen are not reliable.Oh well.
alex OF DEATH Posted January 23, 2007 Posted January 23, 2007 Yeah - I got this working. My problem is that the PixelGetColor function is not synched with the raster update of the display. I ran the script from DrGamut (http://www.autoitscript.com/forum/index.php?showtopic=32377) and got the same result. Thus, the pixel values read in the screen are not reliable.Oh well.You can do it with memory.Thats all the help I can really give :\
madmax Posted January 24, 2007 Posted January 24, 2007 Yeah - I got this working. My problem is that the PixelGetColor function is not synched with the raster update of the display. I ran the script from DrGamut (http://www.autoitscript.com/forum/index.php?showtopic=32377) and got the same result. Thus, the pixel values read in the screen are not reliable.Oh well.Are you using Hex or Dec for your color? I found that Hex worked find on one system and now another. I changed to using Dec and that worked fine for me. If you are using a color value in Hex try switching to Dec
mvriesen2004 Posted February 19, 2007 Author Posted February 19, 2007 Are you using Hex or Dec for your color? I found that Hex worked find on one system and now another. I changed to using Dec and that worked fine for me. If you are using a color value in Hex try switching to DecI tried both hex and decimal values and both work fine. The problem is that the pixel values are being updated on the screen during the execution of the PixelGetColor method. Thus, the ability to read mob health from the screen is limited. I have worked aound this by sampling the same pixel value many times and then taking the maximum value and it seems to work reasonably well. However, it can be time consuming on high performance systems as sometimes 30+ samples are required.I am aware that I can read memory to get the HP value of the mobs. However, noone has gotten this to work reliably since the memory location changes on every system.
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