Author Topic: Trying to replicate EasyUO's loop through found items in Stealth, please help.  (Read 3340 times)

0 Members and 1 Guest are viewing this topic.

Offline graysontTopic starter

  • Jr. Member
  • **
  • Posts: 12
  • Activity:
    0%
  • Reputation Power: 1
  • graysont has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
I had an issue, ended up resolving it myself. I'll explain it here because I'm sure others will have the same problems I did.

Easyuo has the feature when you find an item type, it returns an array that you can loop through. Something like this ...

Code: [Select]
finditem DWJ c_ , #backpackid
  for #findindex 1 #findcnt
    {
      ... do stuff with each item, whether you found 1 or 1000, accessing items using #finditem ...
    }

It was a challenge figuring out how to achieve the same functionality in Stealth. Most of the find functions (except FindType) lump all the items you find that are similar into one item count. If you're looking to loop through a series of items you find that are similar, here's a little minimal application I wrote that simply loops through all the large-sized ore at your feet, double clicking them.

Code: [Select]
Program New;

const
Ore=$19B9;


procedure doubleclickore;
  var
  b : Integer;
  i : Integer;
  List: TStringList;
 
begin
  FindDistance := 3;
  FindType(Ore,Ground);
  if(FindCount > 0) then
  begin
    List := TStringList.Create();
    GetFindedList(List);
    for i := 0 to List.Count -1 do
    begin
    b := StrToInt('$'+List.Strings[i]);
      UseObject(b);
      wait(2000);
    end;
  end;
end;   
 
Begin
 doubleclickore;
End.
« Last Edit: August 01, 2016, 09:11:59 PM by graysont »

Offline playforfun

  • Restricted
  • **
  • Posts: 28
  • Activity:
    0%
  • Reputation Power: 1
  • playforfun has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Just thought I'd share what I use.

Code: [Select]
Procedure Smelt();
var
i : Integer;
begin
     Wait(300);
     OreType;
     for i := Low(Ore) to High(Ore) do
     if(FindType(Ore[i], Backpack) > 0) then       
     begin
         while Count(Ore[i]) > 1 do     
         begin
             AddToSystemJournal('Smelting Ore: ' + IntToStr(Ore[i]));
             UseObject(FindItem);
             WaitTargetObject(FireBeetle);
             Wait(1000);
         end;
     end; 
     UseObject(FireBeetle); 
     Wait(300);
end;
Procedure OreType();
begin
    Ore[0] := $19B9; //large pile
    Ore[1] := $19B8; //medium pile
    Ore[2] := $19BA; //small pile 1
    Ore[3] := $19B7; //small pile 2   
end;

Tags: