Recent Posts

Pages: [1] 2 3 ... 10
1
Scripting Chat / Re: Multiple For loops
« Last post by Hitechs on November 27, 2021, 05:02:09 PM »
ah, nice nice , and an excellent explanation

thank you
2
Scripting Chat / Re: Multiple For loops
« Last post by Gaderian on November 27, 2021, 04:42:53 PM »
To have 2 nested finditem based loops you have to keep track of your own version of #findindex and #findcnt.
There can be in issue if during the loop an item in the container (the ground can be a 'container' - so maybe it is better to think of it as "search confinement") disappears (is moved out of the 'container').

So it is definitely possible. I only do this when needed, not because it is so much slower (modern CPU and Easyuo 1.5 void the old thinking that 'finditem' is slow).
If you doubt the correctness of my comment on finditem isn't as slow as it is advertised, try it out for yourself. I did a test at a populated bank where I searched among 100 items in game in .005 seconds (5 ms).

Code: easyuo
  1. finditem %items g_ , %distance
  2. if #findcnt > 0
  3.    {
  4.    set %ItemsCount #findcnt ; keep the value for the %items #findcnt value
  5.    for %ItemsIndex 1 %ItemsCount
  6.       {
  7.       finditem %items %ItemsIndex g_ , %distance ; This has 4 parameters!
  8.       if #findcnt = 0
  9.          break ; this means an item was moved while we are processing the whole routine after the outer finditem above!
  10.       if #findtype = %doDad
  11.          {
  12.          finditem %stuff c_ , #backpackid
  13.          if #findcnt > 0
  14.             {
  15.             for #findindex 1 #findcnt
  16.                {
  17.                exevent drag #findid
  18.                exevent dropc %secureBox
  19.                wait 15
  20.                }
  21.             }
  22.          }
  23.       if #findtype = %thingaMajig
  24.          {
  25.          exevent drag #findid
  26.          exevent dropc #backpackid
  27.          wait 15
  28.          }
  29.       }
  30.    }
  31.  

What has been added above:
1) check #findcnt > 0 after the finditem before doing the for loop, because if #findcnt is 0, then you do a loop when you have no data from values 1 counting down to 0.
2) keep track of the outer loop #FINDCNT
3) use your own variable - like how we would use #findindex...
4) reissue a finditem in the loop where we give 4 parameters which includes the index of the loop we want.

If you have moved out of the area an item in the ground search (or someone else has) then the logic breaks down. I wouldn't do this kind of logic for general population items in my script. Snicker7 did this in the original BodFiller script and that and a conversation with another scripter is how I learned about it. It is the way to keep track of more than 1 finditem in a loop.

There is a way where you could save all the data from the outer finditem loop and then try to process it all again in a second pass. That would allow you to skip over items that have been moved on you. This is only a valid issue if you have a list of 20 things you initially found and an earlier one in the list is moved (not by you) so that the list index changes. The above logic takes care of any future found items in the loop iteration being moved, because it bails if it gets to the end of the list too early.

3
Scripting Chat / Multiple For loops
« Last post by Hitechs on November 27, 2021, 04:07:54 PM »

Was just wondering how you pros deal with for loop inside a for loop that runs off #findindex.
I have been just changing my logic so its not needed, and was wondering if that is my only options
so finditem creates findindex for first loop
but then inside that you need a 2nd findindex for 2nd for loop

Not possible? bad code? dont do that?

Example:

Code: [Select]
finditem %items g_ , %distance
for #findindex 1 #findcnt
     {
      if #findtype = %doDad
          {
            finditem %stuff c_ , #backpackid
            for #findindex 1 #findcnt
                     {
                       exevent drag #findid
                       exevent dropc %secureBox
                       wait 15
                     }
           }
      if #findtype = %thingaMajig
          {
            exevent drag #findid
            exevent dropc #backpackid
            wait 15
           }
     }
4
Character skill advancement / Re: Gaderian's Remove Trap trainer
« Last post by wi on November 17, 2021, 08:44:41 AM »
Works Great!

Thank you!
and once again, A big Thanks to everyone that shares their work here with us/me (70% plus...of my skills would still be at zero if it wasn't for all of you) so thank you!

Remove trap...(started yesterday)
paid training 28.? to 75 unbelievably fast!!!
switched over and got stuck at 98.3...finish box manually, restarted script and was at 100 within an hour...

Started yesterday and 100.0 this morning....I'd say it works very well  8)


5
Scripting Chat / Re: Looking for a healing partner script, any suggestions?
« Last post by dirtmcgirt on November 14, 2021, 05:56:07 PM »
Any updates to this?  I am needing the same thing to keep an artic ogre lord alive, just need a simple script that gives you the option to cast heal, instead of using bandaids. 
6
Crafting / Re: Penny's Bodswapper
« Last post by TrailMyx on November 08, 2021, 09:07:42 PM »
Those ginormously long IF statements are like fingernails on the chalk board.  :)

Code: easyuo
  1.   set %vender_gumps |134_168|142_240|116_150|214_204|139_168|183_168|214_168|170_168|214_186|171_150|171_168|183_204|234_204|116_132|
  2.  
  3.   WAIT_FOR_VENDOR_GUMP:
  4.   if #CONTNAME = normal_gump && ( | , #CONTSIZE , | in %vender_gumps )
  5.   {
  6.     return
  7.   }
  8.  
7
Crafting / Re: Penny's Bodswapper
« Last post by Ahzmandius on November 07, 2021, 06:58:10 PM »
Just started playing with this one, seems the contsize is not correct on some of them. Rather than track down whats what i just added a check in the sub. The one for blacksmith is

Code: [Select]
  WAIT_FOR_VENDOR_GUMP:
  if #CONTNAME = normal_gump && ( #CONTSIZE = 134_168 )
  + || ( #CONTSIZE = 142_240 ) || ( #CONTSIZE = 116_150 )
  + || ( #CONTSIZE = 214_204 ) || ( #CONTSIZE = 139_168 )
  + || ( #CONTSIZE = 183_168 ) || ( #CONTSIZE = 214_168 )
  + || ( #CONTSIZE = 170_168 ) || ( #CONTSIZE = 214_186 )
  + || ( #CONTSIZE = 171_150 ) || ( #CONTSIZE = 171_168 )
  + || ( #CONTSIZE = 183_204 ) || ( #CONTSIZE = 234_204 )
  + || ( #CONTSIZE = 116_132 ) <-- Added the size of blacksmith context menu, i assume the rest need to be checked.
  {
    return
  }
  if %vendorGumpCount >= 50
8
Endless Nights' Script Library / Re: ENs - Enemy Faction Health Bar Puller (Super Beta)
« Last post by Crisis on November 04, 2021, 03:17:06 AM »
I couldnt download this script

When I join a new forum, I always go to the rules first http://www.scriptuo.com/index.php?board=55.0 and the new members section 2nd http://www.scriptuo.com/index.php?board=20.0

If you read the stickies, you will see how to download scripts and become a part of the community. I challenge you to not only be able to download scripts but become a contributor rather than a leach.
9
Endless Nights' Script Library / Re: ENs - Enemy Faction Health Bar Puller (Super Beta)
« Last post by nacalol on November 03, 2021, 10:45:05 PM »
I couldnt download this script
10
Resource Farming / Re: Snow's Spined Leather Farmer
« Last post by Crisis on October 23, 2021, 09:47:50 PM »
You may want to try making a "good introduction" in the introduction section to get that pesky "restricted" tag removed so you can download scripts.
Pages: [1] 2 3 ... 10