I built a general purpose container to container script that I use a lot for manipulating a large amount of objects between containers. It uses the line Finditem * C_ , %SourceContainer to find the next item to move. I built in a variable that you can assign to scan the items for a property, allowing you to pull only one type of item out of a bag full of stuff. If you leave this input blank, it just moves everything from one container to another, but its nice if you want to pull all of the copper hammers out of a mixed bag of hammers for example.
The issue I am seeing is that #FindCnt never seems to get to zero when it is ignoring things, so if the conditional is supposed to be met by having moved all of the items that meet the property requirement it ends up in a loop. I wonder if there is a way around this. Is there a value for #FindCnt when the only items it finds are being ignored? Here is loop I built that moves things.
Repeat
{
Move_Item_Loop:
Finditem * C_ , %SourceBag
If %NecessaryProperty <> N/A
{
Event Property #FindID
If %NecessaryProperty notin #Property
{
IgnoreItem #FindID
GoTo Move_Item_Loop
}
}
set %jstart #jIndex + 1
exevent drag #FindID
wait 15
exevent dropc %TargetBag
Wait 15
Set %NumberMoved %NumberMoved + 1
Finditem * C_ , %SourceBag
set %jend #jIndex
scanjournal #jindex
for %ji %jstart %jend
{
scanJournal %ji
if That_Container_Cannot_Hold_More_Items in #Journal
Set %TargetContainerFull Yes
}
event exmsg #charid 3 4 TEST MESSAGE Find Count is #FindCnt
Wait 5
}
Until #FindCnt < 1 || %TargetContainerFull = Yes || %NumberMoved = %NumberToMove
What I wonder is whether this might better be accomplished by doing just one Finditem and then working through that list looking at each item in sequence, but I am unsure of the syntax for a routine like that.
Hmm, going to look at something I saw in one of Cerv or C2's scripts...