;Global VAR
Global $GiftsID[2] = [21491,28434]
;helper
Func IDofItem($bagid, $slotid)
Return DllStructGetData(getitembyslot($bagid, $slotid), "ID")
EndFunc
Func IDofModel($bagid, $slotid)
Return DllStructGetData(getitembyslot($bagid, $slotid), "ModelID")
EndFunc
Func QuantityofItem($bagid, $slotid)
Return DllStructGetData(getitembyslot($bagid, $slotid), "Quantity")
EndFunc
;func with bug/error?
Func OpenGifts()
For $gifts = 0 to 2
For $i = 1 to $bags
For $j = 0 to $slots
$itemmodel = IDofModel($i, $j)
If $itemmodel = $GiftsID[$gifts] Then
$itemquantity = QuantityofItem($i, $j)
For $u = 1 to $itemquantity
$itemID = IDofItem($i, $j)
UseItem($itemID)
Next
Else
ExitLoop 4
EndIf
Next
Next
Next
EndFunc
The bot closes without an error.
I want to open all gifts in the bag. what is wrong with that?
Or is there a easy way to do that?
Your code literally says exit all loops (aka stop opening gifts) as soon as item in bag i and slot j is not a gift (aka ExitLoop 4)
See :
I suspect that your item[1][1] is not a gift, that would explain the fact your bot does nothing.
Another important point, you need to put some Sleep between each UseItem() to let the server deal with your "command".
Last point, instead of using a for loop, I would have used a "Do Until" or a "While" to loop on gifts left quantity. That way, if a UseItem fail somehow, quantity will not decrease and your loop will still catch up.
In code, it should look something like this.
Code:
;func with bug/error?
If $itemmodel = $GiftsID[$gifts] Then
While QuantityofItem($i, $j) > 0
$itemID = IDofItem($i, $j)
UseItem($itemID)
Sleep(GetPing()+250)
WEnd
; No more ExitLoop since you still want to test the next item (item[i][j+1]
EndIf
Last point, assuming there are indeed 2 modelId for gifts (which I doubt), instead of doing a for loop "For $gifts = 0 to 2", you may take a look at the function _ArraySearch and do something like this "If _ArraySearch($GiftsID, $itemmodel) > 0 Then".
Code will be cleaner and "faster" since you will no longer parse your inventory twice.
Changelog:
;~ V2.3.2
;~ - Spezial thx @ Yoshikawa91 for his func to loop
;~ - Remove the Outpost Travelling
;~ - Add Multi-User Dropdown Support
;~ - Unpack all Gifts
;~ - Add some Tonics & Party Items - need to continue
Has anyone got the JQ Bot to work? The one posted in this thread is using the "oldschool" Necro Bomber Build, right? I'm seeing a ton of Eles in Jade Quarry which got me thinking if there is another non-public bot?
I've got it almost working. up til it pops imp anyways
The imp as well as mapping crashes the game. i really hope someone can help fix it because deeperblue and maril15 did a wonderful job coding it!!! i have min xp coding however deeperblue was helping me understand. I will continue researching