Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - VicVega

Pages: 1 2 [3] 4 5
31
Script Debug / Fishing 4x4 Version 0.1 for Public testing
« on: May 13, 2009, 06:56:54 AM »
Fishing 4x4


The script works fine but I wanna post it here for a while before posting it on the Submit Your Script section, in case anyone has any suggestions about the code and how to improve it.

Purpose

  • Fishes in a harbor or a boat till you are overloaded

Current features

  • If you are in a harbor near a vendor, sells the steaks using Razor Sells Agent (you have to set the Razor Agent to do this).
  • If you are in a boat, moves the boat 12 tiles back or forward each time the fish it's depleted on the 4x4 zone around.
  • Cuts the fish with a dagger.
  • Drops boots on the ground.
  • Drops special fishes on the ground
  • Saves the fishing data in a file called fishing4x4Data.txt

Version History

new in 0.1  (13/5/09)

  • Published the first script's version.

Posible Future Features

  • Add support for Runebooks in order to drop money and white pearls in the Bank

Notes

  • How fishing4x4Data.txt looks like, in case you activate this option:

Quote
Time: 145210
Time fishing: 436 s 7 min
Total time fishing: 2705 s 45 min
Total Steaks: 860
Steaks Gained This Loop: 132
Total Steaks Gained: 860
Steaks Per Hour: 1144
...


  • Explanation how the 4x4 fishing works extracted from here. Warning: This only works with RunUO or OSI shards, not with Sphere ones.

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!

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.

Instructions

  • You need wearing a pole in the paperdoll, you also need a dagger in the backpack.
  • %sellFishsteaks - set #true for sell the fish steaks or #false, it's #false by default, you need to add fishSteaks at the Razor's Sell Agent.
  • %saveData - set #true for save data in fishing4x4Data.txt or #false, it's #true by default.
  • %boatFishing - set #true for fishing from a boat or #false, it's #false by default.

Code: [Select]
;=================================================================
; Script Name: Fishing 4x4
; Author: VicVega
; Version: 0.1
; Shard OSI / FS: UO Legends
; Revision Date: 13/5/2009
; Purpose: Fish in a port or a boat till you are overloaded
; Globals: None
;=================================================================
; Instructions:
; You need wearing a pole in the paperdoll, you also need a dagger
; in the backpack.
; %sellFishsteaks - set #true for sell the fish steaks or #false
;                   it's #false by default, you need to add fishSteaks
;                   at the Razor's Sell Agent
; %saveData - set #true for save data in fishing4x4Data.txt or #false
;             it's #true by default
; %boatFishing - set #true for fishing from a boat or #false
;                it's #false by default
;************************ Setup **********************************
gosub setup
;*********************** Main Loop *******************************
repeat
  gosub fishing
  gosub saveData
  gosub moveBoat
  gosub dropBoots
  gosub dropSpecialFishes
until #CharGhost = YES
halt
;************************* Subs **********************************
sub setup
  set %sellFishSteaks #false
  set %saveData #true
  set %boatFishing #false
  set %poleType KDF
  set %daggerType WSF
  set %maxTimeOutScan 15
  set %maxweight 570
  set %totalTimeFishing 0
  set %fishSteaksType IND
  set %forward #true
  finditem %poleType C_ , #charID
  set %poleID #findID
  finditem %daggerType C_ , #backpackID
  set %daggerID #findID
  gosub saveStartingData
return

sub saveData
  if %saveData
  {
    set %loopTime #scnt - %startingLoopTime
    set %totalTimeFishing %totalTimeFishing + %loopTime
    set %loopTimeMinutes %loopTime / 60
    set %totalTimeFishingMinutes %totalTimeFishing / 60
    finditem %fishSteaksType C_ , #backpackID
    set %nSteaks #findStack
    set %nSteaksLoop %nSteaks - %nSteaksStartingLoop
    set %totalSteaks %nSteaks
    set %nSteaks %nSteaks - %nStartingSteaks
    set %steaksPerHour ( %nSteaks * 3600 ) / %totalTimeFishing
    execute SaveTextToFile.Vbs #false #false #curPath fishing4x4Data.txt
    + Time: #time $
    + Time fishing: %loopTime s %loopTimeMinutes min $
    + Total time fishing: %totalTimeFishing s %totalTimeFishingMinutes min $
    + Total Steaks: %totalSteaks $
    + Steaks Gained This Loop: %nSteaksLoop $
    + Total Steaks Gained: %nSteaks $
    + Steaks Per Hour: %steaksPerHour $
  }
return

sub saveStartingData
  if %saveData
  {
    finditem %fishSteaksType C_ , #backpackID
    set %nStartingSteaks #findStack
    set %startingTime #time
    execute SaveTextToFile.Vbs #false #false #curPath fishing4x4Data.txt
    + Starting time: %startingTime $
    + Starting steaks: %nStartingSteaks
  }
return

sub fishing
  gosub startingLoopData
  for %i 1 4
  {
    gosub sellFishSteaks
    gosub fishingSpot
    gosub tileName %1 %2
    event sysmessage %1 %2
    while #result = #true
    {
      gosub usePole
      gosub scan
    }
    gosub cutFish
  }
return

sub moveBoat
  if %boat
  {
    if %forward
    {
      for %k 0 3
      {
        msg forward one $
        wait 2s
        set %forward #false
      }
    }
    else
    {
      for %m 0 11
      {
        msg backwards one $
        wait 2s
        set %forward #true
      }
    }
  }
return

sub startingLoopData
  if %saveData
  {
    finditem %fishSteaksType C_ , #backpackID
    set %nSteaksStartingLoop #findStack
    set %startingLoopTime #scnt
  }
return

sub fishingSpot
  if %i = 1
    gosub setTargets 4 4
  if %i = 2
    gosub setTargets 4 -4
  if %i = 3
    gosub setTargets -4 4
  if %i = 4
    gosub setTargets -4 -4
return

sub setTargets
  set #lTargetKind 2
  set #lTargetX #charPosX + %1
  set #lTargetY #charPosY + %2
return

sub scan
  set %timeout #scnt + %maxTimeOutScan
  set %jrnl #jindex
  scanjournal %jrnl
 
  while #scnt < %timeout
  {
    if %jrnl < #jindex
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
    }
    set %spotWithFish fail_to_catch in #journal || pull_out in #journal &&
    set %spotWithoutFish don't_seem_to_be_biting in #journal
    if %spotWithFish
      return #true
    if %spotWithoutFish
      return #false
  }
return

sub UsePole
  set #lTargetZ #tileZ
  set #lObjectID %poleID
  event macro 17
  target
  event macro 22
return

sub tileName
  set %fishingPosX #charPosX + %1
  set %fishingPosY #charPosY + %2
  tile init
  tile cnt %fishingPosX %fishingPosY
  for %j 1 #tilecnt
  {
    tile get %fishingPosX %fishingPosY %j
    set %canFish water in #tileName || jungle in #tileName
    if %canFish
      return #true
  }
return

sub dropSpecialFishes
  set %fishType YDF
  finditem %fishType C_ , #backpackID
  while #findKind <> -1
  {
    exevent drag #findID #findStack
    wait 1s
    exevent dropg #charPosX #charPosY
    wait 1s
    finditem %fishType C_ , #backpackID
  }
return

sub cutFish
  set %fishType FQD_DQD_GQD_EQD
  set #lTargetKind 1
  set #lObjectID %daggerID
  finditem %fishType C_ , #backpackID
  while #findKind <> -1
  {
    set #lTargetID #findID
    event macro 17
    target
    event macro 22
    wait 1s
    finditem %fishType C_ , #backpackID
  }
return

sub dropBoots
  set %bootsType TVI_ZVI_ZVI_PVI_NVI
  finditem %bootsType C_ , #backpackID
  while #findKind <> -1
  {
    exevent drag #findID #findStack
    wait 1s
    exevent dropg #charPosX #charPosY
    wait 1s
    finditem %bootsType C_ , #backpackID
  }
return

sub sellFishSteaks
  set %shouldSellFishSteaks %sellFishSteaks && #weight > #maxWeight
  if %shouldSellFishSteaks = #true
  {
    finditem %fishSteaksType C_ , #backpackID
    if #findKind <> -1
      msg vendor sell $
    wait 1s
    if %saveData
      gosub saveStartingData
  }
  else
  {
    if #weight > %maxWeight
      halt
  }
return

32
Bug discussion / Re: Script UO crashing
« on: May 13, 2009, 05:05:58 AM »
Found it!

The Hydra IRC client was the problem, it seems to be incompatible with ScriptUO.

33
Bug discussion / Re: Script UO crashing
« on: May 11, 2009, 01:18:11 PM »
I can't think of nothing that has changed apart from desinstalling UO, installing it again and updating it to use it in a new shard.  :-\

Also I reinstalled Razor, installed HydraIRC (an IRC client) and AMSN.  I don't think I have installed any other program from when it worked to when it stopped working.

May be I installed framework 3.5, I don't remember if I had it installed before.
 

34
Bug discussion / Re: Script UO crashing
« on: May 11, 2009, 01:07:33 PM »
I have tried from the desktop and from C:\

35
Bug discussion / Re: Script UO crashing
« on: May 11, 2009, 12:03:15 PM »
Does this problem happen when you just try to load SUO?  Or are you doing something to induce this issue?

When just trying to load it (double click on executable).

Quote
From what liitle i can see from the debugging info. I have derived that he is running SUO with the flux capacitor in by-pass.  Just placing this in its standard spot should resolve the issue.

How do I do that?

36
Bug discussion / Re: Script UO crashing
« on: May 11, 2009, 11:32:10 AM »
Which version is this? ( Oh wait, 224)  Did you download the earilier version and try?

Also, try running it with UO closed and see if the problem goes away.  This issue might have to do with my own client interface getting in the way of the initialization process.

I have tried v195 and has the same problem.

Also I have tried to execute it with UO and easy UO closed, same problem.

Only thing I can think has changed from when it worked fine was the shard's change, this one it's RunUO fully updated, don't know if it has something to do with this problem.

37
Script Debug / Re: Fishing sub
« on: May 10, 2009, 01:52:05 AM »
So that you know you haven't been wasting your time on this, I have changed shard (this time RunUO) and now the Script 4x4 Fishing I made it seems to work like charm. After I test it a little longer I will post it in the forum.

38
Bug discussion / Script UO crashing
« on: May 09, 2009, 03:40:19 AM »
I've had been using ScriptUO without any problem till now, I tried to download it again but I got the same error message when I execute it:

Quote
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at ᝈ.ᢒᙊ(Byte[] ᙂ)
   at ᝈ.ᝮ(Process p)
   at ᝈ.គ()
   at ᝈ..ctor(RichTextBox debug)
   at ᙘ.ᙢ()
   at ᡪᙂ.ᙢ()
   at ᥾.ᣬᙊ(Object ᙂ, EventArgs ᙄ)
   at System.Windows.Forms.Timer.OnTick(EventArgs e)
   at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
ScriptUO
    Assembly Version: 1.0.3325.605
    Win32 Version: 1.0.3325.605
    CodeBase: file:///C:/ScriptUO_v224.exe
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
zip
    Assembly Version: 0.0.0.0
    Win32 Version: 1.0.3325.605
    CodeBase: file:///C:/ScriptUO_v224.exe
----------------------------------------
ScriptUO
    Assembly Version: 1.0.3325.605
    Win32 Version: 1.0.3325.605
    CodeBase: file:///C:/ScriptUO_v224.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Microsoft.VisualBasic
    Assembly Version: 8.0.0.0
    Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
ICSharpCode.TextEditor
    Assembly Version: 0.0.0.0
    Win32 Version: 1.0.3325.605
    CodeBase: file:///C:/ScriptUO_v224.exe
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

39
General UO Chat / Re: Easy UO and afk macroing friendly shard
« on: May 08, 2009, 10:39:04 AM »
I'm gonna try UO Legends, it seems a good one.

40
General UO Chat / Re: Easy UO and afk macroing friendly shard
« on: May 07, 2009, 06:27:12 AM »
So, what about recommend me a good one with skillcap?

41
General UO Chat / Re: Easy UO and afk macroing friendly shard
« on: April 27, 2009, 12:31:59 PM »
For example, in the shard I'm playing now, the initial skillcaps it's 350, so you can only master 3 skills to GM. If you want to master other skills to 100, you have to create another character in the account, wich I find very annoying.

That's what I meant, I hope I explained more clearly now, my english it's not good enough.

If you know a good shard that allows Easy UO and afk macroing tell me anyway even if it has skillcaps .

42
Script Debug / Re: Fishing sub
« on: April 20, 2009, 10:43:24 AM »
It might be a Sphere thing I suppose, I'm sure it works fine in OSI and RunUO. I prefer to move on to another scripts, and thanks for the help, I learned things trying to solve this.

This is the script I'm currently using to fish, in case anyone wants to see how it works:

Code: [Select]
;=================================================================
; Script Name: Fishing Script
; Author: VicVega
; Version: 0.1
; Shard OSI / FS: FS EpsilonUO
; Revision Date: 15/4/2009
; Purpose: Fish, sells the fish, and fish again
; Globals: None
;=================================================================

;************************ Setup **********************************
gosub setup
;*********************** Main Loop *******************************
repeat
  if #contkind = ORLB
    call %pathReconnect
  else
  {
    set %initialRoundTime #scnt
    set %initialRoundGold #gold + %goldCorrection
    set %initialRoundSkill #skill
    call eatFood.txt
    gosub fishingPos
    call hidingSub.txt
    gosub fishing
    gosub dropFish
    gosub sell
    gosub saveData
    call saveMoney.txt
  }
 
  while #CharGhost = YES
        wait 0
until #CharGhost = YES

;************************* Subs **********************************
sub setup
set %fishType GQD_TLW_VLW_DMW_LGW_NGW_GMW_FQD_OGW_WLW_
+YLW_DQD_SLW_ULW_FMW_EMW_XLW_RLW_EQD_NMW
set %poleType NSL_KSL
set %pathReconnect reconnect.txt
set %maxTimeOutScan 15
set %maxTilesToWalk 23
set %maxweight #maxweight - 15
set %vendorPosX 1372
set %vendorPosY 3894
set %vendorID PTGB
set %charPosX 1372
set %charPosY 3895
set %goldCorrection 131072
set %fishingLocation = 1
set %path c:\euo\ ; Easy UO scripts path
chooseSkill Fish
gosub dataSetup
return

sub badSpots
if ( ( %x = -6 && -6 >= %y <= -3 ) || ( %x = -6 && 3 >= %y <= 6 ) || ( %x = -5 && -6 >= %y <= -5 )
   + || ( %x = -5 && 6 >= %y <= 5 ) || ( %x = -4 && %y = -6 ) || ( %x = -4 && %y = 6 )
   + || ( %x = -3 && %y = -6 ) || ( %x = -3 && %y = 6 ) || ( %x = -1 && %y = -6 )
   + || ( %x = -1 && 1 >= %y <= -1 ) || ( %x = -1 && %y = 6 ) || ( %x = 0 && %y = -6 )
   + || ( %x = 0 && 1 >= %y <= -1 ) || ( %x = 0 && %y = 6 ) || ( %x = 1 && %y = -6 )
   + || ( %x = 1 && 1 >= %y <= -1 ) || ( %x = 1 && %y = 6 )
   + || ( %x = 3 && %y = -6 ) || ( %x = 3 && %y = 6 ) || ( %x = 4 && %y = -6 ) || ( %x = 4 && %y = 6 )
   + || ( %x = 5 && -6 >= %y <= -5 ) || ( %x = 5 && 6 >= %y <= 5 )
   + || ( %x = 6 && -6 >= %y <= -3 ) || ( %x = 6 && 3 >= %y <= 6 ) )
     return #false
return #true

sub fishing
  for %x -6 6
  {
    for %y -6 6
    {
      if #contkind = ORLB
        call %pathReconnect
      if #weight > %maxweight
         return
      gosub badSpots
      while #result = #true
      {
       gosub usePole
       gosub scan
      }
      wait 5
      deletejournal
      gosub pickupFish
    }
  }
return

sub sell
move %vendorPosX %vendorPosY 0 60s
finditem %vendorID
if #findkind <> -1
  move #findx #findy 1 60s
call sellSub.txt
return

sub fishingPos
set %random #random % %maxTilesToWalk
set %newPosY %charPosY + %random
move %charPosX %newPosY  0 60s
return

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 )
    return #true

  if ( no_hay_peces in #journal || mejor_pesca in #journal )
    return #false
}

if #targCurs = 1
  set #targCurs 0
}
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

sub dataSetup
set %totalGoldGain 0
set %totalTime 0
set %initialGold #gold + %goldCorrection
set %initialTime #time
set %initialSkill #skill

execute SaveTextToFile.Vbs #false #false %path fishingData.txt
+ Time: %initialTime $
+ Initial Gold: %Initialgold $ Initial skill: #skill $ $
return

sub saveData
set %gold #gold + %goldCorrection
set %goldGain #gold - %initialRoundGold + %goldCorrection
set %totalGoldGain %totalGoldGain + %goldGain
set %time #scnt - %initialRoundTime
set %totalTime %totalTime + %time
set %timeMinutes %time / 60
set %totalTimeMinutes %totalTime / 60
set %skill #skill - %initialSkill

execute SaveTextToFile.Vbs #false #false %path fishingData.txt
+ Time: #time $ Time fishing: %time s %timeMinutes min $
+ Total time fishing: %totalTime s %totalTimeMinutes min
+ $ Gold: %gold $ Gold Gain: %goldGain $
+ Total Gold Gain: %totalGoldGain $
+ Skill: #skill $ Skill Gain: %skill $ $
return

43
Script Debug / Re: Fishing sub
« on: April 20, 2009, 10:25:28 AM »
I give up. I made a script that does exactly like in the pic, but it happened what I thought It would happen, instead of what I like it would happen ...

So, fish in -4 4 spot, after fishing a couple times it's deplenish, then fish on 4 4, and same with -4 -4 and 4 -4.

After fishing in those four spots (like 2 - 3 min, and some fishes ), there is no more fish and if it respawns every hour, what the hell do I do meanwhile?

It's not the complete code because it's too long.

Code: [Select]
sub fishing
  for %i 1 4
  {
      if #contkind = ORLB
        call %pathReconnect
      if #weight > %maxweight
         return
       gosub fishingSpot %i
       event sysmessage %1 %2
       gosub usePole
       gosub scan

      wait 5
      deletejournal
      gosub pickupFish
  }
return

sub fishingSpot

  if %1 = 1
    gosub setTargets 4 4

  if %1 = 2
     gosub setTargets 4 -4

  if %1 = 3
    gosub setTargets -4 4

  if %1 = 4
    gosub setTargets -4 -4
return

sub setTargets
    set #lTargetKind 2
    set #LTARGETX #CHARPOSX + %1
    set #LTARGETY #CHARPOSY + %2
return

So I don't think I can improve my fish rate this way.  :'(

My fishdata.txt (generated from my fish script, without improvements but works fine)

Quote
Time: 13:06:09
Initial Gold: 109309
Initial skill: 1122

Time: 13:19:12
Time fishing: 781 s 13 min
Total time fishing: 781 s 13 min
Gold: 110415
Gold Gain: 1106
Total Gold Gain: 1106
Skill: 1122
Skill Gain: 0


Time: 13:33:36
Time fishing: 852 s 14 min
Total time fishing: 1633 s 27 min
Gold: 111392
Gold Gain: 957
Total Gold Gain: 2063
Skill: 1122
Skill Gain: 0

...

44
Script Debug / Re: Fishing sub
« on: April 20, 2009, 09:35:38 AM »
I really don't get the logic about it but I think I can make it work now.



I hope it's more or less like I think.  :-\

45
Script Debug / Re: Fishing sub
« on: April 20, 2009, 08:14:03 AM »
Quote
but if you stand anywhere in an 8x8 resource block and fish 4 spaces in any direction

4 spaces in any direction?, wasn't the point to try to only fish in one spot for each 4x4 set?, ergo, the 4 spaces shouldn't be random spots in any direction ...

So for fishing:

(-4,4) and then (-4,3) = wrong because there is no more fish after fishing in (-4,4), both spots are in the same 4x4 and 8x8 set

(-4,4) and then (4,4) = right because it's a different 4x4 set

Is this correct?

Pages: 1 2 [3] 4 5