Thanks a lot mate !
Gonna edit my stuff and hope it turns my shit into gold
Edit:
You provided me a huge step further and i can now salvage runes out of armors and sell them YEY
But if i'm going to loop through my inventory the bot tries to salvage the already salvaged mods again which result in a dc/error.
To prevent that im trying to combine my If statement with the model ID of an array. But if i add the AND part it wont salvage any mod anymore...
Can someone tell me where my mistake is?
Code:
If CheckCustomTopRunes_Array($aItem) AND CheckCustom_PickUp_ArmorPieces_Array($lModelID) Then
$aIndex = 1 ;0 = insignia | 1 = rune
StartSalvage($aItem)
Sleep(GetPing() + 800)
SalvageMod($aIndex)
Sleep(GetPing() + 800)
;~ ==== ArmorPieces ====
Global $Custom_PickUp_ArmorPieces_Array[5] = [1154, 1156, 1159, 1166, 1167]
Func CheckCustom_PickUp_ArmorPieces_Array($lModelID)
For $p = 0 To (UBound($Custom_PickUp_ArmorPieces_Array) -1)
If ($lModelID == $Custom_PickUp_ArmorPieces_Array[$p]) Then Return True
Next
EndFunc
I found a work around but its suuuuuuuper slow so i still would love to find the solution to it!
Right now the bot has to sell the rune right after he salvaged it. But im using some "messy" code which makes it really slow. (Loop to check for propper runes and salvage them, if one is salvaged another loop starts to find the rune and sell it to the rune merchant. After that salvaging continues ...)
Question: Do i need all the sleep commands? And should they be that long? Or could i lower them to ~150-250ms instead of 500-800 ?
Code:
If CheckCustomTopRunes_Array($aItem) Then
$aIndex = 1 ;0 = insignia | 1 = rune
StartSalvage($aItem)
Sleep(GetPing() + 800)
SalvageMod($aIndex)
SellRunes($BagIndex)
Sleep(GetPing() + 800)
Func SellRunes($BAGINDEX)
Local $AITEM
Local $BAG = GETBAG($BAGINDEX)
Local $NUMOFSLOTS = DllStructGetData($BAG, "slots")
$runemerchant = GetNearestNPCToCoords(16471, 12577)
GoToNPC($runemerchant)
For $I = 1 To $NUMOFSLOTS
$AITEM = GETITEMBYSLOT($BAGINDEX, $I)
If DllStructGetData($AITEM, "ID") = 0 Then ContinueLoop
If CheckcustomRunes_Array ($AITEM) Then
TraderRequestSell($AITEM)
TraderSell()
EndIf
Sleep(GetPing()+250)
Next
EndFunc
Full Function if it helps or smth...
Code:
Func SalvageAndSellRunes($BagIndex)
Local $bag
Local $I
Local $AITEM
Local $aModelID = DllStructGetData($aItem, "ModelID")
Local $lModelID = DllStructGetData($aItem, 'ModelID')
$merchant = GetNearestNPCToCoords(17290, 12426)
$runemerchant = GetNearestNPCToCoords(16471, 12577)
$BAG = GETBAG($BagIndex)
$ModelID = GetItemByItemID($AITEM)
For $I = 1 To DllStructGetData($BAG, "slots") ;von 1 bis X slots von Bags
$AITEM = GETITEMBYSLOT($BagIndex, $I)
If DllStructGetData($AITEM, "ID") = 0 Then ContinueLoop ;this is a skip
If FindSalvageKit() = 0 Then
If GETGOLDCHARACTER() < 2500 And GETGOLDSTORAGE() > 2499 Then
WITHDRAWGOLD(2000)
Sleep(GetPing()+500)
EndIf
GoToNPC($merchant)
Local $J = 0
Do
BuyItem(3, 1, 400) ;buy 6th position
Sleep(GetPing()+500)
$J = $J + 1
Until FindSalvageKit() <> 0 Or $J = 3
If $J = 3 Then ExitLoop
Sleep(GetPing()+500)
GoToNPC($runemerchant)
EndIf
If CheckCustomTopRunes_Array($aItem) Then
$aIndex = 1 ;0 = insignia | 1 = rune
StartSalvage($aItem)
Sleep(GetPing() + 800)
SalvageMod($aIndex)
SellRunes($BagIndex)
Sleep(GetPing() + 800)
ElseIf CheckCustomTopInsignias_Array($aItem) Then
$aIndex = 0 ;0 = insignia | 1 = rune
StartSalvage($aItem)
Sleep(GetPing() + 800)
SalvageMod($aIndex)
SellRunes($BagIndex)
Sleep(GetPing() + 800)
ElseIf CheckCustomTopMidRunes_Array($aItem) Then
$aIndex = 1 ;0 = insignia | 1 = rune
StartSalvage($aItem)
Sleep(GetPing() + 800)
SalvageMod($aIndex)
SellRunes($BagIndex)
Sleep(GetPing() + 800)
ElseIf CheckCustomTopMidInsignias_Array($aItem) Then
$aIndex = 0 ;0 = insignia | 1 = rune
StartSalvage($aItem)
Sleep(GetPing() + 800)
SalvageMod($aIndex)
SellRunes($BagIndex)
Sleep(GetPing() + 800)
ElseIf CheckCustomAvgMidRunes_Array($aItem) Then
$aIndex = 1 ;0 = insignia | 1 = rune
StartSalvage($aItem)
Sleep(GetPing() + 800)
SalvageMod($aIndex)
SellRunes($BagIndex)
Sleep(GetPing() + 800)
ElseIf CheckCustomAvgMidInsignias_Array($aItem) Then
$aIndex = 0 ;0 = insignia | 1 = rune
StartSalvage($aItem)
Sleep(GetPing() + 800)
SalvageMod($aIndex)
SellRunes($BagIndex)
Sleep(GetPing() + 800)
ElseIf CheckCustomLowMidRunes_Array($aItem) Then
$aIndex = 1 ;0 = insignia | 1 = rune
StartSalvage($aItem)
Sleep(GetPing() + 800)
SalvageMod($aIndex)
SellRunes($BagIndex)
Sleep(GetPing() + 800)
ElseIf CheckCustomLowMidInsignias_Array($aItem) Then
$aIndex = 0 ;0 = insignia | 1 = rune
StartSalvage($aItem)
Sleep(GetPing() + 800)
SalvageMod($aIndex)
SellRunes($BagIndex)
Sleep(GetPing() + 800)
ElseIf CheckCustomLowRunes_Array($aItem) Then
$aIndex = 1 ;0 = insignia | 1 = rune
StartSalvage($aItem)
Sleep(GetPing() + 800)
SalvageMod($aIndex)
SellRunes($BagIndex)
Sleep(GetPing() + 800)
EndIf
Sleep(GetPing()+500)
Next
EndFunc