ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: The Ghost on January 18, 2013, 10:14:06 PM

Title: target scanning
Post by: The Ghost on January 18, 2013, 10:14:06 PM
I has been looking around any can't seen to find an answer to my question. so Let see if you guy can shed some light.  I'm trying to have one my script to scan for a target range.    I use this often
findItem %monster G_2 . so I can kill animals  from range  1 to 12 tile.  Or if I step up G_12 I will kill anything in that radius.    thx
Title: Re: target scanning
Post by: TrailMyx on January 19, 2013, 08:18:30 AM
Yes, that's just the radius value.  G_2 is useful for scanning for items that are within your reach.
Title: Re: target scanning
Post by: KaliOfLS on January 19, 2013, 12:19:58 PM
Unless you're an orangutan, then you can use G_3
Title: Re: target scanning
Post by: The Ghost on January 19, 2013, 03:15:36 PM
What I'm doing is recalling to a spot, trying to target every animal around me.  I have G_8 right now and it working good.   Was just looking to see if we can look at G_1, to G_8   I do believe that if you have G_8 it will look at G_8 first and get the farthest.
Title: Re: target scanning
Post by: KaliOfLS on January 19, 2013, 04:38:20 PM
targeting by distance is hard.

If you want to target closest you can use the
event macro 52 1
which will target nearest hostile
event macro 52 5
which will target nearest mobile

However, that is hard to have work out well in a lot of situations.

One solution is this

Code: [Select]
for %i 1 8
{
       finditem %iType G_ , %i
       if #findcnt > 0
       {
                  ;First entrance would be closest guy.
        }
}

However, that's a slow method due to finditem.  It's kind of a slow command.

One way to do it is to set up an algorithm that can dual sort based on one item.  Similar to
http://www.easyuo.com/forum/viewtopic.php?p=132997#132997
Title: Re: target scanning
Post by: TrailMyx on January 19, 2013, 05:46:29 PM
Unless you're an orangutan, then you can use G_3

Due to a picture I posted some time ago, I have been accused of having freakishly long arms that have caused nightmares..  lol
Title: Re: target scanning
Post by: Endless Night on January 21, 2013, 07:53:21 AM
targetting by distance and then picking the closest is actually not so hard use the finddist value
sub from my list of free to use subs  http://www.scriptuo.com/index.php?topic=2454.msg91121#msg91121 (http://www.scriptuo.com/index.php?topic=2454.msg91121#msg91121)

Code: [Select]
gosub ENs_FindClosestType %Monster
display ok Closest monster id = #result
halt

sub ENs_FindClosestType
  set !dist 100000000
  set #result N/A
  findItem %1 G_20
  if #findcnt > 0
    {
    for #findindex 1 #findcnt
       {
        if #finddist < !dist
            {
            set !dist #finddist
            set #result #findid
            }
       }
    }
return #result
Title: Re: target scanning
Post by: KaliOfLS on January 21, 2013, 07:57:31 AM
lol.  #finddist?  I use to calculate that using the max of #findx/#findy differences.  bahaha

I was thinking more of one finditem call and then organizing them in order of distance, however, by the time you're done with the first, the landscape will have changed eh?  good call
Title: Re: target scanning
Post by: Endless Night on January 21, 2013, 07:59:53 AM
lol.  #finddist?  I use to calculate that using the max of #findx/#findy differences.  bahaha

I was thinking more of one finditem call and then organizing them in order of distance, however, by the time you're done with the first, the landscape will have changed eh?  good call

One benifit of writting my EUO to LUA converter is that i had to go through every command and every var EUO supports and sets.. ... #findidst is one of those useful and overlooked vars.
Title: Re: target scanning
Post by: The Ghost on January 21, 2013, 05:00:12 PM
If only I know 1/10 of what you guy can do, I will happy  player.   Thx for the Help.  Sure gonna try to ENs way maybe that can be good.  More testing Hehe
Title: Re: target scanning
Post by: Masscre on January 24, 2013, 04:58:18 AM
Unless you're an orangutan, then you can use G_3

Due to a picture I posted some time ago, I have been accused of having freakishly long arms that have caused nightmares..  lol

He can scratch his ankles with out bending over !!
Title: Re: target scanning
Post by: The Ghost on October 20, 2016, 09:58:59 AM
Funny that 3 years  I do a search and come up to this post. I have the same issue then that I have now.  My knowledge have increase but still can't figure that one out.   

I try EN snippet and it not working because it still find the fardes one not the one near me. 

I still required help with that. 

thanks you