1
Stealth Snippets\Library / Re: Python item counter, for backpack
« on: December 20, 2018, 12:38:15 AM »
Thank you for all the help!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Ok found out 'tailor' and book titled Tailor, don't match up. So it adds tailors now but fails to put Smith bods Into that book. How Do I make it loop back to the top to check again if there is still a bod. Or have it cycle it until no more bods are in bag?
Nice, I suspected that was the case
As for the new issue... Although I think it could be restructured a bit ( more below ) I don't really see what would prevent it from putting smith books in.
A few things to check:
- Does FoundBlacksmithBods actually contain info? Or check FindCount() after the FindTypeEx() call, maybe the color could be wrong?
- Does FoundBooks actually contain 2 ( or more ) books?
I'd suggest an approach like this ( warning psuedo code )Code: [Select]def findNamedBook(searchStr )
res = FindTypeEx(8793, 0, Backpack(), False)
FoundBooks = GetFindedList()
for book in FoundBooks:
tooltip = GetTooltip(book)
if searchStr in tooltip:
return book
# some error since no matching book found
return 0
tailorBook = findNamedBook('Tailor')
smithBook = findNamedBook('Smith')
res = FindTypeEx(8792, 1155, Backpack(), False) # Tailor
FoundTailorBods = GetFindedList()
for tbod in FoundTailorBods:
MoveItem(tbod, 0, tailorBook , 0, 0, 0)
Wait(100)
res = FindTypeEx(8792, 1102, Backpack(), False) # Blacksmith
FoundSmithBods = GetFindedList()
for bod in FoundSmithBods :
MoveItem(tbod, 0, tailorBook , 0, 0, 0)
Wait(100)
I think it's a little more clear, and avoids nested / redundant loops