Finally had a chance to look at the original and this one. Well done and nice clear source code. Very easy for people to integrate into bots so we don't have such a fragmented system.
how do I get it to stop getting stuck in ToA? add a waypoint? I tried what I posted below but cant seem to get it to not crash on start even after I got the gui to appear. shame cause this info looked like exactly what i need.
My edited version of the bot skips TOA completely if the district is unsafe - which it always is during patheon week.
To be honest when I was using it in TOA I never got stuck anyway. Sorry I can't be more help
I tried to change the script to zin ku but borked it. Next event is in 7 weeks(?) so i've got time to figure it out. Looking for new areas to use these R/A's now though.
I've tried the bot to salvage Glacial Stones. But once 1 Glacial Stone was salvaged it disconnects me. Someone else has the same issue?
I played around with the timings trying to minimize as much as possible, could be that different connections have less tolerance. If more people have this I'll have to slow it down again. I know toolbox can salvage stacks real quick so I might go take a look at how they do it.
For now I updated salvage code, it seems to be much more stable now. If you still get disconnect, in the function SalvageItemMats($bag, $slot), line 163
Code:
RndSleep(GetPing() + 250)
, update the value in increments of 50 until it stops booting you, and let me know what value was safe for you!
I played around with the timings trying to minimize as much as possible, could be that different connections have less tolerance. If more people have this I'll have to slow it down again. I know toolbox can salvage stacks real quick so I might go take a look at how they do it.
For now I updated salvage code, it seems to be much more stable now. If you still get disconnect, in the function SalvageItemMats($bag, $slot), line 163
Code:
RndSleep(GetPing() + 250)
, update the value in increments of 50 until it stops booting you, and let me know what value was safe for you!
As far as I remember the pattern for GetPing is broken in the public gwa2 so that is probably why its going too fast for some people as effectively its just doing 0 + static offset of time.
As far as I remember the pattern for GetPing is broken in the public gwa2 so that is probably why its going too fast for some people as effectively its just doing 0 + static offset of time.
Correct, it was fixed only recently, I have attached an updated GWA2. IT also has the abandon quest fix that was missing from my previous version.
Finally complete a generic pack manager bot. Comes with its own GUI or can be used with other bots through calling individual functions.
How to use:
Use Bags: select how many bags should be accessed
Store Golds: moves unid golds from bags to storage
Get Golds: moves unid golds from storage to bags
Identify All: identifies all items in selected bags
Sell All: sells all items (excluding special items*)
Salvage Runes: salvage all valuable runes from all items
Salvage Mats: salvages materials from all items (with exclusions)
Deposit Max: deposit all gold
Withdraw Max: withdraw 100k
*special items are ones that generally not sold, so ID/salvage kits, runes, books, materials, etc.
Make sure to talk to trader for functions Identify All, Sell All, Salvage Runes, Salvage Mats, so bot can buy id/salvage kits if it runs out.
Bot salvages materials from all items except if they contain a valuable rune/insignia or if the item's modelID is in $DONT_SALVAGE_ARR. Currently it has only some modelID's of items that salvage to wood.
Button in top right initializes the bot and also refreshes for if relogging to different character.
Currently the general function that does a full inventory clear (with storing unid golds and rune salvage) is FullClearAtGToB(). But its very easy to change to different town, just need to replace GTOB mapID, merchant coords and rune trader coords, and should be set.
Finally if using the included GUI, can press {ESC} during any of the functions to abort, in case pressed wrong button.
Looking good and thanks for putting the time into this, I know many people have asked me question about salvage recently (ever since it has been fixed) and with the upcoming events, there is a lot of enthusiasm for a complete solution that tackles both mats and runes / mods.
One thing I noted is that many bots don't integrate finding empty slots with finding existing stacks of a material or an item (e.g. Tomes).
So I might suggest using something like the below:
Code:
Func BestStorageSlotbyModelID($ItemModelID, $FirstBag, $LastBag) ; finds the best storage bag and slot to store an item of a given Model ID: existing stack > empty slot position > no slot (returns false)
; $BAG_Backpack = 1, $BAG_BeltPouch, $BAG_Bag1, $BAG_Bag2, $BAG_EquipmentPack, $BAG_UnclaimedItems = 7, $BAG_Storage1, $BAG_Storage2, _
; $BAG_Storage3, $BAG_Storage4, $BAG_Storage5, $BAG_Storage6, $BAG_Storage7, $BAG_Storage8, $BAG_StorageAnniversary
Local $StorageIndex[2]
For $i = $LastBag To $FirstBag Step -1 ; bags in reverse order so that found empty slot will be in an early bag
For $j = 1 To DllStructGetData(GetBag($i), 'Slots')
$lItemInfo = GetItemBySlot($i, $j)
If DllStructGetData($lItemInfo, 'ModelID') = $ItemModelID Then ; tome stack of exact Model ID found in current bag
$StorageIndex[0] = $i
$StorageIndex[1] = $j
Return $StorageIndex ; --> stop cycling through bags, this is the best slot
ElseIf DllStructGetData($lItemInfo, 'ModelID') <> $ItemModelID then ; current slot is full with a different model ID, continue cycling through
ContinueLoop
Else ; slot in current bag is empty
$StorageIndex[0] = $i
$StorageIndex[1] = $j
Exitloop ; move to next bag, there may yet be a better slot
Endif
Next
Next
Return $StorageIndex
EndFunc ;==>BestStoragebyModelID
Such a function can then be used to parse through any array of "to be stored" items and do it all in one go.
Here is an example for Tomes only, but it will do the same with any array you might have:
Code:
Func StoreTome($lBag, $numOfSlots) ;store the tomes of a given bag considering the total number of slots in that bag
For $lSlot = 1 To CountTotalSlots()
$aItem = GetItemBySlot($lBag, $lSlot)
$aModelID = DllStructGetData($aItem , 'modelid') ; model ID of item in inventory bag $lBag and slot $lSlot
If _ArrayBinarySearch($Tome_Array, $aModelID) = -1 then ContinueLoop ; continues loop if the Model ID of item does not correspond to a tome
$Index = _ArrayBinarySearch($Tome_Array, $aModelID)
Out("The item in bag " & $lBag & ", Slot " & $lSlot & " is a tome")
$StorageIndex = BestStorageSlotbyModelID($aModelID, 8, 12) ; looking in bags 8 to 12 (change based on available storage)
If $StorageIndex[0] > 0 then MoveItem($aItem, $StorageIndex[0], $StorageIndex[1])
Out("Moving tome to bag " & $StorageIndex[0] & ", slot " & $StorageIndex[1])
Sleep(Random(450, 550))
Next
EndFunc ;==>StoreTome
You can then integrate storage, salvage and sell all in one go:
Code:
StoreItems()
For $aItem In CanSellItems() ; allows the use of 4 bags, change to protect bags
If HasUsefulMod($aItem) then
$aMod = [MENTION=368499]Extended[/MENTION]
$Timer = TimerInit()
Out("Salvaging mod...")
Out("SendStartSalvageFunc")
StartSalvage($aItem) ; make sure it selects the right kit
Sleep(GetPing() + 200)
SalvageMod($aMod)
Sleep(GetPing() + 200)
out("SentSalvageMod")
Elseif Cansell($aItem) then
SellItem($aItem)
$Timer = TimerInit()
Do
Sleep(GetPing() + 100)
Until DllStructGetData($aItem, 'ID') = 0 Or TimerDiff($Timer) > 1500
Endif
Next
The key is to have a good "has useful mods" function.
Personally as I am not using bots for wealth, my function (and other bots) have been focusing on securing rare skins, weapons and mods to equip my characters, but most of you think about materials when they salvage.
I think what the community could use is a prioritization of salvage based on the types of materials to be gained weighed against the value of the mods.
By using an array we could effectively select the best course of action via GUI that we can loop across, it would be very easy to do the salvage in only one function, both mods and mats.
First we would need to collect the community preferences in terms of material vs. mod prioritization, then we could build a project that captures all of this information in an array format, and then design a a "does it all in a single parsing cause my array is so good" solution.
Icing on the cake would be a customizable GUI that lets you alter your preferences.
@comprehension is right that efforts towards salavaging have been very fragmented so it is good to see someone trying to unify those efforts. If you are interested in collaborating for such a project, let me know and we could find a few people on Discord to give input into it!
First we would need to collect the community preferences in terms of material vs. mod prioritization, then we could build a project that captures all of this information in an array format, and then design a a "does it all in a single parsing cause my array is so good" solution.
Forgive me if im over simplifying, but will the merchant values of the runes/materials dictate their prioritization? For the weapon mods theres a few scripts in here with a solid salvage mod function listing the most important ones (pongmei chest runner comes to mind) which may give you a headstart on those list of mods. I would be happy to help collect any other information like kamadan value/demand. I tend to weekly create my own google sheet to record my Buy/Sell pricing on certain things when im shopping for minis/skins.
Looking good and thanks for putting the time into this, I know many people have asked me question about salvage recently (ever since it has been fixed) and with the upcoming events, there is a lot of enthusiasm for a complete solution that tackles both mats and runes / mods.
One thing I noted is that many bots don't integrate finding empty slots with finding existing stacks of a material or an item (e.g. Tomes).
...
The key is to have a good "has useful mods" function.
Personally as I am not using bots for wealth, my function (and other bots) have been focusing on securing rare skins, weapons and mods to equip my characters, but most of you think about materials when they salvage.
I think what the community could use is a prioritization of salvage based on the types of materials to be gained weighed against the value of the mods.
By using an array we could effectively select the best course of action via GUI that we can loop across, it would be very easy to do the salvage in only one function, both mods and mats.
First we would need to collect the community preferences in terms of material vs. mod prioritization, then we could build a project that captures all of this information in an array format, and then design a a "does it all in a single parsing cause my array is so good" solution.
Icing on the cake would be a customizable GUI that lets you alter your preferences.
@comprehension is right that efforts towards salavaging have been very fragmented so it is good to see someone trying to unify those efforts. If you are interested in collaborating for such a project, let me know and we could find a few people on Discord to give input into it!
Sure thing, happy to collaborate and always looking for input, sign me up. You have many good points for discussion, but one that stood out was "one function to rule them all". I specifically tried to go in the other direction so as to have simple reusable components that people can use in whichever combination they need. I'll agree not wasting cpu cycles is a good goal but I'll argue in this setting maintainability might be more important, esp given that we're so often waiting for the network anyway. On the other hand it probably wouldn't hurt to add it anyway if there is big demand.
"One thing I noted is that many bots don't integrate finding empty slots with finding existing stacks of a material or an item (e.g. Tomes)."
What would be purpose of this, why not just move it over once the stack is full?
Let's assume you farm Vaettir for example, you recycle materials, pick up tomes, event items, lockpick, dyes, recycling kit, id kit, glacial stones.
Meaning after coming back to town, and going to the merchant you will potentially still have in your bags:
- ID Kit
- Recycling Kit
- Glacial Stones
- Dust
- Iron
- Some other materials
- Lockpick
- White Dyes
- Black Dyes
- Tonic (2 types)
- Alcohol
- Sweets
- Snowmen
So at least 14 slots taken in your bag. Therefore much shorter runs, coming back to town more often and everything that it implies.
I agree with your analysis for those which are obtained by salvaging only :
- Dust
- Iron
- Some other materials
For the rest :
- Glacial Stones
- Lockpick
- White Dyes
- Black Dyes
- Tonic (2 types)
- Alcohol
- Sweets
- Snowmen
It is very likely that you drop at least one in the next cycle which means that you will not gain any inventory space in the end.
The only case where I can see a real benefit is the one where you reach a full stack during a cycle and so begin a new one. Which means one cycle every X cycles.
Imho, you can gain few runs that way but not that many. And fussy as I am, I rather have a clean Xunlai Storage with only full stack of everything.
I agree with your analysis for those which are obtained by salvaging only :
- Dust
- Iron
- Some other materials
For the rest :
- Glacial Stones
- Lockpick
- White Dyes
- Black Dyes
- Tonic (2 types)
- Alcohol
- Sweets
- Snowmen
It is very likely that you drop at least one in the next cycle which means that you will not gain any inventory space in the end.
The only case where I can see a real benefit is the one where you reach a full stack during a cycle and so begin a new one. Which means one cycle every X cycles.
Imho, you can gain few runs that way but not that many. And fussy as I am, I rather have a clean Xunlai Storage with only full stack of everything.
Agree, but the function would actually stack over existing stacks so your storage would be clean
This is a working CoF dungeon farm bot with a monk and 2 heros to clear the dungeon.
You will need DP removal Pcons like Four-leaf clovers or what you want.
Small update to allow bot to salvage items out in the field.
The function
Code:
;~ Same as in GWA2 except allows for basic kits as well.
;~ Use $bags_to_search = 4 when storage not available
Func CustomFindSalvageKit($kit_type = $KIT_EXPERT, $bags_to_search = 16)
has been updated to
Code:
;~ Searches for $KIT_ID, $KIT_BASIC_SALV, $KIT_EXPERT_SALV
;~ Searches chest only if current location is outpost
Func CustomFindKit($kit_type)
so if you had calls to CustomFindSalvageKit then please update them.
It is now possible to load up on ID and salvage kits before the run and then do
Code:
If CustomFindKit($KIT_ID) And CustomFindKit($KIT_BASIC_SALV) Then
IdentifyAllBags()
SalvageAllMats()
EndIf
right after you pickuploot to process it right there. This should also extend the length a bot can stay away from outpost.
Quote:
Originally Posted by Pmolik1809
Let's assume you farm Vaettir for example, you recycle materials, pick up tomes, event items, lockpick, dyes, recycling kit, id kit, glacial stones.
...
So at least 14 slots taken in your bag. Therefore much shorter runs, coming back to town more often and everything that it implies.
Its not a bad point. I'm not convinced of just how much efficiency you will actually gain but it won't hurt to add it for those who want it.
I'll see what I can do.