ScriptUO

Scripting Resources & Utilities => Stealth Client => Stealth archive => Topic started by: rwo001 on December 02, 2013, 07:01:11 AM

Title: Stealth.Script_FindType
Post by: rwo001 on December 02, 2013, 07:01:11 AM
Code: [Select]
Stealth.Script_SetFindDistance(2);
Stealth.Script_FindType(0xffff, 0x0000);
List<uint> _findlist = new List<uint>(Stealth.Script_GetFindList());
foreach (uint i in _findlist) { Console.WriteLine("{0:X}",i); }
Console.WriteLine("Total:{0}",_findlist.Count);
Console.ReadLine();

i found the result is different from i see in StealthUO as attached.
Title: Re: Stealth.Script_FindType
Post by: Crome969 on December 02, 2013, 08:40:02 AM
Can you keep sure, that no item on ground were moved? and Also the range isnt different to your view on World?

Title: Re: Stealth.Script_FindType
Post by: Orich on December 02, 2013, 10:56:06 AM
Notice the Z axis of the missing item is Z = -43

Chances are the vertical find distance threshold is too low to cover that item.  This is the distance between Self.Z and Item.Z

Stealth.Script_SetFindVeritcal(50); should cover it.
Title: Re: Stealth.Script_FindType
Post by: rwo001 on December 02, 2013, 03:30:39 PM
Yes ...careless mistake.. :P
Title: Re: Stealth.Script_FindType
Post by: rwo001 on December 02, 2013, 04:05:54 PM
Another question on Finding

Is anyway to find NPC faster?
Code: [Select]
                Stealth.Script_SetFindDistance(50);
                Stealth.Script_SetFindVertical(255);
                Stealth.Script_FindType(0xffff, 0x0);
                List<uint> _findlist = new List<uint>(Stealth.Script_GetFindList());               
                List<uint> _creature = new List<uint>();
                Console.WriteLine(DateTime.Now);               
                foreach (uint i in _findlist)
                {
                    // The problem seems in here..
                    if ( Stealth.Script_GetNotoriety(i) > 0 ){
                        _creature.Add(i);
                    }
                }
                Console.WriteLine(DateTime.Now);                 
                Console.WriteLine("Total NPC:{0}", _creature.Count);
                Console.WriteLine("Total FindItem:{0}", _findlist.Count);

It use 2 seconds to filter the result...
Title: Re: Stealth.Script_FindType
Post by: rwo001 on December 02, 2013, 08:58:04 PM
I found the function Stealth.Script_FindNotoriety().
But it seems only return uint and will not update Stealth.Script_GetFindList();

Code: [Select]
Stealth.Script_SetFindDistance(255);
Stealth.Script_SetFindVertical(255);

List<uint> _creature = new List<uint>();
for (byte i = 1; i <= 7; i++)
{
    Stealth.Script_FindNotoriety(0xffff, i);
    Console.WriteLine("Notoriety : {0} , Found : {1} , Found List : {2} ", i, Stealth.Script_GetFindCount(), Stealth.Script_GetFindList().Length);
}

Another problem...Cannot Use FindNotoriety to find Player Vendor
Code: [Select]
            uint _id = 0x01E42449;
            Console.WriteLine("Player Vendoer Notoriety : {0}", Stealth.Script_GetNotoriety(_id));
            Stealth.Script_FindNotoriety(Stealth.Script_GetType(_id), Stealth.Script_GetNotoriety(_id));
            Console.WriteLine("Find Notoriety Count : {0}", Stealth.Script_GetFindCount());

            _id = Stealth.Script_GetSelfID();
            Console.WriteLine("Self Notoriety : {0}", Stealth.Script_GetNotoriety(_id));
            Stealth.Script_FindNotoriety(Stealth.Script_GetType(_id), Stealth.Script_GetNotoriety(_id));
            Console.WriteLine("Find Notoriety Count : {0}", Stealth.Script_GetFindCount());
            Console.ReadLine();
Title: Re: Stealth.Script_FindType
Post by: Orich on December 02, 2013, 10:38:25 PM
Stealth.Script_IsNPC() would be easier to discern what is an NPC.


If you want speed, you will need to collect a list of valid types to search for.  I would suggest looking for old EasyUO scripts with the NPC types you are looking for, then converting them in Stealth or programatically via. Script_EUO2StealthType()


Hope that helps.
Title: Re: Stealth.Script_FindType
Post by: rwo001 on December 02, 2013, 11:17:31 PM
m...the main purpose of my function is used to find all creature in certain range.
in my openeuo script, i use it for auto attack all finditem with findrep 1,2,7..

Also, i found that if i use any Stealth.Script_GetXXXX [e.g. Stealth.Script_GetX(_id) ] in the loop..it consumes lots of time...It will not happen when I use Pascal script...
Title: Re: Stealth.Script_FindType
Post by: Orich on December 02, 2013, 11:54:01 PM
m...the main purpose of my function is used to find all creature in certain range.
in my openeuo script, i use it for auto attack all finditem with findrep 1,2,7..

Also, i found that if i use any Stealth.Script_GetXXXX [e.g. Stealth.Script_GetX(_id) ] in the loop..it consumes lots of time...It will not happen when I use Pascal script...


This is a problem with Stealth.exe ... Big changes in next release, and the performance issue will be fixed :)
Title: Re: Stealth.Script_FindType
Post by: rwo001 on December 03, 2013, 12:01:24 AM
sound good...looking for the update... ;D