OK to ask for exploit/Scripting help here...

08/09/2018 19:31 Underavelvetmoon#31
Quote:
Originally Posted by LordKillfox View Post
Hey guys!

I need your help / advice on a function of mine...

Code:
; ~ Description: Returns number of foes which meet certain conditions, given by the parameter
; ~ $HPPercentage = from 0(=0%) to 1(=100%), set the HP in % to return all valid enemies with less than your set %
; ~ $aKilledFoes = start this function if a certain amount of foes are killed (only works in HM)
; ~ $aRange = returns all valid enemies within this range

Func GetRemainingFoes($HPPercentage = 1, $aKilledFoes = 0, $aRange = $RANGE_NEARBY)
	If GetFoesKilled() > $aKilledFoes Then
		Local $lAgentArray = GetAgentArray(0xDB)
		Local $lMe = GetAgentById(-2)
		Local $lFoeCount = 0
		For $i = 1 To $lAgentArray[0]
			;If $lAgentArray[$i] = 0 Then ContinueLoop ; no Agent
			If Not GetIsEnemy($lAgentArray[$i]) Then ContinueLoop ; not an enemy
			If Not GetIsAlive($lAgentArray[$i]) Then ContinueLoop ; not alive
			$Distance = GetDistance($lAgentArray[$i], -2)
			If $Distance > $aRange Then ContinueLoop ; not in range
			If GetTarget($lAgentArray[$i]) <> $lMe Then ContinueLoop ; not targeting me
			$HP = DllStructGetData($lAgentArray[$i], 'HP')
			If $HP > $HPPercentage Then ContinueLoop ; ignore the enemy if it has more than the set HP %
			$lFoeCount += 1
		Next
		Return $lFoeCount
	EndIf
EndFunc   ;==>CheckRemainingFoes
Is this viable to check the remaining amount of foes in a kill loop?

Since my problem is that most functions don't work in loops (i think because they are called too much in a loop so they simply return 0).

I tried to use this function in a killing loop:
Code:
Func GetEnemiesWithinRange($aRange = $RANGE_AREA)
	Local $lAgentArray = GetAgentArray(0xDB)
	Local $lSubArray[$lAgentArray[0] + 1]
	$lSubArray[0] = 0
	Local $lMeXY = GetAgentXY(-2)
	For $i = 1 To $lAgentArray[0]
		If GetIsEnemy($lAgentArray[$i]) = 0 Or GetIsDead($lAgentArray[$i]) Then ContinueLoop
		Local $lTargetXY = GetAgentXY($lAgentArray[$i])
		If ComputeDistance($lMeXY[0], $lMeXY[1], $lTargetXY[0], $lTargetXY[1]) > $aRange Then ContinueLoop
		$lSubArray[0] += 1
		$lSubArray[$lSubArray[0]] = $lAgentArray[$i]
	Next
	ReDim $lSubArray[$lSubArray[0] + 1]
	Return $lSubArray
EndFunc   ;==>GetEnemiesWithinRange
To be honest it kind of seems like an over complicated way to go about it. Typically I just compare the distance between myself and the nearest enemy to enable the Fight loop and that works almost flawlessly since you can specify compass range to fight from which means you arent off running about the place.

Now I am not sure because I have never used the AgentArray like that, but I think GetMaxAgents into ComputeDistance would provide a better result. So maybe run the Kill loop to find an enemy within distance, get to the enemy, then run a check on all agents within 1450 range (I think thats compass? Maybe its 1250) and add it to the EnemiesToBeKilled or whatever you want to call it.

I have this function from a Kilroy bot that I use quite often now - all credits to whoever wrote it since I did not! It seems you could probably rework it for what you need by adding in the Counts/Range.

Code:
Func GetNearestPriority($lPriority)
   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) <> $lPriority 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   ;==>GetNearestPriority
08/19/2018 05:23 CrucifierDemon#32
Perhaps I'm out my depth but I'll ask anyway.. How do I get my gw to run these bots? Or is this the wrong place to ask?
08/19/2018 07:59 phat34#33
1) Google AutoIt and download the latest version
2) Optional (Recommended) Download the scite editor and use this as default from the same link you found above..
3) you can right click the bot files and select edit with scite once the other steps are done and familiar-rise yourself with the scripts especially the #include lines usually at the top
(these lines will clue you in on what other files you should have in the bot directory)
4) download the latest gwa2.au3 and gwa2_headers.au3 files (use search the guild wars section or find link) --- some bot listers include this with there bots and you may be able to use this with bots that don't include these needed files by just copying them to the bot directory that needs them

5) select tools and run to execute the bot script -- have fun - read as much as you can in the forum so you learn the ins and outs of the autoit scripting language

6) the only dumb questions are the ones not asked
08/28/2018 19:23 turtlelover1#34
Someone gave me this script for ToC shard farming it injects and runs the gui is nice clean and has a option for patheon bonus aswell as multi options for selling to merch and what type of items to pickup BUT it doesnt actualy make it to the farm casts sf dwarven and dark escape then waits a few seconds runs halfway to toc stops to cast shroud gets stuck and dies IF you manage to make it past that it stops at the start of toc and dies.. i have pretty much 0 exp at fixing/wrighting bots but figured it would be a nice add to the collection here if someone can fix it. PS i thought about taking the combat/run part of the most updated original script for toc and copy/paste it but im not sure how that would play out. i added the script with the gwa2 file i was givin for it all is open source [Only registered and activated users can see links. Click Here To Register...]
08/31/2018 11:51 TrustMeI'mAnEngineer#35
Hey guys, i'm completly new to coding and would like to add use / check for cons to bot lux / kurz while the event is live

Is there a way to do so :)?

thanks in advance :)
greetings
09/19/2018 22:24 OuttaControlX#36
How can i get skill ids and how do i check if a adrenalin skill is charged for use?
12/14/2018 17:29 RiflemanX#37
Does anyone have the Buff_Effect_ID's for Pcons? I am trying to pop more Pcons during a run but I do not want to use a timer. I would like to try to simply use the below like when using Skill_Effect_ID's:

Code:
Global $Pcon_Cupcake = ????

If GetChecked($UseCupcake) and GetEffectTimeRemaining($Pcon_Cupcake) > = 0 Then
UseCupcake()
EndIf
Any help is appreciated...Savsuds? Velvetmoon? Ralle? Tekka? TeamGR? TeamAwesome?
12/15/2018 00:43 OneStrangeGuy#38
I think 1945 is the value you need there.

1945 - Cupcakes
2649 - Pumpkin Pie
3174 - War Supplies
2604 - Candy Corn
2605 - Apple
1934 - Golden Egg

Those are the cons i have in my bags atm and could verify, hope this help.
12/17/2018 00:13 RiflemanX#39
Quote:
Originally Posted by OneStrangeGuy View Post
I think 1945 is the value you need there.

1945 - Cupcakes
2649 - Pumpkin Pie
3174 - War Supplies
2604 - Candy Corn
2605 - Apple
1934 - Golden Egg

Those are the cons i have in my bags atm and could verify, hope this help.
Ok, Excellent, that worked, thanks!
12/17/2018 23:20 lasse1993#40
Heya,

is it possible to start tengu farm without doing WoC Quests? Via Dialogs or smth? Just like Keirans Bow for War Supply?
12/19/2018 08:24 RiflemanX#41
Quote:
Originally Posted by lasse1993 View Post
Heya,

is it possible to start tengu farm without doing WoC Quests? Via Dialogs or smth? Just like Keirans Bow for War Supply?
No, its not possible. Sorry. You will have to do the quest-line up to that point.
01/02/2019 05:01 lasse1993#42
And how to get the BuffID of several buffs? (e.g. "I am the Strongest")

Can someone please share me the GWAPI Constants.au3 file so i can check for those BuffID's ?

Anyone got an idea how i can check if target was already hit by a lead/offhand/double attack so i can let it continue the chain propperly?

Wasn't there a function to open the chest from far in outposts? Just like Toolbox does with '/chest' ?
01/02/2019 08:20 RiflemanX#43
Quote:
Originally Posted by lasse1993 View Post
Anyone got an idea how i can check if target was already hit by a lead/offhand/double attack ?
And how to get the BuffID of several buffs? (e.g. "I am the Strongest")
Buff ID: I AM THE STRONGEST!=2355

To find a skill ID (buff ID) take a look at the constants.au3 in gwapi.
01/04/2019 08:08 phat34#44
Here is the file your asking for….
02/13/2019 21:32 maril15#45
Hello guys,

I'm running into some problems with these functions. When I use the HasEffect(1043) (SkillID from the skill "Rush" which I found while using "Rush" and watching in the Effects/Buffs). The function HasEffect seems to ALWAYS return False (tested with various Effects & Buffs), it always returns False. I'm not able to manage to find why it is going so wrong. I'm hopping that someone can help me.

Code:
;~ Description: Returns time remaining before an effect expires, in milliseconds.
Func GetEffectTimeRemaining($aEffect)
	If Not IsDllStruct($aEffect) Then $aEffect = GetEffect($aEffect)
	If IsArray($aEffect) Then Return 0
	Return DllStructGetData($aEffect, 'Duration') * 1000 - (GetSkillTimer() - DllStructGetData($aEffect, 'TimeStamp'))
EndFunc   ;==>GetEffectTimeRemaining
Code:
;Pass skill ID, returns True if you're under the effect
Func HasEffect($Effect)
	If IsDllStruct($Effect) = 0 Then $Effect = GetSkillByID($Effect)
	If DllStructGetData(GetEffect($Effect), 'SkillID') < 1 Then ; If you're not under effect
		Return False
	Else
		Return True
	EndIf
EndFunc   ;==>HasEffect
Code:
;~ Description: Returns effect struct or array of effects.
Func GetEffect($aSkillID = 0, $aHeroNumber = 0)
	Local $lEffectCount, $lEffectStructAddress
	Local $lReturnArray[1] = [0]

	Local $lOffset[4]
	$lOffset[0] = 0
	$lOffset[1] = 0x18
	$lOffset[2] = 0x2C
	$lOffset[3] = 0x510
	Local $lCount = MemoryReadPtr($mBasePointer, $lOffset)
	ReDim $lOffset[5]
	$lOffset[3] = 0x508
	Local $lBuffer
	For $i = 0 To $lCount[1] - 1
		$lOffset[4] = 0x24 * $i
		$lBuffer = MemoryReadPtr($mBasePointer, $lOffset)
		If $lBuffer[1] == GetHeroID($aHeroNumber) Then
			$lOffset[4] = 0x1C + 0x24 * $i
			$lEffectCount = MemoryReadPtr($mBasePointer, $lOffset)
			ReDim $lOffset[6]
			$lOffset[4] = 0x14 + 0x24 * $i
			$lOffset[5] = 0
			$lEffectStructAddress = MemoryReadPtr($mBasePointer, $lOffset)

			If $aSkillID = 0 Then
				ReDim $lReturnArray[$lEffectCount[1] + 1]
				$lReturnArray[0] = $lEffectCount[1]

				For $i = 0 To $lEffectCount[1] - 1
					$lReturnArray[$i + 1] = DllStructCreate('long SkillId;long EffectType;long EffectId;long AgentId;float Duration;long TimeStamp')
					$lEffectStructAddress[1] = $lEffectStructAddress[0] + 24 * $i
					DllCall($mKernelHandle, 'int', 'ReadProcessMemory', 'int', $mGWProcHandle, 'int', $lEffectStructAddress[1], 'ptr', DllStructGetPtr($lReturnArray[$i + 1]), 'int', 24, 'int', '')
				Next

				ExitLoop
			Else
				Local $lReturn = DllStructCreate('long SkillId;long EffectType;long EffectId;long AgentId;float Duration;long TimeStamp')

				For $i = 0 To $lEffectCount[1] - 1
					DllCall($mKernelHandle, 'int', 'ReadProcessMemory', 'int', $mGWProcHandle, 'int', $lEffectStructAddress[0] + 24 * $i, 'ptr', DllStructGetPtr($lReturn), 'int', 24, 'int', '')
					If DllStructGetData($lReturn, 'SkillID') = $aSkillID Then Return $lReturn
				Next
			EndIf
		EndIf
	Next
	Return $lReturnArray
EndFunc   ;==>GetEffect
I'm Searching for a solution to make the bot check if i'm under a specific effect (like Dash or Shadow Form,....). Can someone help me pls ?