ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: Crisis on December 27, 2013, 07:20:43 PM

Title: Clearing a pack
Post by: Crisis on December 27, 2013, 07:20:43 PM
I am trying to clear a pack of bows to the trash barrel in a fletching script.

This is in the set up

Code: [Select]
set %garbage SLK_WOH_SGP_JSF_QPO_LMH_PPO ;crafted bows
This is before the sub

Code: [Select]
sub ScriptBegin
  set %lastitemindex 0
  gosub setup
  gosub ClearPackBoards %Boards
  gosub ClearPackGarbage %Garbage
return

Here is the ClearGarbage sub

Code: [Select]
sub ClearPackGarbage
  menu delete scriptstatus
  Menu Font BGColor Black
  menu Font Color Lime
  menu text scriptstatus 95 100 Clearing Pack of Garbage
  finditem %1 C_ , #backpackid
  if #findcnt < 1
    return
  for #findindex 1 #findcnt
  {
    exevent drag %Garbage
    exevent dropc %Trashbarrel
  }
return

I believe my error is in this line but I am not sure how to fix it.

Code: [Select]
exevent drag %Garbage
How do I fix this?
Title: Re: Clearing a pack
Post by: The Ghost on December 27, 2013, 07:51:46 PM
I'm no genius, but

Code: [Select]

sub ClearPackGarbage
finditem SLK_WOH_SGP_JSF_QPO_LMH_PPO C_ , #backpackid   
wait 5
if #findcnt > 0
{
for %i 1 #findcnt
{
finditem SLK_WOH_SGP_JSF_QPO_LMH_PPO C_ , #backpackid
wait 5
Exevent Drag #findid
Exevent Dropc %Trashbarrel  
wait 20
}
}
return

that should work.  now that I change the top finditem
Title: Re: Clearing a pack
Post by: Crisis on December 27, 2013, 07:55:40 PM
I tried this after posting

Code: [Select]
exevent drag #findid %Garbage
and it will drag one item from pack to garbage but no more than that one :(

I will try it without the %garbage on it and see what happens.

EDit: I tried it and it did the same thing, moved just one but it also had a bunch of "you must wait to perform another action" afterwards. Sad
Title: Re: Clearing a pack
Post by: TrailMyx on December 27, 2013, 08:23:26 PM
So is

UVF_EWF_FWF_GWF
and
SLK_WOH_SGP_JSF_QPO_LMH_PPO

both considered garbage?

if so, then perhaps this?

Code: [Select]
gosub ClearPackGarbage UVF_EWF_FWF_GWF
gosub ClearPackGarbage SLK_WOH_SGP_JSF_QPO_LMH_PPO
stop
;--------------------------------
sub ClearPackGarbage
  finditem %1 C_ , #backpackid
  if #findcnt > 0
  {
    for #FINDINDEX 1 #FINDCNT
    {
      Exevent Drag #findid
      Exevent Dropc %Trashbarrel
      wait 20
    }
  }
return
Title: Re: Clearing a pack
Post by: Crisis on December 27, 2013, 08:59:49 PM
I have changed the sub to this

Code: [Select]
sub ClearPackGarbage
  menu delete scriptstatus
  Menu Font BGColor Black
  menu Font Color Lime
  menu text scriptstatus 95 100 Clearing Pack of Garbage
  finditem %Garbage C_ , #backpackid
  if #findcnt < 1
    return
  for #findindex 1 #findcnt
  {
    exevent drag %findid #findstack
    exevent dropc %Trashbarrel
  }
return

Garbage is identified in the setup as

Code: [Select]
set %garbage SLK_WOH_SGP_JSF_QPO_LMH_PPO ;crafted bows
I am not sure where ghost got that one line of garbage. I am still having the same problem with it dumping one item but not the rest.
Title: Re: Clearing a pack
Post by: TrailMyx on December 27, 2013, 09:08:42 PM
You should keep some wait after the dropc.  Otherwise you'll be ghosting items like a mofo.
Title: Re: Clearing a pack
Post by: The Ghost on December 27, 2013, 09:16:25 PM
Sorry,  I was working of other stuff and paste the wrong item :( 

Code: [Select]
sub ClearPackGarbage
finditem SLK_WOH_SGP_JSF_QPO_LMH_PPO C_ , #backpackid   
wait 5
if #findcnt > 0
{
for %1 1 #findcnt
{
finditem SLK_WOH_SGP_JSF_QPO_LMH_PPO C_ , #backpackid
wait 5
Exevent Drag #findid
waiut 10
Exevent Dropc %Trashbarrel 
wait 10
}
}
return
Title: Re: Clearing a pack
Post by: Crisis on December 27, 2013, 10:04:38 PM
I tried this route and still same results, should I put a loop in there?

Code: [Select]
sub ClearPackGarbage
  menu delete scriptstatus
  Menu Font BGColor Black
  menu Font Color Lime
  menu text scriptstatus 95 100 Clearing Pack of Garbage
  finditem %Garbage C_ , #backpackid
  if #findcnt < 1
    return
  for %IitemToDump 1 #findcnt
  {
    Set #FindIndex %ItemToDump
    exevent drag #findid #findstack
    wait 10
    exevent dropc %Trashbarrel
    wait 10
  }
return

I tried a loop like this

Code: [Select]
sub ClearPackGarbage
  menu delete scriptstatus
  Menu Font BGColor Black
  menu Font Color Lime
  menu text scriptstatus 95 100 Clearing Pack of Garbage
  finditem %Garbage C_ , #backpackid
  if #findcnt < 1
    return
  DumpGarbage_Loop1:
  finditem %Garbage C_ , #backpackid
  if #findcnt > 0
  for %IitemToDump 1 #findcnt
  {
    Set #FindIndex %ItemToDump
    exevent drag #findid #findstack
    wait 10
    exevent dropc %Trashbarrel
    wait 10
    goto DumpGarbage_Loop1
  }
return

but it stops after the last item and I don't see a way to direct it to the return after the last item is dumped so I guess this way is out too.
Title: Re: Clearing a pack
Post by: Grandewd on December 28, 2013, 12:31:34 AM
You should keep some wait after the dropc.  Otherwise you'll be ghosting items like a mofo.

".....ghosting items like a  mofo"   

Love it when you talk like that! 
  ::)
Title: Re: Clearing a pack
Post by: The Ghost on December 28, 2013, 08:47:42 AM
Crisis ,  the way it flow, it will scan and kept a count. so no loop is required.    Are you sure you are the right ID for the trash can.

Have a look at this.

Code: [Select]
sub ClearPackGarbage
  menu delete scriptstatus
  Menu Font BGColor Black
  menu Font Color Lime
  menu text scriptstatus 95 100 Clearing Pack of Garbage
  finditem %Garbage C_ , #backpackid
  if #findcnt > 0
{
  for %i 1 #findcnt
  {
     finditem %Garbage C_ , #backpackid
    exevent drag #findid #findstack
    wait 10
    exevent dropc %Trashbarrel
    wait 10
  }
}
return


or maybe this if all the bows are the same colour

Code: [Select]

sub ClearPackGarbage
  menu delete scriptstatus
  Menu Font BGColor Black
  menu Font Color Lime
  menu text scriptstatus 95 100 Clearing Pack of Garbage
  finditem %Garbage C_ , #backpackid
 for #findindex 1 #findcnt
{
if #findcol <> 0
   {
    exevent drag #findid #findstack
    wait 10
    exevent dropc %Trashbarrel
    wait 10
   }
}
return
Title: Re: Clearing a pack
Post by: Crisis on December 28, 2013, 09:25:41 AM
The bows are all regular wood and the script targets the trash barrel at the beginning of the script. I know one makes it in because I get a message about cleanup points. Unfortunately it only throws away one, no more unless I have it loop but then it stalls at clearing the pack of garbage. I do appreciate the suggestions and will try that out when I get a chance.
Title: Re: Clearing a pack
Post by: Endless Night on December 29, 2013, 07:24:32 AM
All that is needed is a very simple change from your original post 1 code  (when draggin and dropping you must have waits or get ghost items). 


Code: [Select]
sub ClearPackGarbage
  menu delete scriptstatus
  Menu Font BGColor Black
  menu Font Color Lime
  menu text scriptstatus 95 100 Clearing Pack of Garbage
  finditem %1 C_ , #backpackid
  if #findcnt < 1
    return
  for #findindex 1 #findcnt
  {
    exevent drag #findid #findstack 
    wait 10
    exevent dropc %Trashbarrel
    wait 10
  }
return
Title: Re: Clearing a pack
Post by: Crisis on January 01, 2014, 01:09:22 PM
It was the wait the entire time, lol. Simple mistakes will get you every time. Thanks for the assistance everyone!

TM I think that you need to trade mark this phrase, "ghosting items like a mofo" LMAO

All that is needed is a very simple change from your original post 1 code  (when draggin and dropping you must have waits or get ghost items). 


Code: [Select]
sub ClearPackGarbage
  menu delete scriptstatus
  Menu Font BGColor Black
  menu Font Color Lime
  menu text scriptstatus 95 100 Clearing Pack of Garbage
  finditem %1 C_ , #backpackid
  if #findcnt < 1
    return
  for #findindex 1 #findcnt
  {
    exevent drag #findid #findstack 
    wait 10
    exevent dropc %Trashbarrel
    wait 10
  }
return

I made it a wait 20 and it worked perfectly!
Title: Re: Clearing a pack
Post by: Endless Night on January 02, 2014, 05:42:02 AM
The ghosting was the waits.... but also note the change on the drag line

for #findindex 1 #findcnt
  {
    exevent drag #findid #findstack 

When looping, ie setting  #findindex 1 then 2 then 3....#findcnt  what you are doing is changing a pointer and when #findindex =1 .. #findid, #findstack and all the other #find??? variable are set to the FIRST item found details... When you then set #findindex = 2 .. it resets all the #find??? vars to the second item found.... set #findindex 10 all #find??? vars are set to the 10th item in the found list from the last finditem command etc etc

That was an important change from the way you originally  had it.