ScriptUO
Official ScriptUO EasyUO Scripts => Script Debug => Topic started 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
set %garbage SLK_WOH_SGP_JSF_QPO_LMH_PPO ;crafted bows
This is before the sub
sub ScriptBegin
set %lastitemindex 0
gosub setup
gosub ClearPackBoards %Boards
gosub ClearPackGarbage %Garbage
return
Here is the ClearGarbage sub
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.
exevent drag %Garbage
How do I fix this?
-
I'm no genius, but
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
-
I tried this after posting
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
-
So is
UVF_EWF_FWF_GWF
and
SLK_WOH_SGP_JSF_QPO_LMH_PPO
both considered garbage?
if so, then perhaps this?
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
-
I have changed the sub to this
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
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.
-
You should keep some wait after the dropc. Otherwise you'll be ghosting items like a mofo.
-
Sorry, I was working of other stuff and paste the wrong item :(
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
-
I tried this route and still same results, should I put a loop in there?
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
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.
-
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! ::)
-
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.
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
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
-
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.
-
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).
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
-
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).
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!
-
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.