why won't functions work in explorable areas

06/26/2020 21:03 ooklaba#1
i've been experiencing this issue repeatedly over the last few days

tl;dr - salvage and identify functions work 100% in outposts, 60% in explorable areas. cannot figure out why. they are very capiricious.

it happens with the salvage() and identify() functions

they will work fine in outposts, but will only work when they want to in explorable areas

the identifyitem() function simply will not work, and the script will stay stuck in the identifyitem() function, without moving forward

the salvage() function will cause an immediate DC (screen goes black, offers chance to reconnect by clicking green button) upon startsalvage() being called upon. salvaging manually right before or after the dc will not cause a DC

these issues only happen when they feel like happening, there is absolutely no patern i would otherwise expect (ping speed, memory overload, wrong injection of code)

as mentioned - these functions work 100% of the time in outposts, and about 60% of the time in explorable areas
the only "fix" i have found is to close the script, relaunch it, and have the character zone back to town, then go back to the explorables. and this only fixes it part of the time, and often times, only fixes 1 of 2 (i.e. on the last run - salvage wasn't working, but ID was. i reset it. then salvage worked, but ID didn't).

this is far beyond my comprehension
06/26/2020 23:28 deroni93#2
Please paste the raw functions here, I have no idea what's behind them

For reference I've manually sent the salvage packet to the client and it worked with no issues , [Only registered and activated users can see links. Click Here To Register...]. The image shows the code I've used, the bot console (printing matching ID's) and the actual packet sent to the server.

If your client is intermittently dc'ing when using the function it's likely going to be the method of calling those functions, perhaps the function is being called without the necessary pauses
06/26/2020 23:45 ooklaba#3
in the case of identify - i have done this to try and debug:
in instances where the script has failed to ID, i've manually sent the package

Code:
SendPacket(0xC, $HEADER_ITEM_ID, $lIDKit, $lItemID)
and it still fails

in the case of salvage, it's a basic salvage function:

Code:
Func SalvageMats()
Local $aBag, $aSlot, $aItem
For $aBag = 1 To 4 ; all inventory bags ;4
For $aSlot = 1 To DllStructGetData(GetBag($aBag), 'slots')
If CanSalvageMats($aBag, $aSlot) <> 0 Then
SalvageMats2($aBag, $aSlot)
PingSleep(200)
EndIf
Next
Next
EndFunc ;==>Main


Func SalvageMats2($aBag, $aSlot)
Local $i, $aItem = GetItemBySlot($aBag, $aSlot), $aQuantity = DllStructGetData($aItem, 'Quantity')
If IsInvFull() = True Then
Out("Inv Full")
Exit
EndIf
For $i = 1 To $aQuantity
SecureSalvKit()
Out ("Salvaging Mats (" & $aBag & "," & $aSlot & ")")
StartSalvage(GetItemBySlot($aBag, $aSlot))
RndSleep(PingSleep() + 1200)
SalvageMaterials()
RndSleep(PingSleep() + 700)
ClearMemory()
Next
EndFunc
securesalvkit only looks for items in bag 1-4
06/27/2020 00:29 deroni93#4
Quote:
Originally Posted by ooklaba View Post
in the case of identify - i have done this to try and debug:
in instances where the script has failed to ID, i've manually sent the package

Code:
SendPacket(0xC, $HEADER_ITEM_ID, $lIDKit, $lItemID)
and it still fails

in the case of salvage, it's a basic salvage function:

Code:
Func SalvageMats()
Local $aBag, $aSlot, $aItem
For $aBag = 1 To 4 ; all inventory bags ;4
For $aSlot = 1 To DllStructGetData(GetBag($aBag), 'slots')
If CanSalvageMats($aBag, $aSlot) <> 0 Then
SalvageMats2($aBag, $aSlot)
PingSleep(200)
EndIf
Next
Next
EndFunc ;==>Main


Func SalvageMats2($aBag, $aSlot)
Local $i, $aItem = GetItemBySlot($aBag, $aSlot), $aQuantity = DllStructGetData($aItem, 'Quantity')
If IsInvFull() = True Then
Out("Inv Full")
Exit
EndIf
For $i = 1 To $aQuantity
SecureSalvKit()
Out ("Salvaging Mats (" & $aBag & "," & $aSlot & ")")
StartSalvage(GetItemBySlot($aBag, $aSlot))
RndSleep(PingSleep() + 1200)
SalvageMaterials()
RndSleep(PingSleep() + 700)
ClearMemory()
Next
EndFunc
securesalvkit only looks for items in bag 1-4

Sorry mate but there are several other functions in there and it isn't obvious what they're doing, if you can send me the entire au3 file I can take a better look.

IMO there are too many functions in there, if you can give me the basis of what you're trying to do I can probably whip up something better that doesn't randomly disconnect you
06/27/2020 01:27 ooklaba#5
thanks i appreciate it

the function runs all the way till StartSalvage() - that's when it crashes

startsalvage is the basic gwa2 function:

Code:
Func StartSalvage($aItem)
	Local $lOffset[4] = [0, 0x18, 0x2C, 0x690]
	Local $lSalvageSessionID = MemoryReadPtr($mBasePointer, $lOffset)

	If IsDllStruct($aItem) = 0 Then
		Local $lItemID = $aItem
	Else
		Local $lItemID = DllStructGetData($aItem, 'ID')
	EndIf

	Local $lSalvageKit = FindSalvageKit()
	If $lSalvageKit = 0 Then Return

	DllStructSetData($mSalvage, 2, $lItemID)
	DllStructSetData($mSalvage, 3, FindSalvageKit())
	DllStructSetData($mSalvage, 4, $lSalvageSessionID[1])

	Enqueue($mSalvagePtr, 16)
EndFunc   ;==>StartSalvage

Func SalvageMaterials()
	Return SendPacket(0x4, $HEADER_SALVAGE_MATS)
EndFunc   ;==>SalvageMaterials