Quote:
Originally Posted by LilyRae
Have a problem with this. When running it, it at random disconnects gw code = 007 but usually just takes 10-60 seconds
(happens when I'm salvaging trophies (Feathered crests)
Don't know much about coding so any help from everyone here would be appreciated
|
Quote:
Originally Posted by diesdasjenes
Noticed this, when being on Asian servers. Change the server and all is good.
|
Had a look at the code, seems you utilize the GetPing() in some Sleep() functions, but don't think you have GWA2.au3 updated to have a working GetPing() ...
GWA2.au3: line 287
Code:
$mPing = MemoryRead(GetScannedAddress('ScanPing', -8))
GWA2.au3: line 468 + 469
Code:
_('ScanPing:')
AddPattern('908D41248B49186A30')
GWA2.au3: line 3711 - 3714
Code:
;~ Description: Returns current ping.
Func GetPing()
Return MemoryRead($mPing)
EndFunc ;==>GetPing
Meaning there is a few ways to fix this, either you "fix" GetPing() or you change the Sleep() to not utilize GetPing() ...
Fix not utilizing GetPing()
Code:
Func SalvageBackpack()
Local $PingWait = 300
For $Bag = 1 to $UseBags
For $Slot = 1 to DllStructGetData(GetBag($Bag), 'Slots')
Local $sItem = GetItemBySlot($Bag, $Slot);
While CanSalvage($sItem) And $BotRunning
If FindSalvage() == 0 Then
BuySalvage()
Sleep(PingWait + 600)
EndIf
Local $sItemID = DllStructGetData($sItem, 'ID')
Local $kit = FindSalvage()
Local $rarity = GetRarity($sItem)
If CountFreeSlots($UseBags) > 0 Then
Salvage($sItemID, $kit)
Else
Out("Inventory full")
$BotRunning = false
EndIf
Sleep(PingWait + 600)
If $rarity <> $rarity_white And $rarity <> $rarity_blue Then
ControlSend(GetWindowHandle(), "", "", "{Enter}")
Sleep(PingWait + 600)
EndIf
$sItem = GetItemBySlot($Bag, $Slot)
WEnd
Next
Next
EndFunc
I haven't got a good fix to GetPing() (have issues generating the search pattern's to find it), but have my own fix for this (Getting this info my own way)
Function to get MemoryBase of Guild Wars: (custom GWA2.au3 function)
Code:
Func GetGWBase()
Local $lGwBase = ScanForProcess() -4096
$lGwBase = "0x"&Hex($lGwBase)
Return $lGwBase
;~ Return 0x00360000
EndFunc
Fixing $mPing to the right address (current address as of 16-06-2023)
Code:
$mPing = (GetGWBase() + 0x6293F4) ;From 0x62945C; 0x0098945C (Gw.exe+62945C)
If you do this you can use GetPing(), but the address might get updated at any point, and if you cant update it yourself you are bound to waiting for others to do it every time its updated (moved in memory).
So depending on if you can use something like CheatEngine or simmilar to find the Ping Address on your own or not, I would recommend different solutions..
Anyway, from my understanding you are disconnected from the server due to trying to interact too "fast", so if you utilize the none GetPing() way, you might need to adjust "Local $PingWait = 300" to a higher or lower value depending on your "normal" ping, but this should stop the disconnects.