Problem with identifying

05/09/2018 10:28 zoidberg1337#1
Hey,
so i have a vaettir bot that salvages items after every run, but after all the updates it gets stuck at identifying, everything else works fine.
I patched it with the GWA2_Patcher, there was a missing header but i added it in the header table, i just can't find out why it doesn't work.
Would be nice if anyone could help me :)
05/09/2018 11:40 mhaendler#2
The problem is your "Ident"-Function. During the identification process you have no check if there is still a Ident-Kit in your inventory.

If your Ident-Kit usages are gone during identing, your bot gets stuck because there is none in your inventory

Here is an example of an "working" Ident function:


I wasnt able to copy paste the function right now, thats just manually tipped, so sorry if there are any typos in it

_
mhaendler
05/09/2018 12:14 DerMoench14#3
There is another Problem with Func FindIdKit() when you're in an explorable Area.
The regular Version of the Function searches for an IDKit in ALL Bags (including Xunlai) and might be trying to identify an Item with an IDKit what has been found in Xunlai.
You can make a new Function which could be used for such a Situation:
Code:
;~ Description: Returns item ID of ID kit in inventory outdoors.
Func FindOutdoorIDKit()
	Local $lBagPtr
	Local $lItemArrayPtr
	Local $lItemPtr
	Local $lKit = 0
	Local $lUses = 101
	For $lBag = 1 to 4
		$lBagPtr = GetBagPtr($lBag)
		$lItemArrayPtr = MemoryRead($lBagPtr + 24, 'ptr')
		For $lSlot = 0 To MemoryRead($lBagPtr + 32, 'long') - 1
			$lItemPtr = MemoryRead($lItemArrayPtr + 4 * ($lSlot), 'ptr')
			If $lItemPtr = 0 Then ContinueLoop
			Switch MemoryRead($lItemPtr + 44, 'long')
				Case 2989
					If MemoryRead($lItemPtr + 36, 'short') / 2 < $lUses Then
						$lKit = MemoryRead($lItemPtr, 'long')
						$lUses = MemoryRead($lItemPtr + 36, 'short') / 2
					EndIf
				Case 5899
					If MemoryRead($lItemPtr + 36, 'short') / 2.5 < $lUses Then
						$lKit = MemoryRead($lItemPtr, 'long')
						$lUses = MemoryRead($lItemPtr + 36, 'short') / 2.5
					EndIf
				Case Else
					ContinueLoop
			EndSwitch
		Next
	Next
	Return $lKit
EndFunc   ;==>FindOutdoorIDKit
Take it just as an example.
05/09/2018 13:26 mhaendler#4
Quote:
Originally Posted by DerMoench14 View Post
...
Take it just as an example.
Why make a seperate function for it, wouldnt it be "easier" / cleaner to just edit the current FindIDKit Function for example like that:

Code:
Func FindIDKit($lookUpInStorage=false)
	Local $iBags = 4
	If $lookUpInStorage Then
		$iBags = 16
	EndIf

	For $i = 1 To $iBags
      .....
EndFunc
So you have the same Function for everything and can specifiy via parameter if you also want to check the storage (btw who the fuck has id and salvage kits in the storage) :D
05/09/2018 13:49 DerMoench14#5
As i said ... was just an example.
But you're right ofc ... the code you posted is the correct method :)
The only Problem is the diversity of different APIs ... for my private API i did it exactly the way you showed, for public APIs which are no longer really under support/development besides Hotfixes (like GWA2) it can cause problems when someone takes the bot.au3 and the not corresponding API and asking for help because of "Incorrect number of parameters in function call" ^^
05/09/2018 14:27 zoidberg1337#6
Ok thanks guys, looks like the findidkit was the faulty function, works again now :)