ScriptUO
Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: Paulonius on July 20, 2010, 08:34:38 AM
-
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...
-
i went through the same situation with the Sliem quester last night Paul. Be interesting to see what others think. One thing I noticed last night was that I had to have finditem right before the findcnt. Otherwise it never really updated.
Like:
finditem * , %containerthingy
repeat
if #findcnt = 0
-
How and where is %necessary property being set? If I'm reading that correctly and I just glanced, %necessaryProperty isn't being updated... so it looks like it's in a perpetual state of N/A? So it's always going to loop? Unless you're setting it somewhere I'm not looking... Also, you should have an if #findcnt < 1 in there right after the #finditem, just to break out with a goto... but I'd find a better way than a goto. Maybe a for loop so you can iterate through all the items then bust out. Say like for #findindex 1 #findcnt. When that loop is done, it moves on no matter what. Then you can event property each item, instead of doing a slow #finditem, you use the #findindex to iterate through ALL found at items while only doing one #finditem.
-
That is what I was thinking Twinkle McNugget. I will dig into it and figure out how to write it...