Hallo zusammen,
hintergrund der Angelegenheit ist das ich ein functions sammlung anlegen möchte womit ich dann Bots erstellen kann ohne sie jedesmal einfügen zumüssen.
Nun habe ich mir den Killroy Bot als vorlage genommen und einige Functionen eingesetzt und sie angepasst.
Wenn der Bot nun seinen Run beendet und die drops identifieziert hat beginnt er zwar die zu Verkaufen aber spätestens beim 2 item geht der Arbeitsspeicher so hoch (um die 1,3GB) das AutoIt sich beendet mit der Fehlermeldung
Aufgrund meiner kleinen Post Anzahl wird es nicht angezeigt - FYI
[Only registered and activated users can see links. Click Here To Register...]
Leider finde ich den fehler nicht, ich glaube aber es wird an der CanSell() function liegen, vllt. habe ich den loop iwo nicht richtig beendet - jedenfalls sehe ich den wald vor lauter bäumen nicht. Erschwärend hinzu kommt, dass ich AutoIt erst seid kurzem nutze.
Vllt. kann sich mal jemand durch wurschteln und mir sagen wo der fehler liegt?
Die Source ist anbei.
Und hier als Spoiler:
Ich bedanke mich schon einmal und Wünsche schönes Wochenende
grüße
zer0.de
hintergrund der Angelegenheit ist das ich ein functions sammlung anlegen möchte womit ich dann Bots erstellen kann ohne sie jedesmal einfügen zumüssen.
Nun habe ich mir den Killroy Bot als vorlage genommen und einige Functionen eingesetzt und sie angepasst.
Wenn der Bot nun seinen Run beendet und die drops identifieziert hat beginnt er zwar die zu Verkaufen aber spätestens beim 2 item geht der Arbeitsspeicher so hoch (um die 1,3GB) das AutoIt sich beendet mit der Fehlermeldung
Aufgrund meiner kleinen Post Anzahl wird es nicht angezeigt - FYI
[Only registered and activated users can see links. Click Here To Register...]
Leider finde ich den fehler nicht, ich glaube aber es wird an der CanSell() function liegen, vllt. habe ich den loop iwo nicht richtig beendet - jedenfalls sehe ich den wald vor lauter bäumen nicht. Erschwärend hinzu kommt, dass ich AutoIt erst seid kurzem nutze.
Vllt. kann sich mal jemand durch wurschteln und mir sagen wo der fehler liegt?
Die Source ist anbei.
Und hier als Spoiler:
Code:
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <EditConstants.au3> #include "GWA2.au3" ; ToDo ; ; ; ; Global $maxAllowdEnergy = 70 Global $useScroll = False Global $mode = "NormalMode" ;Normal Mode or Hard Mode ;HotKeySet("{home}","toTownPause") Global $boolRun = False Global $lockpins = False Global $intRuns = 0 Global $intAdrenaline[7] = [0, 0, 0, 100, 250, 175, 0] Global $ALE = 5585 Global $AGED_ALE = 24593 Global Const $ITEM_ID_Dyes = 146 Global Const $ITEM_ID_Glacial_Stones = 27047 ;new globals & Arrays #Region Global Items Global Const $RARITY_Gold = 2624 Global Const $RARITY_Purple = 2626 Global Const $RARITY_Blue = 2623 Global Const $RARITY_White = 2621 ;~ Materials Global $All_Materials_Array[36] = [921, 922, 923, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 948, 949, 950, 951, 952, 953, 954, 955, 956, 6532, 6533] Global $Common_Materials_Array[11] = [921, 925, 929, 933, 934, 940, 946, 948, 953, 954, 955] Global $Rare_Materials_Array[25] = [922, 923, 926, 927, 928, 930, 931, 932, 935, 936, 937, 938, 939, 941, 942, 943, 944, 945, 949, 950, 951, 952, 956, 6532, 6533] ;~ Tomes Global $All_Tomes_Array[20] = [21796, 21797, 21798, 21799, 21800, 21801, 21802, 21803, 21804, 21805, 21786, 21787, 21788, 21789, 21790, 21791, 21792, 21793, 21794, 21795] ;~ All Weapon mods Global $Weapon_Mod_Array[25] = [893, 894, 895, 896, 897, 905, 906, 907, 908, 909, 6323, 6331, 15540, 15541, 15542, 15543, 15544, 15551, 15552, 15553, 15554, 15555, 17059, 19122, 19123] ;~ General items Global $General_Items_Array[6] = [2989, 2991, 2992, 5899, 5900, 22751] Global Const $ITEM_ID_Lockpicks = 22751 ;~PCons Global $Array_pscon[39]=[910, 5585, 6366, 6375, 22190, 24593, 28435, 30855, 31145, 35124, 36682, 6376, 21809, 21810, 21813, 36683, 21492, 21812, 22269, 22644, 22752, 28436,15837, 21490, 30648, 31020, 6370, 21488, 21489, 22191, 26784, 28433, 5656, 18345, 21491, 37765, 21833, 28433, 28434] ;~Map pieces Global $Map_Piece_Array[4] = [24629, 24630, 24631, 24632] #EndRegion Global Items Opt("GUIOnEventMode", 1) $cGUI = GUICreate("GWA² - Kilroy Stonekin", 270, 142, 200, 180) ;$cbxHideGW = GUICtrlCreateCheckbox("Disable Graphics", 10, 8, 105, 17) $lblRuns = GUICtrlCreateLabel("Total Runs: 0", 115, 9, 132, 17, $SS_CENTER) GUICtrlCreateLabel("Password:", 8, 32, 80, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE)) $txtPW = GUICtrlCreateInput("", 100, 32, 162, 20, BitOR($ES_CENTER, $ES_AUTOHSCROLL,$ES_PASSWORD)) $cbxPack = GUICtrlCreateCheckbox("Pack", 10, 56, 50, 17) GUICtrlSetState(-1, $GUI_Checked) $cbxPouch = GUICtrlCreateCheckbox("Pouch", 75, 56, 50, 17) GUICtrlSetState(-1, $GUI_UNCHECKED) $cbxBag1 = GUICtrlCreateCheckbox("Bag 1", 140, 56, 50, 17) GUICtrlSetState(-1, $GUI_UNCHECKED) $cbxBag2 = GUICtrlCreateCheckbox("Bag 2", 205, 56, 50, 17) GUICtrlSetState(-1, $GUI_UNCHECKED ) $lblStatus = GUICtrlCreateLabel("Ready to begin", 8, 84, 256, 17, $SS_CENTER) $btnStart = GUICtrlCreateButton("Start", 7, 108, 256, 25, $WS_GROUP) GUISetOnEvent($GUI_Event_Close, "EventHandler", $cGUI) ;GUICtrlSetOnEvent($cbxHideGW, "EventHandler") GUICtrlSetOnEvent($btnStart, "EventHandler") GUISetState(@SW_SHOW) While 1 Sleep(100) If $boolRun Then ClearMemory() PingSleep(150) GoToTown() If CountFreeSpace() Then ContinueLoop AdlibRegister ("CrashCheck",500) TakeQuest() If RunQuest() Then GoToTown() Update("Energy was too high, run aborted") RndSleep(3000) EndIf $intRuns += 1 GUICtrlSetData($lblRuns, "Total Runs: " & $intRuns) If NOT $boolRun Then AdlibUnRegister("CrashCheck") Update("Bot paused by user") ;GUICtrlSetState($txtName, $GUI_Enable) GUICtrlSetData($btnStart, "Start") GUICtrlSetState($btnStart, $GUI_Enable) $boolRun = False EndIf EndIf WEnd Func toTownPause() GoToTown() MsgBox(0,"","Stopped") Exit EndFunc Func EventHandler() Switch (@GUI_CtrlId) Case $btnStart Initialize(ProcessExists("gw.exe"),True,True) $oStats_Lockpicks = DllStructGetData(GetItemByModelID(22751), 'Quantity') If $oStats_Lockpicks = 0 Then ;debug only ;MsgBox(0, "Error", "No Lockpins found pls activate the auto-purchase") $lockpins = False Else ;debug only ;MsgBox(0, "Info", "Lockpins found and i use it") $lockpins = True EndIf EnsureEnglish(1) $boolRun = NOT $boolRun If $boolRun Then GUICtrlSetData($btnStart, "Pause") Else GUICtrlSetData($btnStart, "BOT WILL HALT AFTER THIS RUN") GUICtrlSetState($btnStart, $GUI_Disable) EndIf Case $GUI_Event_Close Exit EndSwitch EndFunc Func TakeQuest() Do Update("Taking quest") GoNearestNPCToCoords(17320, -4900) RndSleep(850) AcceptQuest(856) RndSleep(1000) GoNPC(GetNearestNPCToCoords(17320, -4900)) RndSleep(1000) Dialog(0x00000085) WaitForLoad() RndSleep(650) Until GetMapID() = 704 EndFunc Func RunQuest() If $useScroll Then UseScroll() RndSleep(1500) If AggroMoveToEx(-11040, -16400) Then Return 1 If AggroMoveToEx(-3585, -15915) Then Return 1 If AggroMoveToEx(-1081, -14387) Then Return 1 If AggroMoveToEx(3788, -16406) Then Return 1 MoveTo(5724,-15148) MoveTo(5053,-15835) Do RndSleep(750) GetNearestEnemyToAgent(-2) $distance = [MENTION=368499]Extended[/MENTION] Until $distance < 700 If AggroMoveToEx(8913, -16174) Then Return 1 If AggroMoveToEx(12900, -16065) Then Return 1 Update("Opening final chest") RndSleep(100) $agent = GetNearestSignpostToCoords(13275,-16039) ChangeTarget($agent) MoveTo(DllStructGetData($agent, 'X'),DllStructGetData($agent, 'Y')) RndSleep(500) GoSignpost($agent) RndSleep(2000) Update("Picking up ale") PickupItems() RndSleep(2000) GoToTown() Update("Accepting quest reward") $count = 0 Do GoNearestNPCToCoords(17320, -4900) RndSleep(1000) ;Dialog(0x00835807) QuestReward(856) RndSleep(1000) $count+=1 Until GetQuestByID(856) = 0 or $count>1 RndSleep(1000) $oldRegion = GetRegion() Do $region = $oldRegion If $region = 4294967294 Then $region = -1 $region += 1 If $region > 4 Then $region = -2 ChangeRegion($region) RndSleep(1000) Until $oldRegion <> GetRegion() EndFunc Func Fight($z, $s = "enemies") Update("Fighting " & $s & "!") RndSleep(500) $target = 0 $distance = 99999999 ;Do ; RndSleep(250) ; $enemyId = GetNearestAliveEnemyToAgent() ;Until $enemyId[0] <> 0 $skillbar = GetSkillbar() $bar = 7 $skillId = DllStructGetData($skillbar, 'Id7') If $skillId = 0 Then $bar = 6 Do $skillbar = GetSkillbar() $skillRecharge = DllStructGetData($skillbar, 'Recharge8') If $skillRecharge = 0 Or GetEnergy() = 0 Then Update("Standing back up!") Do $skillbar = GetSkillbar() $Me = GetAgentByID() $maxEnergy = DllStructGetData($Me, 'MaxEnergy') If $maxEnergy > $maxAllowdEnergy Then Return 1 If $maxEnergy <> GetEnergy() Then UseSkill(8,$Me) $skillRecharge = DllStructGetData($skillbar, 'Recharge8') RndSleep(50) Until $skillRecharge <> 0 Update("Fighting " & $s & "!") EndIf ; Update to priority attack Ettins $ettinID = GetNearestEttin() If $ettinID <> 0 Then $Me = GetAgentByID(-2) $ettinDistance = ComputeDistance(DllStructGetData($Me, 'X'),DllStructGetData($Me, 'Y'),DllStructGetData($ettinID, 'X'),DllStructGetData($ettinID, 'Y')) If $ettinDistance<$z Then $target = $ettinID $distance = $ettinDistance EndIf EndIf $dead = false $target = GetAgentByID(DllStructGetData($target, 'Id')) If (DllStructGetData($target, 'HP') < 0.005) Then $dead = true EndIf If DllStructGetData($target, 'Id') = 0 OR $distance > $z OR $dead Then $target = GetLowestEnemyToAgent(-2) $distance = [MENTION=368499]Extended[/MENTION] ;ConsoleWrite("New target: " & DllStructGetData($target, 'Id') & " distance= " & $distance & " dead=" & $dead & [MENTION=3576271]CRLF[/MENTION]) EndIf ; Update to fight Lt. Maghma last If GetAgentName($target) = "Lieutenant Mahgma" Then $possibleTarget = GetLowestEnemyToAgentExcludingMaghma() $targetDistance = [MENTION=368499]Extended[/MENTION] If $targetDistance<$z Then $target = $possibleTarget $distance = $targetDistance EndIf EndIf ; Update to use blocking skills $block = 0 $skillbar = GetSkillbar() $skillRecharge = DllStructGetData($skillbar, 'Recharge1') If $skillRecharge = 0 Then $block = 1 $useSkill = -1 For $i = $bar To 2 Step -1 $recharged = DllStructGetData($skillbar, 'Recharge'& $i) $strikes = DllStructGetData($skillbar, 'AdrenalineB'& $i) If $recharged = 0 AND $intAdrenaline[$i-1] <= $strikes Then $useSkill = $i ExitLoop EndIf Next If ($useSkill <> -1 OR $block) AND $target <> 0 AND $distance < $z Then ChangeTarget($target) RndSleep(150) If $dead = True Then If DllStructGetData(GetSkillbar(), 'Recharge8') = 0 Or GetEnergy() = 0 Then ContinueLoop Attack($target) EndIf RndSleep(150) If $block Then If DllStructGetData(GetSkillbar(), 'Recharge8') = 0 Or GetEnergy() = 0 Then ContinueLoop UseSkill(1,$target) RndSleep(500) EndIf $skillbar = GetSkillbar() If DllStructGetData($skillbar, 'Recharge8') = 0 Or GetEnergy() = 0 Then ContinueLoop UseSkill($useSkill,$target) EndIf RndSleep(500) ;ConsoleWrite($target & " " & $distance & [MENTION=3576271]CRLF[/MENTION]) Until DllStructGetData($target, 'Id') = 0 OR $distance > $z Update("Picking up items") PickupItems(-1,$z * 1.5) RndSleep(500) ;after a fight and pickup check if a Chest is there to use and a lockpin is found If $lockpins Then Update("Check if Chest in Area") FindAndOpenChest() EndIf Return 0 EndFunc Func IDAndSell() Update("Cleaning inventory") MoveTo(17967, -7522) GoNearestNPCToCoords(17800, -7600) If GUICtrlRead($cbxPack) = 1 Then Ident(1) If GUICtrlRead($cbxPouch) = 1 Then Ident(2) If GUICtrlRead($cbxBag1) = 1 Then Ident(3) If GUICtrlRead($cbxBag2) = 1 Then Ident(4) ;Identify twice to prevent selling unid items If GUICtrlRead($cbxPack) = 1 Then Ident(1) If GUICtrlRead($cbxPouch) = 1 Then Ident(2) If GUICtrlRead($cbxBag1) = 1 Then Ident(3) If GUICtrlRead($cbxBag2) = 1 Then Ident(4) If GUICtrlRead($cbxPack) = 1 Then Sell(1) If GUICtrlRead($cbxPouch) = 1 Then Sell(2) If GUICtrlRead($cbxBag1) = 1 Then Sell(3) If GUICtrlRead($cbxBag2) = 1 Then Sell(4) EndFunc ;Old Func ;Func CanSell($q, $m) ; If $m = 0 OR $q > 1 Then ; Return False ; ElseIf $m = 146 OR $m = 22751 Then ;Dyes/Lockpicks ; Return False ; ElseIf $m = 2991 OR $m = 2992 Or $m = 2989 Or $m = 5899 Then ;ID/Salvage ; Return False ; ElseIf $m = $ALE OR $m = $AGED_ALE Then ;Dwarven Ale/Aged Dwarven Ale ; Return False ; ElseIf $m > 21785 And $m < 21806 Then ;Elite/Normal Tomes ; Return False ; ElseIf $m = 933 or $m = 835 Then ;plumes / crest ; Return False ; ElseIf $m = 5594 OR $m = 5595 OR $m = 5611 OR $m = 5853 OR $m = 5975 OR $m = 5976 OR $m = 21233 AND ($useScroll = True) Then ; Return False ; Else ; Return True ; EndIf ;EndFunc ;New Func Func CanSell($q, $lModelID) Local $LRARITY = GetRarity($lModelID) Local $Requirement = GetItemReq($lModelID) If $lModelID = 0 OR $q > 1 Then Return False EndIf If $LRARITY == $RARITY_Gold Then Return True EndIf If $LRARITY == $RARITY_Purple Then Return True EndIf ;~ Going to make it salvage them at some point in the future. If $LRARITY == $RARITY_Blue Then Return True EndIf If $LRARITY == $RARITY_White Then Return True EndIf If $lModelID == 2991 OR $lModelID == 2992 Or $lModelID == 2989 Or $lModelID == 5899 Then Return False ;ID/Salvage If $lModelID == $ALE OR $lModelID == $AGED_ALE Then Return False ;Dwarven Ale/Aged Dwarven Ale If $lModelID == $ITEM_ID_Dyes Then ; store only Black & White ? uncommend the 2 lines ;Switch DllStructGetData($aitem, "ExtraID") ; Case $ITEM_ExtraID_BlackDye, $ITEM_ExtraID_WhiteDye ; Return False ; Case Else ; Return True ;EndSwitch Return False EndIf If CheckArrayTomes($lModelID) Then Return False If CheckArrayMaterials($lModelID) Then Return False ; All weapon mods If CheckArrayWeaponMods($lModelID) Then Return False ; ==== General ==== If CheckArrayGeneralItems($lModelID) Then Return False ; Lockpicks, Kits If $lModelID == $ITEM_ID_Glacial_Stones Then Return False If CheckArrayPscon($lModelID) Then Return False ; ==== Stupid Drops = If CheckArrayMapPieces($lModelID) Then Return False Return True EndFunc ;==>CanSell Func GoToTown() TravelTo(644) RndSleep(1500) EndFunc Func Update($text) GUICtrlSetData($lblStatus, $text) EndFunc Func WaitForLoad($s = "Loading map") Local $lMe Update($s) Do Sleep(200) $lMe = GetAgentByID(-2) Until DllStructGetData($lMe, 'X') <> 0 Or DllStructGetData($lMe, 'Y') <> 0 RndSleep(4000) Update("Load complete") EndFunc Func Ident($bagIndex) $bag = GetBag($bagIndex) For $i = 0 To DllStructGetData($bag, 'slots')-1 Update("Identifying item: " & $bagIndex & ", " & $i) If FindIDKit() = 0 Then If GetGoldCharacter() < 500 AND GetGoldStorage() > 499 Then WithdrawGold(500) Sleep(Random(200,300)) EndIf Do BuyIDKit() RndSleep(500) Until FindIDKit() <> 0 RndSleep(500) EndIf $aitem = GetItemBySlot($bagIndex, $i) If DllStructGetData($aItem, 'ID') = 0 Then ContinueLoop IdentifyItem($aItem) Sleep(Random(500,750)) Next EndFunc Func Sell($bagIndex) $bag = GetBag($bagIndex) $numOfSlots = DllStructGetData($bag, 'slots')-1 For $i = 0 To $numOfSlots Update("Selling item: " & $bagIndex & ", " & $i) $item = GetItemBySlot($bagIndex, $i) If CanSell( DllStructGetData($item, 'quantity'), DllStructGetData($item, 'ModelID')) Then SellItem($item) EndIf RndSleep(550) Next EndFunc Func AggroMoveToEx($x, $y, $s = "enemies", $z = 2000) Update("Hunting " & $s) Move($x, $y) $iBlocked = 0 $cbType = "float" Local $coords[2] $Me = GetAgentByID() $coords[0] = DllStructGetData($Me, 'X') $coords[1] = DllStructGetData($Me, 'Y') Do RndSleep(250) $oldCoords = $coords $enemy = GetLowestEnemyToAgent(-2) $Me = GetAgentByID() $distance = ComputeDistance(DllStructGetData($Me, 'X'), DllStructGetData($Me, 'Y'), DllStructGetData($enemy, 'X'), DllStructGetData($enemy, 'Y')) If $distance < $z AND $enemy <> 0 Then If Fight($z, $s) Then Return 1 Update("Hunting " & $s) EndIf $Me = GetAgentByID() $coords[0] = DllStructGetData($Me, 'X') $coords[1] = DllStructGetData($Me, 'Y') If $oldCoords[0] = $coords[0] AND $oldCoords[1] = $coords[1] Then $iBlocked += 1 Move($coords[0], $coords[1], 1500) RndSleep(1500) Move($x, $y) EndIf Until ComputeDistance($coords[0], $coords[1], $x, $y) < 250 OR $iBlocked > 20 ;ConsoleWrite("Reached destination: " & $x & "," & $y & [MENTION=3576271]CRLF[/MENTION]) EndFunc Func ChangeRegion($aRegion) ;returns true if successful ;-2 = international, 0 = america, 1 = asia korean, 2 = europe, 3 = asia chinese, 4 = asia japanese If ($aRegion <-1 Or $aRegion >4) And $aRegion <> -2 Then Return False If GetRegion() = $aRegion Then Return True MoveMap(GetMapID(), $aRegion, 0, GetLanguage()); Return WaitMapLoading() EndFunc ;==>ChangeRegion Func UseScroll() $item = GetItemByModelID(21233) If DllStructGetData($item, 'Bag') <> 0 Then Update("Using Lightbringer Scroll") UseItem($item) Return EndIf $item = GetItemByModelID(5595) If DllStructGetData($item, 'Bag') <> 0 Then Update("Using Berserkers Insight") UseItem($item) Return EndIf $item = GetItemByModelID(5611) If DllStructGetData($item, 'Bag') <> 0 Then Update("Using Slayers Insight") UseItem($item) Return EndIf $item = GetItemByModelID(5594) If DllStructGetData($item, 'Bag') <> 0 Then Update("Using Heros Insight") UseItem($item) Return EndIf $item = GetItemByModelID(5975) If DllStructGetData($item, 'Bag') <> 0 Then Update("Using Rampagers Insight") UseItem($item) Return EndIf $item = GetItemByModelID(5976) If DllStructGetData($item, 'Bag') <> 0 Then Update("Using Hunters Insight") UseItem($item) Return EndIf $item = GetItemByModelID(5853) If DllStructGetData($item, 'Bag') <> 0 Then Update("Using Adventurers Insight") UseItem($item) Return EndIf Update("No scrolls found") EndFunc Func CountFreeSpace() If CountSlots() < 18 Then IDAndSell() Else Return False EndIf $gold = GetGoldCharacter() If $gold > 75000 Then DepositGold() If CountSlots() < 10 Then Update("Low on free space") $boolRun = False ;GUICtrlSetState($txtName, $GUI_Enable) GUICtrlSetData($btnStart, "Start") GUICtrlSetState($btnStart, $GUI_Enable) Return True EndIf EndFunc Func CountSlots() $temp = 0 If GUICtrlRead($cbxPack) = 1 Then $bag = GetBag(1) $temp += DllStructGetData($bag, 'slots') - DllStructGetData($bag, 'ItemsCount') EndIf If GUICtrlRead($cbxPouch) = 1 Then $bag = GetBag(2) $temp += DllStructGetData($bag, 'slots') - DllStructGetData($bag, 'ItemsCount') EndIf If GUICtrlRead($cbxBag1) = 1 Then $bag = GetBag(3) $temp += DllStructGetData($bag, 'slots') - DllStructGetData($bag, 'ItemsCount') EndIf If GUICtrlRead($cbxBag2) = 1 Then $bag = GetBag(4) $temp += DllStructGetData($bag, 'slots') - DllStructGetData($bag, 'ItemsCount') EndIf Return $temp EndFunc Func GoNearestNPCToCoords($x, $y) Local $NPC MoveTo($x, $y) $NPC = GetNearestNPCToCoords($x, $y) Do PingSleep(250) GoNPC($NPC) Until GetDistance($NPC, -2) < 250 PingSleep(500) EndFunc Func CrashCheck() If WinExists("Gw.exe") Then Update("Crashed") $GWPath = _ProcessGetLocation(ProcessExists("gw.exe")) MemoryClose() ProcessClose("gw.exe") RndSleep(250) Run($GWPath & " -password " & GUICtrlRead($txtPW)) WinWait("Guild Wars") Sleep(2000) Global $mLabels[1][2] Initialize(ProcessExists("gw.exe")) Do ControlSend("[CLASS:ArenaNet_Dx_Window_Class]","","","y") ;Send "y" to accept reconnect if you've dced outside. It won't reconnect if you dc'ed in an outpost RndSleep(500) $me = GetAgentByID(-2) Until DllStructGetData($me, 'X') <> 0 Or DllStructGetData($me, 'Y') <> 0 RndSleep(3000) GoToTown() MsgBox(0,"Error","Crashed please restart") Exit EndIf EndFunc Func _ProcessGetLocation($iPID) Local $aProc = DllCall('kernel32.dll', 'hwnd', 'OpenProcess', 'int', BitOR(0x0400, 0x0010), 'int', 0, 'int', $iPID) If $aProc[0] = 0 Then Return SetError(1, 0, '') Local $vStruct = DllStructCreate('int[1024]') DllCall('psapi.dll', 'int', 'EnumProcessModules', 'hwnd', $aProc[0], 'ptr', DllStructGetPtr($vStruct), 'int', DllStructGetSize($vStruct), 'int_ptr', 0) Local $aReturn = DllCall('psapi.dll', 'int', 'GetModuleFileNameEx', 'hwnd', $aProc[0], 'int', DllStructGetData($vStruct, 1), 'str', '', 'int', 2048) If StringLen($aReturn[3]) = 0 Then Return SetError(2, 0, '') Return $aReturn[3] EndFunc Func GetNearestEttin() Local $lNearestAgent = 0, $lNearestDistance = 100000000 Local $lDistance, $lAgentToCompare Local $aAgent = GetAgentByID(-2) For $i = 1 To GetMaxAgents() $lAgentToCompare = GetAgentByID($i) If DllStructGetData($lAgentToCompare, 'HP') < 0.005 Or DllStructGetData($lAgentToCompare, 'Allegiance') <> 0x3 Or DllStructGetData($lAgentToCompare, 'Type') <> 0xDB Or GetAgentName($lAgentToCompare) <> "Enslaved Ettin" Then ContinueLoop $lDistance = (DllStructGetData($aAgent, 'X') - DllStructGetData($lAgentToCompare, 'X')) ^ 2 + (DllStructGetData($aAgent, 'Y') - DllStructGetData($lAgentToCompare, 'Y')) ^ 2 If $lDistance < $lNearestDistance Then $lNearestAgent = $lAgentToCompare $lNearestDistance = $lDistance EndIf Next Return $lNearestAgent EndFunc ;==>GetNearestEttin Func GetLowestEnemyToAgent($aAgent) Local $lNearestAgent = 0, $lNearestDistance = 100000000 Local $lDistance, $lAgentToCompare Local $lLowestHP = 100,$lHP If IsDllStruct($aAgent) = 0 Then $aAgent = GetAgentByID($aAgent) For $i = 1 To GetMaxAgents() $lAgentToCompare = GetAgentByID($i) $lHP = DllStructGetData($lAgentToCompare, 'HP') If $lHP < 0.005 Or DllStructGetData($lAgentToCompare, 'Allegiance') <> 0x3 Or DllStructGetData($lAgentToCompare, 'Type') <> 0xDB Then ContinueLoop $lDistance = (DllStructGetData($aAgent, 'X') - DllStructGetData($lAgentToCompare, 'X')) ^ 2 + (DllStructGetData($aAgent, 'Y') - DllStructGetData($lAgentToCompare, 'Y')) ^ 2 If $lHP<$lLowestHP Or ($lHP=$lLowestHP And $lDistance < $lNearestDistance ) Then $lNearestAgent = $lAgentToCompare $lNearestDistance = $lDistance $lLowestHP = $lHP EndIf Next SetExtended(Sqrt($lNearestDistance)) ;this could be used to retrieve the distance also Return $lNearestAgent EndFunc ;==>GetLowestEnemyToAgent Func GetLowestEnemyToAgentExcludingMaghma() Local $lNearestAgent = 0, $lNearestDistance = 100000000 Local $lDistance, $lAgentToCompare Local $lLowestHP = 100,$lHP Local $aAgent = GetAgentByID(-2) For $i = 1 To GetMaxAgents() $lAgentToCompare = GetAgentByID($i) If DllStructGetData($lAgentToCompare, 'HP') < 0.005 Or DllStructGetData($lAgentToCompare, 'Allegiance') <> 0x3 Or DllStructGetData($lAgentToCompare, 'Type') <> 0xDB Or GetAgentName($lAgentToCompare) = "Lieutenant Mahgma" Then ContinueLoop $lDistance = (DllStructGetData($aAgent, 'X') - DllStructGetData($lAgentToCompare, 'X')) ^ 2 + (DllStructGetData($aAgent, 'Y') - DllStructGetData($lAgentToCompare, 'Y')) ^ 2 If $lHP<$lLowestHP Or ($lHP=$lLowestHP And $lDistance < $lNearestDistance ) Then $lNearestAgent = $lAgentToCompare $lNearestDistance = $lDistance $lLowestHP = $lHP EndIf Next SetExtended(Sqrt($lNearestDistance)) ;this could be used to retrieve the distance also Return $lNearestAgent EndFunc ;==>GetLowestEnemyToAgentExcludingMaghma Func PingSleep($msExtra = 0) $ping = GetPing() Sleep($ping + $msExtra) EndFunc ;==>PingSleep ;================================================================================================= ; Function: PickUpItems($iItems = -1, $fMaxDistance = 1012) ; Description: PickUp defined number of items in defined area around default = 1012 ; Parameter(s): $iItems: number of items to be picked ; $fMaxDistance: area within items should be picked up ; Requirement(s): GW must be running and Memory must have been scanned for pointers (see Initialize()) ; Return Value(s): On Success - Returns $iItemsPicked (number of items picked) ; Author(s): GWCA team, recoded by ddarek, thnx to The ArkanaProject ;================================================================================================= Func PickupItems($iItems = -1, $fMaxDistance = 1012) Local $iItemsPicked = 0 Local $aItemID, $lNearestDistance, $lDistance $tDeadlock = TimerInit() Do $aItem = GetNearestItemToAgent(-2) $lDistance = [MENTION=368499]Extended[/MENTION] $aItemID = DllStructGetData($aItem, 'ID') If $aItemID = 0 Or $lDistance > $fMaxDistance Or TimerDiff($tDeadlock) > 30000 Then ExitLoop PickUpItem($aItem) $tDeadlock2 = TimerInit() Do Sleep(500) Until DllStructGetData(GetAgentByID($aItemID), 'ID') == 0 $iItemsPicked += 1 Until $iItemsPicked = $iItems EndFunc ;==>PickupItems #Region Arrays Func CheckArrayPscon($lModelID) For $p = 0 To (UBound($Array_pscon) -1) If ($lModelID == $Array_pscon[$p]) Then Return True Next EndFunc Func CheckArrayGeneralItems($lModelID) For $p = 0 To (UBound($General_Items_Array) -1) If ($lModelID == $General_Items_Array[$p]) Then Return True Next EndFunc Func CheckArrayWeaponMods($lModelID) For $p = 0 To (UBound($Weapon_Mod_Array) -1) If ($lModelID == $Weapon_Mod_Array[$p]) Then Return True Next EndFunc Func CheckArrayTomes($lModelID) For $p = 0 To (UBound($All_Tomes_Array) -1) If ($lModelID == $All_Tomes_Array[$p]) Then Return True Next EndFunc Func CheckArrayMaterials($lModelID) For $p = 0 To (UBound($All_Materials_Array) -1) If ($lModelID == $All_Materials_Array[$p]) Then Return True Next EndFunc Func CheckArrayMapPieces($lModelID) For $p = 0 To (UBound($Map_Piece_Array) -1) If ($lModelID == $Map_Piece_Array[$p]) Then Return True Next EndFunc #EndRegion Arrays Func FindAndOpenChest() Local $ChestName $ChestName = "Locked Chest" Update("Checking for Chest") Local $ChestSpawn = 0 ;For $i = 0 To 4 ;for what? makes no sense?! TargetNextItem() Sleep(50) $Target = GetCurrentTarget() Sleep(50) $Name = GetAgentName($Target) Sleep(50) If $Name = $ChestName Then $ChestSpawn = $ChestSpawn + 1 Update("Chest found") sleep(350) Update("Opening Chest") GoSignpost($Target) OpenChest() sleep(350) EndIf ;Next If $ChestSpawn > 0 Then Update("Checking Drops") PickupItems() Else Update("No Chest found") sleep(350) EndIf EndFunc
Ich bedanke mich schon einmal und Wünsche schönes Wochenende
grüße
zer0.de