Author Topic: Need a little help on this. I am a rookie!  (Read 9480 times)

0 Members and 1 Guest are viewing this topic.

Offline CushTopic starter

  • Sr. Member
  • *
  • Posts: 281
  • Activity:
    0%
  • Reputation Power: 4
  • Cush has no influence.
  • Respect: +79
  • Referrals: 0
    • View Profile
Need a little help on this. I am a rookie!
« on: December 31, 2020, 03:24:07 PM »
+1
Hi,

I could use a little help with this little script. I use it once every few years to reload my fountains to make enhanced aids. I would like to just cut these from a secure in the house instead of the bank. I have not figured out how to update it.

I can do minor things but some pointers on this would be much appreciated. :-)

Thanks! 

There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
Bolt to Cloth cutter.txt

Offline Gaderian

  • Elite
  • *
  • *
  • Posts: 490
  • Activity:
    0%
  • Reputation Power: 10
  • Gaderian barely matters.Gaderian barely matters.
  • Respect: +283
  • Referrals: 3
    • View Profile
Re: Need a little help on this. I am a rookie!
« Reply #1 on: December 31, 2020, 04:16:49 PM »
+1
Here is how you can change the start of the script. It prompts you for your secure. You target your secure... then you don't have to modify the script each time you use it to lookup and hard code your container to use.

This shows how to change the beginning of the script - you should be able to line it up to see what you are replacing from the version you attached.

Code: [Select]
;==================================
; Script Name: bolts -> cloth
; Purpose: transfers bolts of cloth to nomral cloth
;==================================

display ok Target your resource container:
set #targcurs 1
repeat
 wait 1
until #targcurs = 0
set %secure #ltargetid
;set %secure HEROXRD ; set here the id of your resource container

Not sure where you use this script, but OSI shards would be very unhappy with the short waits around "exevent dropc". If it has issues locking up, you may need to give yourself 1 second (wait 20) between "exevent dropc" actions. For some freeshards those short waits could be fine.

Gaderian
« Last Edit: December 31, 2020, 04:19:32 PM by Gaderian »
"Go ahead ask me: 'Should I use hard waits or timers?'"
You say:"Should I"
Gaderian:"Timers!"
You Say:"use hard waits or timers?"

The serious side of timer use is illustrated here: http://www.scriptuo.com/index.php?topic=12094.msg101926#msg101926

However, every time I go back and look at this [AutoLooter] script, I realize I had wrote it in my zen state of EUO scripting - so it makes my brain hurt.

Offline CushTopic starter

  • Sr. Member
  • *
  • Posts: 281
  • Activity:
    0%
  • Reputation Power: 4
  • Cush has no influence.
  • Respect: +79
  • Referrals: 0
    • View Profile
Re: Need a little help on this. I am a rookie!
« Reply #2 on: December 31, 2020, 05:17:15 PM »
+1
Thank you. Yes this is a OSI location.

After a little fixing of other things I got these up and running lol in my own messed up way. Anything I can do to stream lines these little guys.

Doesn't seem to stop when out of the items.


Code: [Select]
;==================================
; Script Name: bolts -> cloth
; Purpose: transfers bolts of cloth to nomral cloth
;==================================
display ok Target your resource container:
set #targcurs 1
repeat
 wait 1
until #targcurs = 0
set %secure #ltargetid
;set %secure HEROXRD ; set here the id of your resource container

set %scissors KAG
set %cloth CUI
Set %bolt ZZF
Set %Bandage ZLF

finditem %scissors C_ , #backpackid
if #findkind = -1
halt
set %scissors #findid

finditem %secure
while #findkind = -1
{
      event macro 1 0 bank
      wait 20
      finditem %secure
}
if #contid <> %secure
{
   set #lobjectid %secure
   event macro 17 0
   while #contid <> %secure
   {
         wait 1
   }
   wait 20
}
finditem %bolt C_ , %secure
while #findkind <> -1
{
      set %dragamount #maxweight - #weight
      set %dragamount %dragamount / 5
      set %dragamount %dragamount - 1
      if #findstack < %dragamount
         set %dragamount #findstack
      if %dragamount <> 0
      {
         exevent drag #findid %dragamount
         wait 3
         exevent dropc #backpackid
         wait 7
      }
      finditem %bolt C_ , #backpackid
      if #findkind <> -1
      {
            for #findindex 1 #findcnt
            {
             set #lobjectid %scissors
             event macro 17 0
             target 20
             set #ltargetid #findid
             set #ltargetkind 1
             event macro 22 0
            }
      }
      finditem %bolt C_ , #backpackid
      if #findkind <> -1
      {
            for #findindex 1 #findcnt
            {
             set #lobjectid %scissors
             event macro 17 0
             target 20
             set #ltargetid #findid
             set #ltargetkind 1
             event macro 22 0
            }
      }
      gosub dragcloth
      finditem %Bolt C_ , %secure
}
gosub dragcloth
halt


sub dragcloth
      finditem %Cloth C_ , #backpackid
      while #findkind <> -1
      {
            exevent drag #findid #findstack
            wait 3
            exevent dropc %secure
            wait 7
            finditem %Cloth C_ , #backpackid
      }
return

Then the next step


Code: [Select]
;==================================
; Script Name: Cloth -> Bandages
; Purpose: transfers Cloth to normal Bandages
;==================================
display ok Target your resource container:
set #targcurs 1
repeat
 wait 1
until #targcurs = 0
set %secure #ltargetid
;set %secure HEROXRD ; set here the id of your resource container

set %scissors KAG
set %cloth CUI
Set %bolt ZZF
Set %Bandage ZLF

finditem %scissors C_ , #backpackid
if #findkind = -1
halt
set %scissors #findid

finditem %secure
while #findkind = -1
{
      event macro 1 0 bank
      wait 20
      finditem %secure
}
if #contid <> %secure
{
   set #lobjectid %secure
   event macro 17 0
   while #contid <> %secure
   {
         wait 1
   }
   wait 20
}
finditem %cloth C_ , %secure
while #findkind <> -1
{
      set %dragamount #maxweight - #weight
      set %dragamount %dragamount / 5
      set %dragamount %dragamount - 1
      if #findstack < %dragamount
         set %dragamount #findstack
      if %dragamount <> 0
      {
         exevent drag #findid %dragamount
         wait 3
         exevent dropc #backpackid
         wait 7
      }
      finditem %cloth C_ , #backpackid
      if #findkind <> -1
      {
            for #findindex 1 #findcnt
            {
             set #lobjectid %scissors
             event macro 17 0
             target 20
             set #ltargetid #findid
             set #ltargetkind 1
             event macro 22 0
            }
      }
      finditem %cloth C_ , #backpackid
      if #findkind <> -1
      {
            for #findindex 1 #findcnt
            {
             set #lobjectid %scissors
             event macro 17 0
             target 20
             set #ltargetid #findid
             set #ltargetkind 1
             event macro 22 0
            }
      }
      gosub dragcleanbandage
      finditem %cloth C_ , %secure
}
gosub dragcleanbandage
halt


sub dragcleanbandage
      finditem %Bandage C_ , #backpackid
      while #findkind <> -1
      {
            exevent drag #findid #findstack
            wait 3
            exevent dropc %secure
            wait 7
            finditem %Bandage C_ , #backpackid
      }
return

« Last Edit: December 31, 2020, 05:19:02 PM by Cush »

Offline Gaderian

  • Elite
  • *
  • *
  • Posts: 490
  • Activity:
    0%
  • Reputation Power: 10
  • Gaderian barely matters.Gaderian barely matters.
  • Respect: +283
  • Referrals: 3
    • View Profile
Re: Need a little help on this. I am a rookie!
« Reply #3 on: December 31, 2020, 09:44:03 PM »
+1
I notice 2 possibilities:
1) maybe you are human and end up with a negative quantity calcualtion on bolts
2) The more likely, your wait timers around drag/dropc is too quick and you are left with 'ghost image' items that are found and produce false positives.

In general, #maxweight is correct for elf and gargoyle races, but you get "strong back" as a human - allowing you to carry an extra 60 stones. It is possible for your #weight to be more than #maxweight if you are human. Then %dragamount can go negative, but you neither check for that situation nor adjust the #maxweight part of the calculation to reflect human.

Code: [Select]
finditem %bolt C_ , %secure
while #findkind <> -1
{
      set %dragamount #maxweight - #weight
      set %dragamount %dragamount / 5
      set %dragamount %dragamount - 1
      if #findstack < %dragamount
         set %dragamount #findstack
      if %dragamount <> 0
      {
         exevent drag #findid %dragamount
         wait 3
         exevent dropc #backpackid
         wait 7
      }

Dealing with 'ghost image' items. First, slow down your drag/drop operations. You need at least 1 second (wait 20 or other method) between 'exevent dropc' actions. Sometimes you can get an item stuck on your cursor as if you are dragging it, so include a "just in case" exevent dropc before the exevent drag. Also on each round open your backpack using event macro 8 7 in the cycle.

You could streamline it in steps:
find bolts in secure
drag some bolts to backpack
cut the bolts to cloth
find cloth in backpack
cut cloth to bandages
move bandages (which sometimes drop to the ground because of a legacy weight issue when bandages weighed 1 stone each (now weight .1 stone each)) to the secure.

You would save time skipping the extra drag/drop steps of cloth by just cutting to bandages.

I have attached my take on doing this a while ago. I do not have code to look for bandages that dropped to the ground. That would need to add another routine to the logic after dragging bandages from your backpack to the secure... find/drag from ground to secure. It would look something like this:

Code: easyuo
  1.  finditem %bandages G_2
  2.  if #findcnt > 0
  3.   {
  4.   for #findindex 1 #findcnt
  5.    {
  6.    exevent drag #findid #findstack
  7.    wait 10
  8.    exevent dropc %secureid
  9.    wait 10
  10.    }
  11.   }

I like your weight calculation for bolts to cloth. It isn't necessary for the cloth to bandages since that is a 1 to 1 in both count and weight (ignoring the age old bug where it drops bandages to the ground in some instances) - which would be a 10:1 ratio rather than a 5:1 ratio if you decided to try to keep that. It would be faster to pull the maximum bolts you can carry, cut to cloth, cut to bandages and move from the ground to secure. Leave the check in for moving bandages from backpack to secure to complete a partial stack of bolts/cloth/bandages at the end.

My routine hard coded drag quantity rather than calculating against my remaining weight. I would just test how many I could hold without it dropping to the ground and set that value in the script hard coded. You will see I had it set to 1 bolt and 1 cloth at a time - which is too slow, but safe and eventually may finish before server restart. ;)

If you married your weight calculation (adjusting for human +60 stones) with my version and added the test for bandages that may drop to the ground, it should chug along nicely.

Gaderian




There are 1 attachment(s) in this post. You must register and post an acceptable introduction to download
bandages_from_cloth.txt
« Last Edit: December 31, 2020, 10:06:22 PM by Gaderian »
"Go ahead ask me: 'Should I use hard waits or timers?'"
You say:"Should I"
Gaderian:"Timers!"
You Say:"use hard waits or timers?"

The serious side of timer use is illustrated here: http://www.scriptuo.com/index.php?topic=12094.msg101926#msg101926

However, every time I go back and look at this [AutoLooter] script, I realize I had wrote it in my zen state of EUO scripting - so it makes my brain hurt.

Offline The Ghost

  • Elite
  • *
  • *
  • Posts: 1917
  • Activity:
    0%
  • Reputation Power: 25
  • The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.The Ghost is on the verge of being accepted.
  • Respect: +556
  • Referrals: 0
    • View Profile
Re: Need a little help on this. I am a rookie!
« Reply #4 on: January 01, 2021, 05:07:36 PM »
+1
You can look here   TG_Factory make aids as well.
http://www.scriptuo.com/index.php?topic=13169.0

Offline CushTopic starter

  • Sr. Member
  • *
  • Posts: 281
  • Activity:
    0%
  • Reputation Power: 4
  • Cush has no influence.
  • Respect: +79
  • Referrals: 0
    • View Profile
Re: Need a little help on this. I am a rookie!
« Reply #5 on: January 02, 2021, 08:27:59 AM »
+1
Hey that is the one I helped you test out! Glad to see aids are on there now. :-)

Offline CushTopic starter

  • Sr. Member
  • *
  • Posts: 281
  • Activity:
    0%
  • Reputation Power: 4
  • Cush has no influence.
  • Respect: +79
  • Referrals: 0
    • View Profile
Re: Need a little help on this. I am a rookie!
« Reply #6 on: January 03, 2021, 12:16:01 PM »
+1
OK I have not had a chance to get all your suggestions added lol ran out of bolts so building those now for more testing. This is where I am at so far. Had the just in case backpack drop in and there but took it out so I could trouble shoot some wait times. Will add that and the part for the floor items next.

Code: [Select]
;==================================
; Script Name: Bolt's -> Bandages
; Purpose: transfers Bolts to normal Bandages
;==================================


display ok Target your resource container:
set #targcurs 1
repeat
 wait 1
until #targcurs = 0
set %secure #ltargetid
;set %secure HEROXRD ; set here the id of your resource container

;Items Vars
set %scissors KAG
set %cloth CUI
Set %bolt ZZF
Set %Bandage ZLF

; Wait Timer feel free to adjust if you have timing related Error Msg.
Set %DelayEvent 20     ; Waittime for Event Macro Function
Set %DelayDrag 15      ; Waittime before Object Movement
Set %DelayDrop 10      ; Waittime after Object Movement
Set %Delay 5           ; Waittime

finditem %scissors C_ , #backpackid
if #findkind = -1
halt
set %scissors #findid

finditem %secure
while #findkind = -1
{
      event macro 1 0 bank
      wait %DelayEvent
      finditem %secure
}
if #contid <> %secure
{
   set #lobjectid %secure
   event macro 17 0
   while #contid <> %secure
   {
         wait %Delay
   }
   wait %DelayEvent
}
finditem %bolt C_ , %secure
while #findkind <> -1
{
      set %dragamount #maxweight - #weight
      set %dragamount %dragamount / 5
      set %dragamount %dragamount - 1
      if #findstack < %dragamount
         set %dragamount #findstack
      if %dragamount <> 0
      {
         exevent drag #findid %dragamount
         wait %DelayDrag
         exevent dropc #backpackid
         wait %DelayDrop
      }
      finditem %bolt C_ , #backpackid
      if #findkind <> -1
      {
            for #findindex 1 #findcnt
            {
             set #lobjectid %scissors
             event macro 17 0
             target 20
             set #ltargetid #findid
             set #ltargetkind 1
             event macro 22 0
             wait %DelayEvent
            }
      }
      finditem %cloth C_ , #backpackid
      if #findkind <> -1
      {
            for #findindex 1 #findcnt
            {
             set #lobjectid %scissors
             event macro 17 0
             target 20
             set #ltargetid #findid
             set #ltargetkind 1
             event macro 22 0
             wait %DelayEvent
            }
      }
      gosub dragcleanbandage
      finditem %cloth C_ , %secure
}
gosub dragcleanbandage
halt


sub dragcleanbandage
      finditem %Bandage C_ , #backpackid
      while #findkind <> -1
      {
            exevent drag #findid #findstack
            wait %DelayDrag
            exevent dropc %secure
            wait %DelayDrop
            finditem %Bandage C_ , #backpackid
      }
return


 


Offline CushTopic starter

  • Sr. Member
  • *
  • Posts: 281
  • Activity:
    0%
  • Reputation Power: 4
  • Cush has no influence.
  • Respect: +79
  • Referrals: 0
    • View Profile
Re: Need a little help on this. I am a rookie!
« Reply #7 on: January 04, 2021, 02:10:22 PM »
+1
Hi @Gaderain,

I was able to fool around with this a bit more.

Interesting development is now when the cloth is cut the bandages dropped to the ground. They are the same weight as each other so you would think they should replace each other. I added your part to pick the bandages off the ground and that is working fine. Seems like the script could go a little faster as well.

I am not clear on exactly where to add the open backpack line you mentioned above.

Code: [Select]
;==================================
; Script Name: Bolts -> Bandages
; Purpose: transfers Bolts to normal Bandages
;==================================


display ok Target your resource container:
set #targcurs 1
repeat
 wait 1
until #targcurs = 0
set %secure #ltargetid
;set %secure HEROXRD ; set here the id of your resource container

;Items Vars
set %scissors KAG
set %cloth CUI
Set %bolt ZZF
Set %Bandage ZLF

; Wait Timer feel free to adjust if you have timing related Error Msg.
Set %DelayEvent 20     ; Waittime for Event Macro Function
Set %DelayDrag 15      ; Waittime before Object Movement
Set %DelayDrop 10      ; Waittime after Object Movement
Set %Delay 5           ; Waittime

finditem %scissors C_ , #backpackid
if #findkind = -1
halt
set %scissors #findid

finditem %secure
while #findkind = -1
{
      event macro 1 0 bank
      wait %DelayEvent
      finditem %secure
}
if #contid <> %secure
{
   set #lobjectid %secure
   event macro 17 0
   while #contid <> %secure
   {
         wait %Delay
   }
   wait %DelayEvent
}
finditem %bolt C_ , %secure
while #findkind <> -1
{
      set %dragamount #maxweight - #weight
      set %dragamount %dragamount / 5
      set %dragamount %dragamount - 1
      if #findstack < %dragamount
         set %dragamount #findstack
      if %dragamount <> 0
      {
         exevent drag #findid %dragamount
         wait %DelayDrag
         exevent dropc #backpackid
         wait %DelayDrop
      }
      finditem %bolt C_ , #backpackid
      if #findkind <> -1
      {
            for #findindex 1 #findcnt
            {
             set #lobjectid %scissors
             event macro 17 0
             target 20
             set #ltargetid #findid
             set #ltargetkind 1
             event macro 22 0
             wait %DelayEvent
            }
      }
      finditem %cloth C_ , #backpackid
      if #findkind <> -1
      {
            for #findindex 1 #findcnt
            {
             set #lobjectid %scissors
             event macro 17 0
             target 20
             set #ltargetid #findid
             set #ltargetkind 1
             event macro 22 0
             wait %DelayEvent
            }
      }
     
      finditem %bandage G_2
      if #findcnt > 0
      {
           for #findindex 1 #findcnt
           {
           exevent drag #findid #findstack
           wait %DelayEvent
           exevent dropc %secure
           wait %DelayEvent
           }
      }
      gosub dragcleanbandage
      finditem %Bolt C_ , %secure

}
return

sub dragcleanbandage
      finditem %Bandage C_ , #backpackid
      while #findkind <> -1
      {
            exevent drag #findid #findstack
            wait %DelayDrag
            exevent dropc %secure
            wait %DelayDrop
            finditem %Bandage C_ , #backpackid
      }
return

Offline Gaderian

  • Elite
  • *
  • *
  • Posts: 490
  • Activity:
    0%
  • Reputation Power: 10
  • Gaderian barely matters.Gaderian barely matters.
  • Respect: +283
  • Referrals: 3
    • View Profile
Re: Need a little help on this. I am a rookie!
« Reply #8 on: January 04, 2021, 02:19:40 PM »
+1
Hi Cush,
I attached a script that would pretty much do what you wanted... other than the weight calculation for how much stuff to pull. No one has downloaded it - so you didn't even look at it.

I addressed the issue where bandages drop to the ground.

Gaderian
"Go ahead ask me: 'Should I use hard waits or timers?'"
You say:"Should I"
Gaderian:"Timers!"
You Say:"use hard waits or timers?"

The serious side of timer use is illustrated here: http://www.scriptuo.com/index.php?topic=12094.msg101926#msg101926

However, every time I go back and look at this [AutoLooter] script, I realize I had wrote it in my zen state of EUO scripting - so it makes my brain hurt.

Offline CushTopic starter

  • Sr. Member
  • *
  • Posts: 281
  • Activity:
    0%
  • Reputation Power: 4
  • Cush has no influence.
  • Respect: +79
  • Referrals: 0
    • View Profile
Re: Need a little help on this. I am a rookie!
« Reply #9 on: January 04, 2021, 02:28:50 PM »
+1
Hey Gaderian,

Thanks! I totally missed the attachment I was focused on understanding the snippet you posted :-) Thank you I will check it out!

Cush

Tags: