ScriptUO

Official ScriptUO EasyUO Scripts => Script Debug => Topic started by: The Ghost on August 15, 2013, 05:20:59 PM

Title: Exent property issue
Post by: The Ghost on August 15, 2013, 05:20:59 PM
I have a sub that suppose to only trash the blackrock, but for some reason the one that have the same ID of the Diamond don't get pick up 100% of the time.  Did my sub missing something are it just a matter of timing.

Code: [Select]
Sub Clearblackrock
finditem UVF_EWF_FWF_GWF C_ , #backpackid
    for #findindex 1 #findcnt
        {
        event property #findid
        if Blackrock in #property
        set %blackrock #findid    ; Finds only Blackrock, not the Diamonds.
        }
    wait 10
    if #findcnt > 0
       {
       for %i 1 #findcnt
           {
           finditem %blackrock C_ , #backpackid
           exevent Drag #findid #findstack
           exevent Dropc %TrashBarrel 
            wait 20
           }
       }
    return
Title: Re: Exent property issue
Post by: manwinc on August 15, 2013, 06:46:49 PM
You confused the crap out of me.... Seriously... had to change pants.

Code: [Select]
Sub Clearblackrock
finditem UVF_EWF_FWF_GWF C_ , #backpackid
    for #findindex 1 #findcnt
        {
        event property #findid
        if Blackrock in #property
        set %blackrock #findid    ; Finds only Blackrock, not the Diamonds.
        }
    wait 10
    if #findcnt > 0
       {
       for %i 1 #findcnt
           {
           finditem %blackrock C_ , #backpackid
           exevent Drag #findid #findstack
           exevent Dropc %TrashBarrel 
            wait 20
           }
       }
    return

Okay, Lets start at the beginning and work our way to the End. Starting By cutting out your excess. Instead of Setting the Blackrock and then trying to drag it, just drag it the First time you find it.


Code: [Select]
Sub Clearblackrock
finditem UVF_EWF_FWF_GWF C_ , #backpackid
    for #findindex 1 #findcnt
        {
        event property #findid
        if Blackrock in #property
       {
           exevent Drag #findid ; No need for Findstack when it doesn't stack. I think that will actually cause crashes.
           exevent Dropc %TrashBarrel 
           wait 20    ; Finds only Blackrock, not the Diamonds.
        }
        }
    return

a 100,000,000,000,000,000,000,000 more Reliable method would be to use #Findcol to distinguish between diamonds and Blackrock.

Pretty Sure Diamonds have #Findcol = 0

so you would change it to something like


Code: [Select]
finditem UVF_EWF_FWF_GWF C_ , #backpackid
    for #findindex 1 #findcnt
        {
        if #Findcol <> 0
       {
           exevent Drag #findid ; No need for Findstack when it doesn't stack. I think that will actually cause crashes.
           exevent Dropc %TrashBarrel 
           wait 20    ; Finds only Blackrock, not the Diamonds.
        }
        }

Remember, the simple way is usually the best way.
Title: Re: Exent property issue
Post by: The Ghost on August 15, 2013, 07:09:07 PM
Thx.  trying the mod right now.
Title: Re: Exent property issue
Post by: Endless Night on August 16, 2013, 07:02:15 AM
The reason you original code was not working is that you loop through all the blackrock types 1 at a time and if it says blackrock you set the var %blackrock to its value.  Then you loop again and find the item held in blackrock and dump it.

Now think about it  say i have 30 black rock and zero diamonds... in the first loop i set %blackrock to the first items id, then i reset it to the 2nd, then 3rd, 4th .. 5th.....etc to 30th.

So being as %blackrock only holds the last value set. The loop that follows even thow goes from 1-30 can only ever dump the last bit of blackrock and no others.

Title: Re: Exent property issue
Post by: The Ghost on August 16, 2013, 01:19:30 PM
manwinc  I have try  both sub and their are still drop some in my secure.  thx for cleaning up the sub  for me.

 
Title: Re: Exent property issue
Post by: manwinc on August 16, 2013, 05:05:37 PM
No problem!

If you ever have a question like that just post it up. We will try and help you sort things out. More than 1 way to skin a cat :)