Author Topic: Fishing sub  (Read 7600 times)

0 Members and 1 Guest are viewing this topic.

Offline VicVegaTopic starter

  • Jr. Member
  • **
  • Posts: 71
  • Activity:
    0%
  • Reputation Power: 0
  • VicVega has no influence.
  • Respect: +8
  • Referrals: 0
    • View Profile
Fishing sub
« on: April 19, 2009, 02:09:21 AM »
0
I was wondering if there is a better way to handle the spots where I can't fish in the fishing sub (too close spots or too far ones) in order to avoid them.

Right now the badspots are handle with "sub badspots" called from the fishing sub.

Also I would like to know if it's better to call the "badspots" passing parameters like this:

Code: [Select]
gosub badSpots %x %y
And then use %1 and %2 in the sub, or if it's the same and it does not improve stability.

Code: [Select]
set %poleType NSL_KSL
set %pathReconnect reconnect.txt
set %maxTimeOutScan 20

sub fishing
  for %x -5 5
  {
    for %y -5 5
    {
      if #contkind = ORLB
          call %pathReconnect
      if #weight < %maxweight
      {
        event sysmessage %x %y
        gosub badSpots
        if #result = good
        {
           gosub usePole
           gosub scan
           deletejournal
           gosub pickupFish
        }

      }
    }
  }
return

sub pickUpFish
    finditem %fishType G_2
    if #findkind <> -1
        call pickupFish.txt
return

sub badSpots
  if %x = -5 && %y = -5 ; too far
     return bad
  if %x = -5 && %y = 5 ; too far
     return bad
     
  if %x = -1 && %y = 0 ; too close
     return bad
  if %x = -1 && %y = -1 ; too close
     return bad
  if %x = -1 && %y = 1 ; too close
     return bad
     
  if %x = 0 && %y = -1 ; too close
     return bad
  if %x = 0 && %y = 0 ; too close
     return bad
  if %x = 0 && %y = 1 ; too close
     return bad
     
  if %x = 1 && %y = 0 ; too close
     return bad
  if %x = 1 && %y = -1 ; too close
     return bad
  if %x = 1 && %y = 1 ; too close
     return bad


  if %x = 5 && %y = -4 ; too far
     return bad
  if %x = 5 && %y = -5 ; too far
     return bad
return good

sub scan
  set %timeout #scnt + %maxTimeOutScan
  set %jrnl #jindex
  scanjournal %jrnl

  while #scnt < %timeout
  {
    if %jrnl < #jindex
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
    }
   
    if ( mala_suerte in #journal || Pescaste in #journal )
    {
      set %timeout #scnt + %maxTimeOutScan
      gosub usePole
    }
   
    if ( no_hay_peces in #journal || demasiado_lejos in #journal
        + || no_puedes_pescar in #journal || mejor_pesca in #journal )
    {
      wait 5
      return
    }
  }

sub UsePole
set #lTargetKind 2
set #lTargetX #CHARPOSX + %x
set #lTargetY #CHARPOSY + %y
finditem %poleType
set #LOBJECTID #FINDID
event macro 17
target 3s
event macro 22
return

sub pickUpFish
    finditem %fishType G_2
    if #findkind <> -1
        call pickupFish.txt
return
« Last Edit: April 19, 2009, 03:04:03 AM by VicVega »
To learn, read.
To know, write.
To master, teach.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Fishing sub
« Reply #1 on: April 19, 2009, 09:33:17 AM »
0
Will you be fishing from a boat?  If so you can really simplify you code by only fishing once in each 8x8 resource block.  You can look at my fisherman here, but the gist is that you only need to fish N, S, E, W and 4 spaces from your character.  This covers the entire 8x8 resource allocation of UO.

Also, I think you saw how useful the journal can be for fishing, so you can use a journal scanner to tell when you have depleted your area or are fishing an an invalid area.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline VicVegaTopic starter

  • Jr. Member
  • **
  • Posts: 71
  • Activity:
    0%
  • Reputation Power: 0
  • VicVega has no influence.
  • Respect: +8
  • Referrals: 0
    • View Profile
Re: Fishing sub
« Reply #2 on: April 19, 2009, 10:46:16 AM »
0
Where is that fisherman script?, I didn't find it

What do you mean only fishing once in each 8x8 block?

Right now my character fish in every spot that can be fished, if fish or fail to fish, tries again in the same spot, and when is depleted, it goes to the next one.

Why I don't think fishing only once per spot a good idea?

Because I would end my area of fishing very quickly without fishing all the fish around me.

I fish in ports over water, each time the character goes to fish, walks a random amount of steps in order to change the fishing zone.
To learn, read.
To know, write.
To master, teach.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Fishing sub
« Reply #3 on: April 19, 2009, 11:34:01 AM »
0
8x8 resource blocks are how UO handles resources that respawn.  Resources don't restock in a tile/tile basis.  So when you just fish in 4x4 blocks around you, you are depleting all possible resources by only fishing in 4 spots!

Actually it works out pretty close actually.  If you fish one 4x4 square to being empty, then the other 3, you are really close to having the resources replenished.  Trust me, I have a couple fishing scripts out there and have been doing the fishing thing for just about the beginning of my scripting life, so I've tweaked it a bunch.  It's all come to successful fishing attempts/hr so if you over-fish an area, you'll waste a lot of time in that same area knowing you won't fish anything up.

So I guess I didn't explain correctly.  When I meant fish "once", I meant fish in one area of a 4x4 block and exhaust the fish.  That effectively fishes out the whole area and then you just shift N,S,E,W to the next 4x4 block.  You can effectively fish in one place constantly and never run out of places to fish and you'll only fail to fish 4 times.  Try it, it works... ;)

Here's a link to my fish hunter:

http://www.scriptuo.com/index.php?topic=133.0

The other one is for the Elite members and that one handles collection, archery and slayer books, ancient AOS farming, etc.

Oh, and there are places in UO where you can use this 4x4 method off land so you don't even need a boat!
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline VicVegaTopic starter

  • Jr. Member
  • **
  • Posts: 71
  • Activity:
    0%
  • Reputation Power: 0
  • VicVega has no influence.
  • Respect: +8
  • Referrals: 0
    • View Profile
Re: Fishing sub
« Reply #4 on: April 19, 2009, 11:54:52 AM »
0
I always thought that the minerals, fishes, etc, where respawned tile by tile

The shard I play it's sphere 0.56b, if that matters

Thanks for the explanation but I don't know if I understood you correctly.

You mean that if I do my bucles to only fish in a 4x4 squares, and then in the other oposite 4x4 square, they do not deplete so quickly?

So:
11112222
11112222
11112222
11112222
33334444
33334444
33334444
33334444

Fish first in zone 1, then zone 2, then zone 3, then zone 4 and then move?

Or like this:
11111111
11111111
11111111
11111111
22222222
22222222
22222222
22222222
« Last Edit: April 19, 2009, 12:01:14 PM by VicVega »
To learn, read.
To know, write.
To master, teach.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Fishing sub
« Reply #5 on: April 19, 2009, 12:19:54 PM »
0
Great example!

Your first graphic explains it best.  Picture yourself standing at the 4-corners of your example.  What I do is just fish zone 1, then 2, then 3 and finally 4.  By the time I've fished back to zone 1, the fish have nearly always replenished.

You may have to do some experimentation with Sphere.  I can't speak for that server since I've never played a shard based on it.  Only OSI and RunUO for me.  But my guess is that it'll be something similar.  Really it comes down to memory management and it's much more memory efficient to manage resources in 8x8 groups than it is to do it on a tile/tile basis.  (read: hella-smaller - 64x compression)
« Last Edit: April 19, 2009, 12:25:19 PM by TrailMyx »
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Fishing sub
« Reply #6 on: April 19, 2009, 12:51:53 PM »
0
Here's another look at what I do (using your example):

F111 222F
1111 2222
1111 2222
1111 2222
      C
3333 4444
3333 4444
3333 4444
F333 444F

If you fish out to the 4 corners labeled by "F", it really doesn't matter where you are at in the world coordinates because you should aways be fishing into 4 different resources 8x8 squares.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline VicVegaTopic starter

  • Jr. Member
  • **
  • Posts: 71
  • Activity:
    0%
  • Reputation Power: 0
  • VicVega has no influence.
  • Respect: +8
  • Referrals: 0
    • View Profile
Re: Fishing sub
« Reply #7 on: April 19, 2009, 12:56:29 PM »
0
I understand better now, so as I said, I fish over a port shape in a line form.

And each round the character goes fishing, I walk a random amount of steps from my initial fishing zone.

So, if for example I have 30 steps maximum to walk, I can make the first random amount of stepts between 0 and 8, and the next one between 8 and 16, and so on.

Would that improve the code and minimize the depleting zones?

Or I should better instead of fishing straight in line, fish something like this:

« Last Edit: April 19, 2009, 01:06:35 PM by VicVega »
To learn, read.
To know, write.
To master, teach.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Fishing sub
« Reply #8 on: April 19, 2009, 01:07:51 PM »
0
I guess the most efficient way of getting away with this is to figure out a way to not move at all.  I think that's why I first started using a ship instead of fishing from shore.  Instead of physically moving your character, I just sail forward 16 spaces and I'm in a completely new set of resource spots.  Finally I just don't really move the ship at all. 

Is your need to move at all just a matter of style, or is there some other reason for it?  I'm not sure if there's additional requirements on Sphere.  I just know that I've been able to minimize the need to move at all.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Fishing sub
« Reply #9 on: April 19, 2009, 01:09:45 PM »
0
Seeing from your picture, I'll bet you could get away with fishing and not moving at all.  Again, there's probably something different from Sphere.  But if you can get away with just fishing those 4 zones, then you only have 4 coordinates to set (you can even steal those from my fisher) and then a simple journal scanner.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline VicVegaTopic starter

  • Jr. Member
  • **
  • Posts: 71
  • Activity:
    0%
  • Reputation Power: 0
  • VicVega has no influence.
  • Respect: +8
  • Referrals: 0
    • View Profile
Re: Fishing sub
« Reply #10 on: April 19, 2009, 01:18:51 PM »
0
In the shard I play there is no ships, I have to fish like this.

I moved the character because I thought the respawn was tile by tile.

So, something like this then:



Or if I'm lucky, I can test first only the first zone, right?
« Last Edit: April 19, 2009, 01:20:47 PM by VicVega »
To learn, read.
To know, write.
To master, teach.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Fishing sub
« Reply #11 on: April 19, 2009, 01:35:17 PM »
0
NO SHIPS!?!?!?  Barf!

Anyhow... ;)

Ya, that might simply things.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline VicVegaTopic starter

  • Jr. Member
  • **
  • Posts: 71
  • Activity:
    0%
  • Reputation Power: 0
  • VicVega has no influence.
  • Respect: +8
  • Referrals: 0
    • View Profile
Re: Fishing sub
« Reply #12 on: April 19, 2009, 11:20:47 PM »
0
Some more aclarations that I still don't get:

Quote
F111 222F
1111 2222
1111 2222
1111 2222
      C
3333 4444
3333 4444
3333 4444
F333 444F

Do you mean that if the character stands at C, it will deplenish all the fish in the Zone 1 (4x4 tiles) only fishing in the (-4, 4) spot (marked with F) ?

It wouldn't be necessary to fish on the other "Zone 1" spots marked with 1? They would be empty once fished the (-4, 4 ) spot?

Quote
8x8 resource blocks are how UO handles resources that respawn.  Resources don't restock in a tile/tile basis.  So when you just fish in 4x4 blocks around you, you are depleting all possible resources by only fishing in 4 spots!

Also I don't understand this.

So a 8x8 zone has four 4x4 zones inside. If a 8x8 resource blocks is how UO handles the fish respawn and not 4x4 zones, then  if you deplenish only one of the 4x4 zones, it wouldn't be also deplenishing the rest of the 8x8 zone?

Quote
If you fish out to the 4 corners labeled by "F", it really doesn't matter where you are at in the world coordinates because you should aways be fishing into 4 different resources 8x8 squares.

Do you mean "you should aways be fishing into 4 different resources 4x4 squares", instead of "you should aways be fishing into 4 different resources 8x8 squares." ?

I ask the question because of this:

Quote
I guess the most efficient way of getting away with this is to figure out a way to not move at all.  I think that's why I first started using a ship instead of fishing from shore.  Instead of physically moving your character, I just sail forward 16 spaces and I'm in a completely new set of resource spots.  Finally I just don't really move the ship at all.

Is your need to move at all just a matter of style, or is there some other reason for it?  I'm not sure if there's additional requirements on Sphere.  I just know that I've been able to minimize the need to move at all.

Thanks for the help.
« Last Edit: April 20, 2009, 02:12:05 AM by VicVega »
To learn, read.
To know, write.
To master, teach.

Offline VicVegaTopic starter

  • Jr. Member
  • **
  • Posts: 71
  • Activity:
    0%
  • Reputation Power: 0
  • VicVega has no influence.
  • Respect: +8
  • Referrals: 0
    • View Profile
Re: Fishing sub
« Reply #13 on: April 20, 2009, 02:59:12 AM »
0
I talk about this with one of the shard's scripts and he told me this:

Quote
I don't know how it works in RunUO, but here if you fish in one spot, it will respawn in that spot in one hour, just that simple.
To learn, read.
To know, write.
To master, teach.

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13302
  • Activity:
    0.2%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: Fishing sub
« Reply #14 on: April 20, 2009, 06:33:06 AM »
0
It might be worth some experimentation for you.  I can only tell you how it works with OSI and RunUO.  I've heard that Sphere is pretty different for some implementations and this might be one of them.  1 hour spawn time alone doesn't sound right.  On OSI/RunUO it's around 10 minutes.

Oh, I definitely mean 4x4 when I'm talking about this method.  Yes, it's 8x8 when it comes to the resource distribution, but if you stand anywhere in an 8x8 resource block and fish 4 spaces in any direction, you'll reach the neighboring 8x8 resource blocks.  That's where the 4x4 method comes from that I'm talking about.

But again, this seems to be server distribution dependent.  It would be pretty easy to throw together a test script validate this.  From what it sounds like, I won't be running off to find a Sphere-based server any time soon for my fishing needs.  :)
Please read the ScriptUO site RULES
Come play RIFT with me!

Tags: