Author Topic: Fish Cut Up Sub ( Please Critique)  (Read 3407 times)

0 Members and 1 Guest are viewing this topic.

Offline UltimaTopic starter

  • Insane Scripter
  • *
  • Posts: 1580
  • Activity:
    0%
  • Reputation Power: 26
  • Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.
  • Gender: Male
  • Respect: +160
  • Referrals: 4
    • View Profile
Fish Cut Up Sub ( Please Critique)
« on: October 08, 2011, 12:12:16 PM »
0
This is the code I incorporated into the FaFer to cut up the fish. It's working 90% of the time but it hangs every once in a while for some reason. I could have make a mistake with one of the FISH IDs or it could be the 200 ms Ping that is creating hiccups.  Sometimes I get the message "Use this on corpse to carve away meat and hide".

I'm happy with it but it's not 100%. It could have to do with where I placed it in the script...

I pieced it together looking at some of C2's code. Anything stand out at first glance?

Code: [Select]

finditem %knife C_ , #backpackid
    set #lobjectid #findid
    event macro 17
    target
    finditem %fish C_ , #backpackid
    set #ltargetid #findid
    set #ltargetkind 1
    event macro 22
    wait 8

Offline rana70

  • Elite
  • *
  • *
  • Posts: 294
  • Activity:
    0%
  • Reputation Power: 5
  • rana70 has no influence.
  • Gender: Male
  • Respect: +37
  • Referrals: 2
    • View Profile
    • MyScripts
Re: Fish Cut Up Sub ( Please Critique)
« Reply #1 on: October 08, 2011, 12:21:49 PM »
0
Hi,

I would add a few waits to make sure you will not end up with hicups,
from what I know about my own scripts the event command can
be very tricky without any delay !



Code: [Select]
Set %DelayEvent 20     ; Waittime for Event Macro Function
Set %DelayDrop 15      ; Waittime after Object Movement

finditem %knife C_ , #backpackid
    set #lobjectid #findid
    event macro 17
    Wait %DelayEvent
    target
    finditem %fish C_ , #backpackid
    set #ltargetid #findid
    set #ltargetkind 1
    event macro 22
    Wait %DelayDrop
« Last Edit: October 08, 2011, 12:25:02 PM by rana70 »

Offline UltimaTopic starter

  • Insane Scripter
  • *
  • Posts: 1580
  • Activity:
    0%
  • Reputation Power: 26
  • Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.
  • Gender: Male
  • Respect: +160
  • Referrals: 4
    • View Profile
Re: Fish Cut Up Sub ( Please Critique)
« Reply #2 on: October 08, 2011, 01:10:16 PM »
0
Thanks Rana70!

I'll edit the sub and add the event delays and see if it fixes the hiccup.  :D 

Offline UltimaTopic starter

  • Insane Scripter
  • *
  • Posts: 1580
  • Activity:
    0%
  • Reputation Power: 26
  • Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.
  • Gender: Male
  • Respect: +160
  • Referrals: 4
    • View Profile
Re: Fish Cut Up Sub ( Please Critique)
« Reply #3 on: October 09, 2011, 10:36:24 AM »
0
Added the Delay but that wasn't the problem.

I included the ID for Cut of Meat (VRD) in the Fish% that's why I was getting the message "Use this on corpse to carve away meat and hide". I really should have caught that before posting this however I'm happy I didn't because I learned something (how to incorporate wait times another way).

Thanks again Rana70! 8)

Offline camotbik

  • Sr. Member
  • *
  • Posts: 349
  • Activity:
    0%
  • Reputation Power: 3
  • camotbik has no influence.
  • Gender: Male
  • Hello! I'm a UO addict.
  • Respect: +38
  • Referrals: 0
    • View Profile
Re: Fish Cut Up Sub ( Please Critique)
« Reply #4 on: October 09, 2011, 02:12:31 PM »
0
This is the code I incorporated into the FaFer to cut up the fish. It's working 90% of the time but it hangs every once in a while for some reason. I could have make a mistake with one of the FISH IDs or it could be the 200 ms Ping that is creating hiccups.  Sometimes I get the message "Use this on corpse to carve away meat and hide".

I'm happy with it but it's not 100%. It could have to do with where I placed it in the script...

I pieced it together looking at some of C2's code. Anything stand out at first glance?

Code: [Select]

finditem %knife C_ , #backpackid
    set #lobjectid #findid
    event macro 17
    target
    finditem %fish C_ , #backpackid
    set #ltargetid #findid
    set #ltargetkind 1
    event macro 22
    wait 8

Well here we see the most common mistake. There are missing brackets on check if found.
Code: [Select]
finditem %something C_ %somewhere
if #findcnt > 0
{
  do whatever you need to do if found
}
else
{
  do whatever you need to do if not found
}

At the moment, even if the item is not found, you execute following code
Code: [Select]
   set #lobjectid #findid
    event macro 17
    target
    finditem %fish C_ , #backpackid
    set #ltargetid #findid
    set #ltargetkind 1
    event macro 22
    wait 8

So I would do it like this
Code: [Select]
finditem %knife C_ , #backpackid
if #findcnt > 0
{
  set #lobjectid #findid
  finditem %fish C_ , #backpackid    ; search for fish in backpack
  while #findcnt > 0 ; WHILE There is fish in the backpack, peform everything inside the brackets
  {
    event macro 17
    target
    set #ltargetid #findid
    set #ltargetkind 1
    event macro 22
    wait 8
    finditem %fish C_ , #backpackid  ; search for more fish in your backpack.
  }
}
else
{
  display knife not found
  halt
}
« Last Edit: October 09, 2011, 02:23:59 PM by camotbik »
What you witness -- is whatver..
uogamers hybrid.

Offline UltimaTopic starter

  • Insane Scripter
  • *
  • Posts: 1580
  • Activity:
    0%
  • Reputation Power: 26
  • Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.Ultima is on the verge of being accepted.
  • Gender: Male
  • Respect: +160
  • Referrals: 4
    • View Profile
Re: Fish Cut Up Sub ( Please Critique)
« Reply #5 on: October 09, 2011, 03:16:21 PM »
0
Thanks feedback Cambotik.

Script is still messing up afterall and it may have to do with not having a #findcnt> 0.

Interesting on the brackets...

I'll test this evening.

Tags: