ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: NObama on January 13, 2010, 08:12:50 PM

Title: Dropping items on the ground
Post by: NObama on January 13, 2010, 08:12:50 PM
Okay - this should be much simpler than I'm making it.

Essentially, I am crafting a snippet that, when called, will scan my pack for items and drop them next to me.

Code: [Select]
sub drop_stuff
   set !dropitems POF_
   finditem !dropitems C_
    if #findkind <> -1
    {
      exevent drag #findid #findstack
      wait 13
      exevent dropg #CHARPOSX #CHARPOSY #CHARPOSZ
      wait 13
    }

That look right to you?  I can't field test, as I'm not in a place where I can access UO.  Can I drop stuff on the ground underneath my char, or do I need to offset the x y z coords a tad?

Thoughts?  Usually, I'm putting stuff *in* my back, not chucking it on the ground...so I'm new to dropg.

 :)
Title: Re: Dropping items on the ground
Post by: TrailMyx on January 13, 2010, 08:23:04 PM
There's a problem dropping items at your feet on OSI.  Works fine on RunUO.
Title: Re: Dropping items on the ground
Post by: UOMaddog on January 13, 2010, 09:23:38 PM
Yea, just offset x or y by 1 and you'll be fine! (as long as you're not standing in a corner!  :P )
Title: Re: Dropping items on the ground
Post by: Endless Night on January 15, 2010, 08:55:08 AM
I wrote a sub someplace that wraps the drop routine in a loop that increments where the item is dropped .. bascially it iterates through the 8 tiles around you attempting to drop item.

If i rember right you might want to leave the z option off as you dont know what the z axis is for the tile -1 -1 or +1 +1 from your location


Title: Re: Dropping items on the ground
Post by: _C2_ on January 15, 2010, 09:43:52 AM
I wrote a sub someplace that wraps the drop routine in a loop that increments where the item is dropped .. bascially it iterates through the 8 tiles around you attempting to drop item.

If i rember right you might want to leave the z option off as you dont know what the z axis is for the tile -1 -1 or +1 +1 from your location




I have that sub in my farming script.  I can dig it out and post it here later.
Title: Re: Dropping items on the ground
Post by: NObama on January 15, 2010, 03:45:58 PM
Awesome - thanks, C2!  Since I didn't see any "umm - you screwed up in line X" I presume I'm at least close to viable code. 

 :)
Title: Re: Dropping items on the ground
Post by: _C2_ on January 15, 2010, 04:06:19 PM
here is endless fine piece of work that continues to find diff spots until gets a viable drop spot.  It is for initial droppping not stacking onto existing piles.

You need to fill these in or assign them values when u do the gosub:
%itemid %BagFrom %DropRadius

Code: [Select]
Sub DropOnGround ; %itemid %BagFrom %DropRadius
set %Item %1
IF %0 <= 1
set %2
set %BagFrom %2
IF %0 <= 2
set %3 2
set %DropRadius %3

Set %XPos ( #CharPosX - %DropRadius )
Set %YPos ( #CharPosY - %DropRadius )
Set %DropExit #False
Repeat
wait 10
FindItem %item C_ , %BagFrom
wait 3
If #FindKind = -1
Set %DropExit #True

IF %DropExit = #False
{
;event ExMsg #charID 3 0 trying %xpos %ypos
ExEvent Drag #findid #Findstack
Wait 12
ExEvent DropG %Xpos %YPos

; Increment Position
Set %XPos ( %XPos + 1 )
If %Xpos > ( #CharPosX + %DropRadius )
{
Set %YPos ( %YPos + 1 )
Set %XPos ( #CharPosX - %DropRadius )
}
}
Until %DropExit || %YPos > ( #CharPosY + %DropRadius )
Return %DropExit

Title: Re: Dropping items on the ground
Post by: Endless Night on January 15, 2010, 07:43:01 PM
Totally forgot i gave you that code c2 lol.. nice
Title: Re: Dropping items on the ground
Post by: Khameleon on January 15, 2010, 08:28:45 PM
I had a sub that used to drop crap off the side of your boat... I dunno where it is anymore.
Title: Re: Dropping items on the ground
Post by: NObama on January 16, 2010, 02:58:47 AM
ENs code is perfect for my needs (isn't it always?).  Fantastic fellows, thanks!

 :)

Next step...a sub to find it and pick it back up again....muahahahaha
Title: Re: Dropping items on the ground
Post by: Endless Night on January 16, 2010, 06:36:40 AM
ENs code is perfect for my needs (isn't it always?).  Fantastic fellows, thanks!

 :)

Next step...a sub to find it and pick it back up again....muahahahaha

see...
http://www.scriptuo.com/index.php?topic=2454.msg33512#msg33512
Title: Re: Dropping items on the ground
Post by: NObama on January 16, 2010, 11:21:37 AM
Thanks EN!  I'll review that to improve my own code.  I went with:

Code: [Select]
sub FindStuff
  set #result #false
  finditem POF_JJG_ G_7
  If #Findcnt > 0
    {
    set !exit 15
    Repeat
      finditem POF_JJG_ G_7
      Event Pathfind #findx #findy #findz  ; the stuff
      wait 1s
      set !exit !exit -1
        finditem POF_JJG_ G_2
          if #findstack > 0
             {
             exevent drag #findid #findstack
             wait 13
             exevent dropc #backpackid
             wait 13
             return
             }
    Until !exit < 1 || #findcnt > 0
    set #result #findcnt > 0
    }
Return #Result

You'll probably recognize it as a derivation of some code you helped me write for Ant Farm.  It's very kludgey the way I've used it here, because if there is more than one pile of something, it only grabs the first one...

 :)
Title: Re: Dropping items on the ground
Post by: Endless Night on January 16, 2010, 01:02:13 PM
yup .. that looks like a jacked version of my stlye.. lol :)