Author Topic: Documentation on FindTypesArrayEx?  (Read 23349 times)

0 Members and 1 Guest are viewing this topic.

Offline slyoneTopic starter

  • Full Member
  • ***
  • Posts: 135
  • Activity:
    0%
  • Reputation Power: 2
  • slyone has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Documentation on FindTypesArrayEx?
« on: October 24, 2013, 06:29:04 PM »
0
I've been working through each of the functions in Orich's ScriptAPI.cs and am interested in the following FindItems() method:

Code: [Select]
        /// <summary>
        /// Searches for items of Types[], in Containers[], and of Colors[]
        /// </summary>
        /// <param name="Types">Array of Item Types to search for</param>
        /// <param name="Containers">Array of Containers to search in [new uint[] = {0x00000000};] for Ground</param>
        /// <param name="Colors">Array of Colors to search for [new ushort[] = { 0xFFFF };] for all colors</param>
        /// <param name="Recursive">[Optional] Search Sub-Containers Recursively [Default: False]</param>
        /// <returns>List of Items Found</returns>
        public static List<Item> FindItems(ushort[] Types, uint[] Containers, ushort[] Colors, bool Recursive = false)
        {
            Stealth.Script_FindTypesArrayEx(Types, Colors, Containers, Recursive);
            uint[] findlist = Stealth.Script_GetFindList();
            List<Item> AllList = new List<Item>();
            foreach (uint item in findlist)
                AllList.Add(new Item(item));
            return AllList;
        }

I'm not the most fluent in C# so if my questions/observations are wrong please correct me.

I see three FindItems methods in the Find class.
1)
Code: [Select]
public static Item FindItem(ushort Type, uint Container = 0x00000000, bool Recursive = false, ushort Color = 0xFFFF)  Purpose:  Return the last item found of the type specified.

2)
Code: [Select]
public static List<Item> FindItems(ushort Type, uint Container = 0x00000000, bool Recursive = false, ushort Color = 0xFFFF)  Purpose:  Returns the list of Item instances returned by GetFindedList().

3)
Code: [Select]
public static List<Item> FindItems(ushort[] Types, uint[] Containers, ushort[] Colors, bool Recursive = false)  Purpose: 
Quote
Searches for items of Types[], in Containers[], and of Colors[] - From Orich's Summary comment.

I think my understanding of the first two FindItems methods is solid but I can't find more documentation on the third.  From Orich's code in ScriptAPI.cs, a call is made to the function:
Code: [Select]
Stealth.Script_FindTypesArrayEx(Types, Colors, Containers, Recursive);
I can't find this function listed in the Stealth Doc:Api.

The first two methods have default values for Container, Color, and Recursive while the third handles Lists which, I guess, don't lend themselves to the default parameters of 0x0000, and 0xFFFF.  I found a suggestion on StackOverflow for passing an empty array as a default value.

Does anyone have anymore details on the Stealth.Script_FindTypesArrayEx() function?

When calling the Stealth.Script_FindTypesArrayEx() function, do I need to set the Container parameter to a list with the first entry as 0x0000 to search the ground and set the Color parameter to a list with the first entry of 0xFFFF to search all colors?

Thanks for the help, this code is awesome!

-S


NOTE:  I dowloaded ScriptAPI.cs from Orich's C# Tutorial.  If there is a more up to date version of it posted somewhere else please let me know.
Started playing back at the Second Age

Offline dxrom

  • Master of the milestones!
  • Elite
  • *
  • *
  • Posts: 1080
  • Activity:
    0%
  • Reputation Power: 15
  • dxrom is working their way up.dxrom is working their way up.dxrom is working their way up.
  • KEYBOARD COWBOY, GREAT SAMURAI OF THE INTERNET.
  • Respect: +100
  • Referrals: 1
    • View Profile
Re: Documentation on FindTypesArrayEx?
« Reply #1 on: October 24, 2013, 07:25:41 PM »
0
There is no FindTypesArrayEx for stealth in Pascal. That is a .NET function that Orich created.

You can however step through an array of cardinal (or word I believe is actually best given that types are two-bytes and word supports two-byte data values, or something).

I have tons of examples of this in the scripts I've uploaded and within my snippets.

Example: (pulled this from my subs thread)
Code: [Select]
function SetItem(Items:Array of Cardinal;Container:Cardinal):Cardinal;
var
  i : Integer;
  List : TStringList;
begin
  for i:=0 to Length(Items)-1 do
  begin
    List:=TStringList.Create;
    if( FindTypeEx(Items[i],$FFFF,Container,False)>0 ) then
    begin
      GetFindedList(List);
      Result:=StrToInt('$'+List[0]);
    end;
    
    if( GetFindedList(List)<>False ) then List.Free;
  end;
end;

Code: [Select]
Instruments:=[$0EB2,$0E9D];

PlayItem:=SetItem(Instruments,Backpack);

UseObject(PlayItem);
//You can do this with targets also...

I dunno if this helps but it's the only example that I can think of that incorporates findtype functions available from the Stealth site API and supports arrays while also detailing how FindTypeEx can be utilized to create and read from the GetFindedList that is populated when utilizing FindTypeEx.

I might also be 100% wrong in everything I just said also, who knows? :X



 ​_██​_
(ಠ​_ృ)
I do say, ol' Chap! Come play EVE Online! Why here is a 21 Day Free Trial!

Offline Crome969

  • Moderator
  • *
  • *****
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Documentation on FindTypesArrayEx?
« Reply #2 on: October 25, 2013, 12:16:11 AM »
0
There is no FindTypesArrayEx for stealth in Pascal. That is a .NET function that Orich created.
Wrong this were introduced by Orich as Idea but implemented from Vizit0r into Stealth. Maybe he deactivated it temporarely but it were in Pascal Script ;-)

The Idea of FindTypeExArray were to support people handle multiple scans. Like you have a list of Creatures and want scan those out or such.
To handle it you must pass an Array of Itemtypes, an Array of ItemColors and an Array of Locations.
The method inside will go through each type\color\location and execute a simple findtypeex command + Save all Results at end of function to Resultlist.
Findtypeex as base would ovverride that list normaly on each execution.

So sample for c# :
Code: [Select]
ushort[] creatures = new ushort[]{12,18,17,123,22,19};
ushort[] colors = new ushort[]{0xFFFF};
uint[] locations = new uint[]{0x0};
FindTypeExArray(creatures,colors,locations,false);

Just as sidenote for future reference :
Whenever its class Stealth, it calls the api interface of Stealth and no custom code.
We seperated what is custom and what is from stealth by publishing custom in out scriptapi.cs and base in the scriptdotnet.dll
« Last Edit: October 25, 2013, 12:17:55 AM by Crome969 »

Offline Crome969

  • Moderator
  • *
  • *****
  • Posts: 2098
  • Activity:
    0%
  • Reputation Power: 25
  • Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.Crome969 is on the verge of being accepted.
  • Gender: Male
  • UO Enthusiast
  • Respect: +211
  • Referrals: 10
    • View Profile
    • ScriptSDK
Re: Documentation on FindTypesArrayEx?
« Reply #3 on: October 25, 2013, 12:20:57 AM »
0

Offline Orich

  • Jr. Member
  • **
  • Posts: 77
  • Activity:
    0%
  • Reputation Power: 3
  • Orich has no influence.
  • Respect: +12
  • Referrals: 1
    • View Profile
Re: Documentation on FindTypesArrayEx?
« Reply #4 on: October 25, 2013, 07:35:57 AM »
0
Sorry for the delay Slyone.

Stealth keeps a cache of items in memory.

The Findxxxx() functions are simple search heuristics for this cache of items.

In this context, items have 3 properties we care about

Item.ID = Unique ID
Item.Color = Item's Color Hue
Item.Container = Item's parent container (0x0000 = ground, all non-zero are containers in the game)

My FindItem() wrapper functions might start becoming self explanatory now.

Code: [Select]
public static Item FindItem(ushort Type, uint Container = 0x00000000, bool Recursive = false, ushort Color = 0xFFFF)In plain english   "Search for an item of Type, inside of Container, `should i search inside other bags?`, that is of hue Color"


Code: [Select]
public static List<Item> FindItems(ushort Type, uint Container = 0x00000000, bool Recursive = false, ushort Color = 0xFFFF)In plain english   "Search for ALL items of Type, inside of Container, `should i search inside other bags?`, that is of hue Color"


Code: [Select]
public static List<Item> FindItems(ushort[] Types, uint[] Containers, ushort[] Colors, bool Recursive = false)In plain english   "Search for ALL items that are of any type inside Types, that are in any of the containers inside Containers, of any hue inside Colors, and should we search within all bags for these Types?"



Please be aware ... These functions don't actually send anything to the UO servers.  These are just search mechanisms for the cache of items that Stealth has stored.

If you have any other questions, feel free to ask.

-Orich
« Last Edit: October 25, 2013, 07:42:13 AM by Orich »
Member of the Stealth development team.
Author of Stealth .NET DLL

Offline slyoneTopic starter

  • Full Member
  • ***
  • Posts: 135
  • Activity:
    0%
  • Reputation Power: 2
  • slyone has no influence.
  • Gender: Male
  • Respect: +40
  • Referrals: 1
    • View Profile
Re: Documentation on FindTypesArrayEx?
« Reply #5 on: October 25, 2013, 04:45:57 PM »
0

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
Script_F Functions from Stealth_dll.png
Started playing back at the Second Age

Tags: