Has some1 a working store function?

03/19/2022 10:25 Backxtar#1
Jo, im coding a new ministerial commendation bot. has some1 a working storage function to store all perfekt items / gold?
03/19/2022 12:55 Powarangar#2
Code:
Func GoldIs($bagIndex, $numOfSlots)
	For $i = 1 To $numOfSlots
		ConsoleWrite("Checking items: " & $bagIndex & ", " & $i & [MENTION=3576271]CRLF[/MENTION])
		$aItem = GetItemBySlot($bagIndex, $i)
		If DllStructGetData($aItem, 'ID') <> 0 And GetRarity($aItem) = $RARITY_Gold Then
			Do
				For $bag = 8 To 11 ; 6 To 16 are all storage bags
					$slot = FindEmptySlot($bag)
					If $slot <> 0 Then
						$FULL = False
						$nSlot = $slot
						ExitLoop 2; finding first empty $slot in $bag and jump out
					Else
						$FULL = True; no empty slots :(
					EndIf
					Sleep(400)
				Next
			Until $FULL = True
			If $FULL = False Then
				MoveItem($aItem, $bag, $nSlot)
				ConsoleWrite("Gold item moved ...."& [MENTION=3576271]CRLF[/MENTION])
				PingSleep(1000)
			EndIf
		EndIf
	Next
EndFunc   ;==>GoldIs




Func FindEmptySlot($bagIndex) ;Parameter = bag index to start searching from.	Returns integer with item slot. This function also searches the storage. If any of the returns = 0, then no empty slots were found
	Local $lItemInfo, $aSlot

	For $aSlot = 1 To DllStructGetData(GetBag($bagIndex), 'Slots')
		Sleep(40)
		ConsoleWrite("Checking: " & $bagIndex & ", " & $aSlot & [MENTION=3576271]CRLF[/MENTION])
		$lItemInfo = GetItemBySlot($bagIndex, $aSlot)
		If DllStructGetData($lItemInfo, 'ID') = 0 Then
			ConsoleWrite($bagIndex & ", " & $aSlot & "  <-Empty! " & [MENTION=3576271]CRLF[/MENTION])
			$lReturn = $aSlot
			ExitLoop
		Else
			$lReturn = 0
		EndIf
	Next
	Return $lReturn
 EndFunc   ;==>FindEmptySlot
bitte, copy pasta aus einem script
03/21/2022 22:27 Backxtar#3
I have this 2 functions.. but the bot always want the 6, 1 slot in chest.. but this slot isnt empty so.. where is my mistake?...

Code:
If FindEmptyStorageSlot($lStorageNumber, $lSlotNumber) Then
	Out("Storing item [" & $I & "," & $J & "]")
	MoveItem($lItem, $lStorageNumber, $lSlotNumber)
	Do
		RndSleep(GetPing() + 1000)
	Until DllStructGetData(GetItemBySlot($lStorageNumber, $lSlotNumber), "ID") <> 0
EndIf
Code:
Func FindEmptyStorageSlot(ByRef $StorageNumber, ByRef $SlotNumber)
	For $StorageNumber = 6 To 16
		Local $lBag = GetBag($StorageNumber)
		If $lBag == 0 Then
			Return False
		EndIf
		For $SlotNumber = 1 To 20
			Local $lItem = GetItemBySlot($StorageNumber, $SlotNumber)
			If DllStructGetData($lItem, "ID") = 0 Then
				Return True
			EndIf
		Next
	Next
	Return False
EndFunc ; <== Find empty storage slot
03/24/2022 23:24 afmart#4
check what id you get on slot 1,1. if it gets nothing you probaply need new pointers or headers
03/26/2022 08:54 Backxtar#5
Ye, i fixed it :)