ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: rbestone on March 29, 2014, 04:17:25 PM

Title: help with using an item at +/- my characters position
Post by: rbestone on March 29, 2014, 04:17:25 PM
looking for info about using an object located at -1, -2 of your character in a field of same type objects.
im working on a fishing script that picksup and replaces traps. i can get it to do everything except, it just picks up random traps instead of the one i want. i cant figure out how to make it see a specific spot, based off my char position.
Code: [Select]
7pick&replace:
findItem CZZ G_ 5    ;i dont know how to make this - or + charpos instead of ground 5
if #findKind = -1
{
      wait 10
      goto trap
            }
            else
{
set #ltargetKind
set #lobjectID #findID
  set #ltargetKind 1
event macro 17 0
wait 10
set #lTargetX #charposx +  +1 ; i know its to late here
set #lTargetY #charposy +  -1 ; and here
set #lTargetZ 1
wait 25
Title: Re: help with using an item at +/- my characters position
Post by: TrailMyx on March 29, 2014, 04:45:13 PM
When you do a "finditem" command, you also get information about where the item is located and that is returned in #FINDX, #FINDY and #FINDZ.  If you subtract your #CHARPOSX from #FINDX, you get a relative location of the item.  Same goes for the Y and Z coords.  This gives you an idea where the item is located relative to your position.
Title: Re: help with using an item at +/- my characters position
Post by: manwinc on March 29, 2014, 09:04:48 PM
Hmm.... Probably the easiest method for you to work with would be to build individual Subs for Each Trap Location Based on Position.

Code: [Select]
Sub Trap1
Finditem CZZ G_5
if #Findcnt > 0
{
For #Findindex 1 #Findcnt ; Index's Through all the items That are Found of that Type within the Range
{
if #Findx = #Charposx - 2 && #Findy = #Charposy -1 ; here is where you setup your Coordinates
{
; DO STUFF
}
}
}
Return


Then you Could Build a Sub For Each Trap And when you wanted to pull a specific one you just Gosub to it.

Gosub Trap1
Gosub Trap2
Gosub Trap3

etc etc etc
Title: Re: help with using an item at +/- my characters position
Post by: rbestone on March 30, 2014, 03:53:39 AM
thank you both for the info and explanation of how/why it works. i will give it a whirl and let you know.
Title: Re: help with using an item at +/- my characters position
Post by: Fluwton on May 09, 2014, 12:27:12 PM
They didn't let you know.

I fear that this all may have been an elaborate ruse to get you guys to waste valuable electrons on a response.

The fiend!