Author Topic: Finditem *, #FindCnt and ItemIgnore  (Read 3205 times)

0 Members and 1 Guest are viewing this topic.

Offline PauloniusTopic starter

  • Elite
  • *
  • *
  • Posts: 2040
  • Activity:
    0%
  • Reputation Power: 29
  • Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.
  • Respect: +304
  • Referrals: 1
    • View Profile
Finditem *, #FindCnt and ItemIgnore
« on: July 20, 2010, 08:34:38 AM »
0
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.

Code: [Select]
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...
This coin declares Caesar is "Dictator for Life." He did serve as Dictator for the remainder of his life, but his life would end only a few weeks after this issue. For Caesar to put his image on coins and essentially declare himself king was too much for Brutus and his republican allies.

"If everything seems under control, you're not going fast enough'
-Mario Andretti

"If everyone is thinking alike, someone isn't thinking."
- General George Patton Jr

Offline baldielocks

  • Sr. Member
  • *
  • Posts: 301
  • Activity:
    0%
  • Reputation Power: 4
  • baldielocks has no influence.
  • Gender: Male
  • Respect: +94
  • Referrals: 5
    • View Profile
Re: Finditem *, #FindCnt and ItemIgnore
« Reply #1 on: July 20, 2010, 01:49:16 PM »
0
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

Scrripty

  • Guest
Re: Finditem *, #FindCnt and ItemIgnore
« Reply #2 on: July 20, 2010, 02:02:51 PM »
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.

Offline PauloniusTopic starter

  • Elite
  • *
  • *
  • Posts: 2040
  • Activity:
    0%
  • Reputation Power: 29
  • Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.Paulonius is on the verge of being accepted.
  • Respect: +304
  • Referrals: 1
    • View Profile
Re: Finditem *, #FindCnt and ItemIgnore
« Reply #3 on: July 20, 2010, 02:09:39 PM »
0
That is what I was thinking Twinkle McNugget.  I will dig into it and figure out how to write it...
This coin declares Caesar is "Dictator for Life." He did serve as Dictator for the remainder of his life, but his life would end only a few weeks after this issue. For Caesar to put his image on coins and essentially declare himself king was too much for Brutus and his republican allies.

"If everything seems under control, you're not going fast enough'
-Mario Andretti

"If everyone is thinking alike, someone isn't thinking."
- General George Patton Jr

Tags: