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
16
Script Debug / Problems with Skill Gaining calculator script
« on: May 26, 2009, 10:41:51 AM »
So this is a script I've made in order to know how much time left for reaching GM status and how much skill points per hour are gained.

The idea it's to execute it in other tab different from the main script.

But I don't know exactly why, after a while the UO ends crashing and I have to close it after a time using the script.

Hope someone finds wich could be the problem.

Code: [Select]
;=================================================================
; Script Name: Skill Gaining Calculator
; Author: VicVega
; Version: 0.1
; Shard OSI / FS: UO Legends
; Revision Date: 26/5/2009
; Purpose: Shows in the UO title bar the skill per hour points you are gaining
;          Also shows the time left to achieve GM level
; Globals: None
;=================================================================
; Instructions: Set the skill you want to check in %skill variable
;************************ Setup **********************************
gosub setup
;*********************** Main Loop *******************************
repeat
  set %skillGained #skill - %startingSkill
  set %timePassed #scnt - %startingTime
  set %skillPerHour ( 3600 * %skillGained ) / %timePassed
  gosub timeLeftToGM
  setuotitle S/H: %skillPerHour GM: %timeLeftToGM S: %skillGained T: %timePassed
  wait 10s
until #charGhost = yes
;************************* Subs **********************************
sub setup
    set %skill anim
    chooseskill %skill
    set %startingSkill #skill
    set %startingTime #scnt
return

sub timeLeftToGM
  if %skillGained > 0
  {
     set %timeLeftToGMSecs ( ( 1000 - #skill ) * %timePassed ) / %skillGained
     gosub ConvertTimeHourMinSec %timeLeftToGMSecs
     set %timeLeftToGM #strres
  }
return

; %1 = input - Time to convert
; #RESULT -  Time converted to H:MM:SS format
sub ConvertTimeHourMinSec
  namespace push
  namespace local ctime
  set !hourpart %1 / 3600
  set !secpart ( %1 % 3600 ) % 60
  set !minpart ( ( %1 % 3600 ) / 60 )

  if !hourpart >= 10
    set #STRRES !hourpart , :
  else
    set #STRRES 0 , !hourpart , :
  if !minpart < 10
    set #STRRES #STRRES , 0
  set #STRRES #STRRES , !minpart , :
  if !secpart < 10
    set #STRRES #STRRES , 0
  set #STRRES #STRRES , !secpart
  namespace pop
return

17
Script Debug / Re: Animal Taming 0.1 for Public Testing
« on: May 26, 2009, 06:27:52 AM »
New version, some fixes, improved stability and code readbility.

Version 0.3 published, fixed problem with RidgeBacks and now kills RidgeBack Paragons (wich are not tamable)

18
Script Debug / Animal Taming 0.1 for Public Testing
« on: May 25, 2009, 11:09:56 AM »
What this script does?

1. Scans the zone for tame animals acording to your skill at the moment.
2. Tames an animal, releases it and then kills it with your steed, till there is no more animals left on the zone.
3. If no more animals available on the zone, returns to the starting point.

Only tested with Great Harts at the moment, but it should work with all the other animals supported I hope.  

This informative table is extracted from the UDTaming script, only works with the animals listed here, but if you want to add animals types it's easy to do so:

Quote
; The following table was generated from data gathered off the UO Stratics
; taming page. Analysing their results produces a success rate calculation
; based upon the character's Animal Taming skill only. Modifying the Animal
; Lore did not produce any noticable changes in the success rates.
;
; The formula determined for calculating success rate is R = (S - B) * 2 where
; R is the success rate, S is the character's taming skill, and B is the
; minumum skill required to tame minus 0.1 (this is the base skill
; requirement). Using basic algebra and solving for S provides a formula that
; can can be used calculate the skill required to achieve a specific success
; rate (S = R / 2 + B). This formula is used in the table below to determine
; which creatures will provide the best chances to recieve a gain while
; taming.
; Column descriptions:
;
; ANIMAL    The name of the animal to tame
; REQ SKILL The minimum skill required to tame
; MIN GAIN  The skill level that has a 10% success rate
; MAX GAIN  The skill level that has an 90% success rate
; C/M       Monster (Yes/No)
; TYPE      EasyUO FindItem type for animal
;
;                      REQ    MIN    MAX
; ANIMAL             SKILL   GAIN   GAIN  C/M  TYPE
; Sheep               11.1     16     56   N   TF_PF
; Cow                 11.1     16     56   N   IG_NG
; Hind                23.1     28     68   N   TG
; Timber Wolf         23.1     28     68   N   PG
; Great Hart          59.1     64    104   N   AH
; Bull                71.1     76    116   N   YG_XG
; Ridgeback           83.1     88    128   N   BK

Code: [Select]
;=================================================================
; Script Name: Animal Taming
; Author: VicVega
; Version: 0.3
; Shard OSI / FS: UO Legends
; Revision Date: 26/5/2009
; Purpose: Trains Animal Taming to GM
; Globals: None
;=================================================================
; Instructions: You need to setup your steed ID in %steedID
;               variable on setup
;************************ Setup **********************************
gosub setup

repeat
  gosub chooseTamingAnimal
  gosub findClosestAnimal %tameable
  gosub tamingMonitor
until #charGhost = yes
halt
;************************* Subs **********************************
sub tamingMonitor
  if %findDist <> N/A
  {
    if %findtype in %tameable
      gosub Taming %findid
  }
  if %findDist = N/A
  {
    event sysmessage no more animals around
    event pathfind %charstartx %charstarty %charstartz
    wait 10s
  }
return

sub setup
  set %steedID OFWC
  set %charstartx #charposx
  set %charstarty #charposy
  set %charstartz #charposz
return

sub Taming
  set %oldTameFollowers #followers
  set %tameID %1
  gosub checkParagon %tameID
  finditem %tameID G_16
  while #findkind <> -1
  {
    set %tameid #findid
    if %tameid <> #ltargetid
      event exmsg %tameid 3 30 target!
    gosub TameAnimal
    if #followers > %oldTameFollowers
       gosub tamingRelease
    finditem %tameID G_16
  }
return

sub checkParagon
event property %1
if Paragon in #property
{
   event sysmessage killing paragon!
   gosub killPet
}
return

sub TameAnimal
  set #ltargetid %tameid
  set #ltargetkind 1
  while #findDist > 2
  {
    event pathfind #findX #findY #findZ
    wait 1s
    finditem %tameID G_16
  }

  event macro 13 35 ; animal taming
  target 3s
  event macro 22 0 ; last target

  gosub scan seems_to_accept anger_the_beast fail_to_tame
  + too_far clear_path too_many_followers can't_see_that
  + too_angry distracted someone_else tame_already
  + cannot_be_tamed can't_tame_that no_chance

  set %ignore someone_else in #result || tame_already in #result
  if %ignore = #true
    ignoreitem %tameID
 return

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

  while #scnt < %timeout
  {
    finditem %tameID G_16
    if #finddist > 2
      event pathfind #findX #findY #findZ
    if %jrnl < #jindex
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
    }

    for %journalCounter 1 %0
    {
      if % . %journalCounter in #journal
        return % . %journalCounter
    }
  }
return

sub TamingRelease
  msg all follow me $
  gosub releasePet
  gosub killPet
return

sub releasePet
  set %releaseGumpSize 270_120
  set %maxTimeOut 15
  set %timeOut #scnt + %maxTimeOut
  set %waitForGump #true
  
  exevent popup %tameID 10
  while %waitForGump = #true
  {
    wait 1s
    set %waitForGump #contSize <> %releaseGumpSize && #scnt < %timeOut
  }

  set %releaseGumpX #contposx + 35
  set %releaseGumpY #contposy + 90
  click %releaseGumpX  %releaseGumpY
  wait 15
return

sub killPet
  gosub dismount
  gosub atackTamedPet %tameID
  finditem %steedID
  while #findKind <> -1
  {
    gosub mount
    finditem %steedID
  }
return

sub dismount
  set #lObjectID #charID
  event macro 17
  wait 1s
return

sub atackTamedPet
  set %victimID %1
  set #lTargetKind 1
  SET #lTargetID %victimID
  event exmsg %tameid 3 30 kill this!
  gosub atack
  finditem %victimID
  set %maxTimeOut 10
  set %timeOut #scnt + %maxTimeOut
  while #findKind <> -1
  {
    wait 1s
    finditem %victimID
    event exmsg %tameid 3 30 kill this!
    gosub checkAtackTimeOut
  }
return

sub atack
  msg all kill $
  target 25s
  event macro 22 0
return

sub checkAtackTimeOut
    if #scnt > %timeOut
    {
          gosub atack
          set %timeOut #scnt + %maxTimeOut
    }
return

sub mount
  finditem %steedID
  set #lObjectID %steedID
  while #findDist > 1
  {
    msg all follow me $
    wait 1s
    finditem %steedID
  }
  event macro 17
  wait 1s
return

sub findClosestAnimal
  finditem %1 G_16
  set %findid #findid
  set %findtype #findtype
  set %finddist #findDist
  if #findcnt > 1
  {
    for #findIndex 1 #findcnt
    {
      if #findkind <> -1 && #findDist < %findDist
      {
        set %findid #findid
        set %findtype #findtype
        set %finddist #findDist
      }
    }
  }
return

sub chooseTamingAnimal
  chooseskill anim
  if #skill = #skillcap
  {
    display ok Taming skillcap reached
    halt
  }

  if #skill >= 300 && #skill < 450
    set %tameable TF_PF_IG_NG_TG
  if #skill >= 450 && #skill < 600
    set %tameable TG_PG
  if #skill >= 600 && #skill < 750
    set %tameable AH
  if #skill >= 750 && #skill < 900
    set %tameable YG_XG_AH
  if #skill >= 900 && #skill < 1200
    set %tameable BK
return

19
Script Debug / Bushido 0.1 for Public Testing
« on: May 21, 2009, 08:50:55 AM »
Code: [Select]
;=================================================================
; Script Name: Bushido
; Author: VicVega
; Version: 0.1
; Shard OSI / FS: UO Legends
; Revision Date: 20/5/2009
; Purpose: Trains Bushido to GM
; Globals: None
;=================================================================
; Instructions: You need to setup your fcr in %userFcr variable
;               It's 0 by default
;
;************************ Setup **********************************
gosub setup
;*********************** Main Loop *******************************
repeat
  gosub chooseBushidoSpell
  while #mana >= %minManaToCast
    gosub castBushidoSpell
  gosub meditate
  while #mana < #maxMana
    gosub checkMeditateStatus
until #charGhost = yes
return
;************************* Subs **********************************
sub setup
  set %userFcr 0
  chooseskill bush real
  set %startingskill #skill
  str len %startingskill
  str ins %startingskill #dot #strRes
  set %startingskill #strres
  set %successMessageTrance you_enter_a_meditative
  set %successMessagePeace you_are_at_peace
  set %failFocus cannot_Focus
  set %failWait you_must_wait
return

sub checkskill
  if #skill = #skillcap
     halt
  set %currentskill #skill
  str len %currentskill
  str ins %currentskill #dot #strRes
  set %currentskill #strres
  setuotitle SS %startingskill | CS %currentskill
return

sub castBushidoSpell
  event Macro 15 %spell
  target
  event Macro 23 0
  wait 2s
  gosub checkskill
return

sub meditate
  wait 1s
  event macro 13 46
  gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
  set %scanResult #result
return

sub checkMeditateStatus
if %scanResult = %failWait
{
  wait 1s
  event macro 13 46
  gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
  set %scanResult #result
}
if %scanResult = %failFocus
{
  wait 10s
  event macro 13 46
  gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
  set %scanResult #result
}
return

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

  while #scnt < %timeout
  {
    if %jrnl < #jindex
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
    }

    for %journalCounter 1 %0
    {
      if % . %journalCounter in #journal
        return % . %journalCounter
    }
 }
return

Sub chooseBushidoSpell
  set %skill #skill
  if %skill < 600 && %skill > 250
  {
    set %spell 146  ; Confidence
    set %minManaToCast 10
  }

  if %skill < 750 && %skill > 600
  {
    set %spell 148  ; Counter Atack
    set %minManaToCast 5
  }
  if %skill < 1050 && %skill > 750
  {
    set %spell 147  ; Evasion
    set %minManaToCast 10
  }
 
  if %skill < 1200 && %skill > 1050
  {
    set %spell 150  ; Momentum Strike
    set %minManaToCast 10
  }
return

20
Script Debug / Re: Spirit Speak 0.1 for Public Testing
« on: May 21, 2009, 12:17:42 AM »
He is a funny monster indeed.  :P

21
Script Debug / Resisting Spells 0.1 for Public Testing
« on: May 20, 2009, 10:46:08 AM »
Code: [Select]
;=================================================================
; Script Name: Resisting Spells
; Author: VicVega
; Version: 0.1
; Shard OSI / FS: UO Legends
; Revision Date: 20/5/2009
; Purpose: Trains Resisting Spells to GM
; Globals: None
;=================================================================
; Instructions: You need to setup your fcr in %userFcr variable
;               It's 0 by default
;
;************************ Setup **********************************
gosub setup
;*********************** Main Loop *******************************
repeat
  gosub checkSkill
  while #mana >= %minManaToCast
  gosub castClumsy
gosub meditate
while #mana < #maxMana
  gosub checkMeditateStatus
until #charGhost = yes
return

sub setup
  set %userFcr 0
  chooseskill resi real
  set %startingskill #skill
  str len %startingskill
  str ins %startingskill #dot #strRes
  set %startingskill #strres
  set %successMessageTrance you_enter_a_meditative
  set %successMessagePeace you_are_at_peace
  set %failFocus cannot_Focus
  set %failWait you_must_wait
  set %minManaToCast 3
return

sub checkSkill
  if #skill = #skillcap
     halt
  set %currentskill #skill
  str len %currentskill
  str ins %currentskill #dot #strRes
  set %currentskill #strres
  setuotitle SS %startingskill | CS %currentskill
  set %currentskill #skill
return

Sub CastClumsy
  if #targCurs = 1
  set #targCurs 0
  event macro 15 0 ; Cast Clumsy
  target
  event macro 23 ; Target Self
  wait 30
return

sub checkMeditateStatus
  if %scanResult = %failWait
  {
   wait 1s
   event macro 13 46
   gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
   set %scanResult #result
  }
  if %scanResult = %failFocus
  {
     wait 10s
     event macro 13 46
     gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
     set %scanResult #result
  }
return

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

  while #scnt < %timeout
  {
    if %jrnl < #jindex
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
    }

    for %journalCounter 1 %0
    {
     if % . %journalCounter in #journal
       return % . %journalCounter
    }
  }
return

sub setFcrDelay
  if %userFcr = 6
    set %fcrDelay 1
  if %userFcr = 5
    set %fcrDelay 2
  if %userFcr = 4
    set %fcrDelay 3
  if %userFcr = 3
    set %fcrDelay 5
  if %userFcr = 2
    set %fcrDelay 10
  if %userFcr = 1
    set %fcrDelay 15
  if %userFcr = 0
    set %fcrDelay 20
return

22
Script Debug / Re: Spirit Speak 0.1 for Public Testing
« on: May 20, 2009, 07:24:07 AM »
Added some minor changes, if in a few days nobody find problems I will add it to the "submit your script section".

23
Script Debug / Re: Chivalry 0.1 for Public Testing
« on: May 20, 2009, 07:01:13 AM »
Added support for FCR delay and other minor changes, I'll left pass a few more days in case someone notice something wrong and then I will post it on the "Submit your script" section.

24
Script Debug / Chivalry 0.1 for Public Testing
« on: May 18, 2009, 08:00:29 AM »
Code: [Select]
;=================================================================
; Script Name: Chivalry
; Author: VicVega
; Version: 0.2
; Shard OSI / FS: UO Legends
; Revision Date: 20/5/2009
; Purpose: Trains Chivalry to GM
; Globals: None
;=================================================================
; Instructions: You need to setup your fcr in %userFcr variable
;               It's 0 by default
;
;************************ Setup **********************************
gosub setup
;*********************** Main Loop *******************************
repeat
  gosub checkskill
  gosub chooseChivSpell
  while #mana >= %minManaToCast
    gosub castChivalrySpell
  gosub meditate
  while #mana < #maxMana
    gosub checkMeditateStatus
until #charGhost = yes
return
;************************* Subs **********************************
sub setup
  set %userFcr 0
  chooseskill chiv real
  set %startingskill #skill
  str len %startingskill
  str ins %startingskill #dot #strRes
  set %startingskill #strres
  set %successMessageTrance you_enter_a_meditative
  set %successMessagePeace you_are_at_peace
  set %failFocus cannot_Focus
  set %failWait you_must_wait
return

sub checkskill
  if #skill = #skillcap
     halt
  set %currentskill #skill
  str len %currentskill
  str ins %currentskill #dot #strRes
  set %currentskill #strres
  setuotitle SS %startingskill | CS %currentskill
  set %currentskill #skill
return

sub castChivalrySpell
  event Macro 15 %spell
  target
  event Macro 23 0
  wait %fcrDelay
return

sub meditate
  wait 1s
  event macro 13 46
  gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
  set %scanResult #result
return

sub checkMeditateStatus
if %scanResult = %failWait
{
  wait 1s
  event macro 13 46
  gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
  set %scanResult #result
}
if %scanResult = %failFocus
{
  wait 10s
  event macro 13 46
  gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
  set %scanResult #result
}
return

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

  while #scnt < %timeout
  {
    if %jrnl < #jindex
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
    }

    for %journalCounter 1 %0
    {
      if % . %journalCounter in #journal
        return % . %journalCounter
    }
 }
return

Sub chooseChivSpell
  chooseskill chiv
  set %skill #skill real
  set %minManaToCast 10
  if %skill < 1000 && %skill > 849
  {
    set %spell 208  ; Noble Sacrafice
    set %minManaToCast 20
  }

  if %skill < 850 && %skill > 749
    set %spell 207  ; Holy Light

  if %skill < 750 && %skill > 649
  {
    set %spell 206  ; Enemy of One
    set %minManaToCast 20
  }

  if %skill < 650 && %skill > 549
    set %spell 204  ; Dispel Evil

  if %skill < 550 && %skill > 449
  {
    set %spell 205  ; Divine Fury
    set %minManaToCast 15
  }

  if %skill < 450 && %skill > 349
    set %spell 203  ; Consecrate Weapon

  if %skill < 350
  {
    set %spell 209  ; Remove Curse
    set %minManaToCast 20
  }
return

sub setFcrDelay
  if %userFcr = 6
    set %fcrDelay 1
  if %userFcr = 5
    set %fcrDelay 2
  if %userFcr = 4
    set %fcrDelay 3
  if %userFcr = 3
    set %fcrDelay 5
  if %userFcr = 2
    set %fcrDelay 10
  if %userFcr = 1
    set %fcrDelay 15
  if %userFcr = 0
    set %fcrDelay 20
return

25
Script Debug / Spirit Speak 0.1 for Public Testing
« on: May 18, 2009, 07:59:16 AM »
Code: [Select]
=================================================================
; Script Name: Spirit Speak
; Author: VicVega
; Version: 0.2
; Shard OSI / FS: UO Legends
; Revision Date: 20/5/2009
; Purpose: Trains Spirit Speak to GM
; Globals: None
;=================================================================
; Instructions: Just press play
;************************ Setup **********************************
gosub setup
;*********************** Main Loop *******************************
repeat
  gosub checkskill
  while #mana >= %minManaToCast
    gosub useSpiritSpeakSkill
  gosub meditate
  while #mana < #maxMana
    gosub checkMeditateStatus
until #charGhost = yes
;************************* Subs **********************************
sub setup
  chooseskill spir real
  set %startingskill #skill
  str len %startingskill
  str ins %startingskill #dot #strRes
  set %startingskill #strres
  set %minManaToCast 10
  set %successMessage You_channel_your_own_spiritual
  set %successMessageTrance you_enter_a_meditative
  set %successMessagePeace you_are_at_peace
  set %failMessage You_fail_your_attempt
  set %failWait you_must_wait
  set %failFocus cannot_Focus
return

sub checkskill
  if #skill = #skillcap
    halt
  set %currentskill #skill
  str len %currentskill
  str ins %currentskill #dot #strRes
  set %currentskill #strres
  setuotitle SS %startingskill | CS %currentskill
return

sub useSpiritSpeakSkill
  event macro 13 32
  gosub scan %successMessage %failMessage %failWait
  wait 6s
  gosub checkskill
return

sub meditate
  event macro 13 46
  gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
  set %scanResult #result
return

sub checkMeditateStatus
  if %scanResult = %failWait
  {
    wait 1s
    event macro 13 46
    gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
    set %scanResult #result
  }
  if %scanResult = %failFocus
  {
    wait 10s
    event macro 13 46
    gosub scan %failFocus %failWait %successMessageTrance %successMessagePeace
    set %scanResult #result
  }
return

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

  while #scnt < %timeout
  {
    if %jrnl < #jindex
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
    }
    for %journalCounter 1 %0
    {
      if % . %journalCounter in #journal
        return % . %journalCounter
    }
  }
return

26
Script Debug / Scan Journal Sub 0.1 for Public Testing
« on: May 18, 2009, 07:58:43 AM »
Code: [Select]
;=================================================================
; Script Name: Scan Journal Sub
; Author: VicVega
; Version: 0.1
; Shard OSI / FS: UO Legends
; Revision Date: 18/5/2009
; Purpose: Looks for a text in the journal and returns it
; Globals: None
;=================================================================
; Instructions:
; You call the sub with the messages you want to look for.
; If it finds one of the messages you are looking for, the sub returns
; and #result variable saves the message found
; Tries to find the messages during the time marked by %maxTimeOutScan
; %maxTimeOutScan value it's 15 seconds by default
; Call example: gosub scan message1 message2 message3 ...
;************************* Sub **********************************
sub scan
  set %maxTimeOutScan 15
  set %timeout #scnt + %maxTimeOutScan
  set %jrnl #jindex
  scanjournal %jrnl

  while #scnt < %timeout
  {
    if %jrnl < #jindex
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
    }

    for %journalCounter 1 %0
    {
     if % . %journalCounter in #journal
       return % . %journalCounter
    }
  }
return

27
Here is the script with runebook support, wich it's not complete yet but it works fine. I don't like much the new code and I have to think a way to find a more elegant and understandable solution.

Code: [Select]
;=================================================================
; Script Name: Fishing 4x4 Harbor Edition
; Author: VicVega
; Version: 0.1
; Shard OSI / FS: UO Legends
; Revision Date: 15/5/2009
; Purpose: Fishing in a harbor 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 #true by default, you need to add fishSteaks
;                   at the Razor's Sell Agent
; %saveData - set #true for save data in fishing4x4DataHarbor.txt or #false
;             It's #true by default
;             You need the SaveTextToFile.vbs script for this
; %saveData - set #true for save data in fishing4x4Data.txt or #false
;             It's #true by default. You need the SaveTextToFile.vbs script for this.
;             Important: Remember to rename it from .txt to .vbs
; %recall - set #true for recall, #true by default, uses sacred journey
; Thanks: TrailMyx for his ConvertTimeHourMinSec sub
;         JoMac for his saveTextToFile.vbs script
;************************ Setup **********************************
gosub setup
;*********************** Main Loop *******************************
repeat
  gosub fishingPlace
  gosub checkWeight
  gosub fishingLoop
  gosub dropBoots
  gosub dropSpecialFishes
 
  if %saveData
    gosub saveData
until #CharGhost = YES
halt
;************************* Subs **********************************
sub fishingPlace
  if %fishingPlace = firstFishingPlace
  {
    event sysmessage going to second fishing place
    set %fishingPlace secondFishingPlace
    gosub recallFishingSpot secondFishingPlace
  }
  else
  {
    event sysmessage going to first fishing place
    set %fishingPlace firstFishingPlace
    gosub recallFishingSpot firstFishingPlace
  }
return

sub setup
  set %sellFishSteaks #true
  set %saveData #true
  set %recall #true
  set %fishingPlace secondFishingPlace
 
  set %maxWeight #maxweight - 50
 
  set %poleType KDF
  set %daggerType WSF
 
  gosub setID poleID %poleType  #charID
  gosub setID daggerID %daggerType #backpackID
  if %saveData
    gosub saveStartData
return

sub setID
  finditem %2 C_ , %3
  set % . %1 #findID
return

sub saveStartData
  set %goldType POF
  set %startTime #scnt
  set %lastSave %startTime
  gosub time #time
  finditem %goldType C_ , #backpackID
  set %startGold #findStack
  gosub writeStartData
return

sub writeStartData
  execute SaveTextToFile.Vbs #false #false #curPath fishing4x4DataHarbor.txt
  + Start Time: %time |
  + Start Gold: %startGold
return

sub fishingLoop
  for %fishingSpot 1 4
  {
    gosub pullFishes %fishingSpot
    gosub cutFish
    if %sellFishSteaks
      gosub sellFishSteaks
  }
return

sub pullFishes
  gosub fishingSpot %1
  gosub tileName %fishingSpotX %fishingSpotY
  event sysmessage %fishingSpotX %fishingSpotY
  while #result = #true
  {
    gosub usePole
    gosub scanMessages
  }
return

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

sub setTargets
  event sysmessage %fishingPlace
  if %fishingPlace = firstFishingPlace
    set #lTargetKind 2
  if %fishingPlace = secondFishingPlace
    set #lTargetKind 3
  set %fishingSpotX %1
  set %fishingSpotY %2
  set #lTargetX #charPosX + %fishingSpotX
  set #lTargetY #charPosY + %fishingSpotY
return

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

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

sub scanMessages
  set %maxTimeOutScan 15
  set %timeOut #scnt + %maxTimeOutScan
  set %jrnl #jindex
  set %successMessage pull_out
  set %failMessage fail_to_catch
  set %emptySpotMessage don't_seem_to_be_biting
  scanjournal %jrnl
 
  while #scnt < %timeOut
  {
    if %jrnl < #jindex
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
    }
    set %spotWithFish %successMessage in #journal || %failMessage in #journal
    set %spotWithoutFish %emptySpotMessage in #journal
    if %spotWithFish
      return #false
    if %spotWithoutFish
      return #false
  }
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 #charPosZ
    wait 1s
    finditem %bootsType C_ , #backpackID
  }
return

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

sub saveData
  if #scnt >= %lastSave + 600
  {
    set %timeFishing #scnt - %startTime
    gosub ConvertTimeHourMinSec %timeFishing
    set %timeFishingConverted #result
    set %lastSave #scnt
   
    finditem %goldType C_ , #backpackID
    set %gold #findStack
    set %goldGained %gold - %startGold
    set %goldPerHour ( %goldGained * 3600 ) / %timeFishing
   
    gosub time #time
    gosub writeData
  }
return

sub writeData
  execute SaveTextToFile.Vbs #false #false #curPath fishing4x4DataHarbor.txt
  + Time: %time |
  + Time Fishing: %timeFishingConverted |
  + Gold: %gold |
  + Gold Gained: %goldGained |
  + Gold Per Hour: %goldPerHour
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 sellFishSteaks
  set %vendorType IS_HS
  set %fishSteaksType IND
  finditem %vendorType G_2
  event property #findID
  set %canSell Fisher in #property && #findDist <= 2
  while ! %canSell
  {
    wait 1s
    finditem %vendorType G_2
    if #findID = #charID
      ignoreitem #findID
    event property #findID
   
    set %canSell Fisher in #property && #findDist <= 2
  }
  ignoreitem reset
  finditem %fishSteaksType C_ , #backpackID
  if #findKind <> -1
    msg vendor sell $
return

sub checkWeight
 
  if #weight > %maxWeight
  {
    if %recall
    {
      gosub recallBank
      gosub dropItemsBank
      gosub recallFishingSpot
    }
    else
      halt
  }
return

sub recallBank
  set %bankPosX 3489
  set %bankPosY 2571
  set %runeNo 1
  set %recallType sacred
  call runeBook.txt %recallType %runeNo
  gosub waitingRecallPos %bankPosX %bankPosY recallBank
 
return

sub recallFishingSpot
  if %1 = firstFishingPlace
  {
    set %fishingPosX 3504
    set %fishingPosY 2610
    set %runeNo 2
  }
  if %1 = secondFishingPlace
  {
    set %fishingPosX 1503
    set %fishingPosY 3695
    set %runeNo 3
  }
  set %recallType sacred
  call runeBook.txt %recallType %runeNo
  gosub waitingRecallPos %fishingPosX %fishingPosY recallFishingSpot
 
return

sub waitingRecallPos
  set %maxTimeOut 5
  set %timeOut #scnt + %maxTimeOut
  while #charPosX <> %1 && #scnt < %timeOut
    wait 1s
  set %timeOut #scnt + %maxTimeOut
  while #charPosY <> %2 && #scnt < %timeOut
    wait 1s
  if #scnt >= %timeOut
    gosub %3
return

sub dropItemsBank
  set %bankType IKF
  set %goldType POF
  set %pearlsType WWS
  msg bank $
  while #contType <> %bankType
    wait 5
  gosub dropItems
  click #contPosX #contPosY r
  wait 1s
return

sub dropItems
  finditem %goldType C_ , #backpackID
  if #findKind <> -1
  {
    event sysmessage droping gold
    exevent drag #findID #findStack
    wait 1s
    finditem %bankType
    exevent dropC #findID
    wait 1s
  }
  finditem %pearlsType C_ , #backpackID
  if #findKind <> -1
  {
    event sysmessage droping pearls
    exevent drag #findID #findStack
    wait 1s
    finditem %bankType
    exevent dropC #findID
    wait 1s
  }
return

sub time
  set %time %1
  str ins %time : 3
  set %time #strRes
  str ins %time : 6
  set %time #strRes
return

; %1 = input - Time to convert
; #RESULT -  Time converted to H:MM:SS format
sub ConvertTimeHourMinSec
  namespace push
  namespace local ctime
  set !hourpart %1 / 3600
  set !secpart ( %1 % 3600 ) % 60
  set !minpart ( ( %1 % 3600 ) / 60 )
 
  if !hourpart >= 10
    set #RESULT !hourpart , :
  else
    set #RESULT 0 , !hourpart , :
  if !minpart < 10
    set #RESULT #RESULT , 0
  set #RESULT #RESULT , !minpart , :
  if !secpart < 10
    set #RESULT #RESULT , 0
  set #RESULT #RESULT , !secpart
  namespace pop
return #RESULT

I also use this other script for calling runebooks:

Code: [Select]
finditem ZBN C_ , #backpackID
gosub runeBookDo %1 %2 #findID
exit

;==================================
; Script Name: RuneBookDo
; Author: Vito
; Version: 1.0a
; Client Tested with: 6.0.13 (91)
; EUO version tested with: 1.5 (148)
; Shard OSI / FS: FS ( RunUO ) Should work on OSI
; Revision Date: 13/04/2009
; Public Release: 13/04/2009
; Purpose: Handles most runebook functions
;==================================
;|
;| Parameters:
;|            %1 - "Do" ( setdefault  - Set default rune
;|                        drop        - Drop rune
;|                        charge      - Use charge on rune
;|                        recall      - Recall to rune
;|                        gate        - Open a gate to rune
;|                        sacred      - Sacred J. to rune )
;|            %2 - "Rune" ( Rune number, 1 to 16 )
;|            %3 - "Book" ( Runebook ID )
;|            [%4] - "TimeOut" ( Optional, sets timeout for
;|                               event based actions, in seconds )
;|
;| Return: #True if ok, else #False
;+-----------------------------------------------------------

sub RuneBookDo
    set %RBD_Do %1
    set %RBD_Rune %2 - 1
    set %RBD_Book %3

    ; Some security checks
    if %0 = 4
      set %RBD_TimeOut %4
    else
      set %RBD_TimeOut 10
    set %RBD_End #SCnt + %RBD_TimeOut

    if %0 < 3
      return #False

    if %RBD_Rune < 0 || %RBD_Rune > 15
      return #False

    ; Open the book
    finditem ZBN C_ , #BackPackID
    set #LObjectID #FindID
    event macro 17
    while #ContKind <> GJZ && %RBD_End > #SCnt
      wait 1

    if %RBD_Do = charge
    {
      set %RBD_X #ContPosX + 135
      if %RBD_Rune > 7
        set %RBD_X #ContPosX + 295
      ; Rather complex, uh?
      set %RBD_Y #ContPosY + 70 + ( 15 * ( %RBD_Rune % 8 ) )
    }
    else
    {
      ; Open the right page
      set %RBD_Page ( %RBD_Rune / 2 ) + 1
      if %RBD_Page < 5
        set %RBD_Page %RBD_Page - 1
      set %RBD_X #ContPosX + 140 + ( 35 * %RBD_Page )
      set %RBD_Y #ContPosY + 200
      click %RBD_X %RBD_Y dmc
      ; Unable to do event-based without using #PixCol (Puah!)
      wait 10

      if %RBD_Do = setdefault
      {
        set %RBD_X #ContPosX + 165 + ( 140 * ( %RBD_Rune % 2 ) )
        set %RBD_Y #ContPosY + 25
      }
      if %RBD_Do = drop
      {
        set %RBD_X #ContPosX + 140 + ( 160 * ( %RBD_Rune % 2 ) )
        set %RBD_Y #ContPosY + 120
      }
      if %RBD_Do = recall
      {
        set %RBD_X #ContPosX + 140 + ( 160 * ( %RBD_Rune % 2 ) )
        set %RBD_Y #ContPosY + 145
      }
      if %RBD_Do = gate
      {
        set %RBD_X #ContPosX + 140 + ( 160 * ( %RBD_Rune % 2 ) )
        set %RBD_Y #ContPosY + 163
      }
      if %RBD_Do = sacred
      {
        set %RBD_X #ContPosX + 140 + ( 160 * ( %RBD_Rune % 2 ) )
        set %RBD_Y #ContPosY + 181
      }
    }
    click %RBD_X %RBD_Y dmc
return #True

28
I'm glad you like it.

So i'm working on support for runebooks, but I have found out that if you fish in profound waters the #ltargetKind it's 2 and if you fish in near the coast waters, the #lTargetKind it's 3

The question is, how can I find out the #lTargetKind of a water's tile?

29
Fishing 4x4 Harbor Edition



This is a modification of my previous script Fishing 4x4, this time I cuted out the boat support in order to make the code easier to understand and improve.

Later on I will made another edition specific for boats.

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 till you are overloaded

Current features

  • Fishes under the harbor's tables
  • If the sell option it's activated, sells the steaks using Razor Sells Agent (you have to set the Razor Agent to do this).
  • Cuts the fish with a dagger.
  • Drops boots on the ground.
  • Drops special fishes on the ground
  • If the saving data option it's activated, saves the fishing data in a file called fishing4x4DataHarbor.txt aproximately each 10 minutes

Version History

new in 0.1  (15/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 fishing4x4DataHarbor.txt looks like, in case you activate this option:

Quote
Start Time: 16:07:48  | Start Gold: 5788
Time: 16:18:06 | Time Fishing: 00:10:18 | Gold: 5992 | Gold Gained: 204 | Gold Per Hour: 1188
Time: 16:31:20 | Time Fishing: 00:23:32 | Gold: 6216 | Gold Gained: 428 | Gold Per Hour: 1091
Time: 16:45:20 | Time Fishing: 00:37:32 | Gold: 6408 | Gold Gained: 620 | Gold Per Hour: 991


  • 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 #true by default. You need to add fishSteaks at the Razor's Sell Agent
  • %saveData - set #true for save data in fishing4x4DataHarbor.txt or #false, it's #true by default. You need the SaveTextToFile.vbs script for this. Important: Remember to rename it from .txt to .vbs
Code: [Select]
;=================================================================
; Script Name: Fishing 4x4 Harbor Edition
; Author: VicVega
; Version: 0.1
; Shard OSI / FS: UO Legends
; Revision Date: 15/5/2009
; Purpose: Fishing in a harbor 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 #true by default, you need to add fishSteaks
;                   at the Razor's Sell Agent
; %saveData - set #true for save data in fishing4x4DataHarbor.txt or #false
;             It's #true by default
;             You need the SaveTextToFile.vbs script for this
; %saveData - set #true for save data in fishing4x4Data.txt or #false
;             It's #true by default. You need the SaveTextToFile.vbs script for this.
;             Important: Remember to rename it from .txt to .vbs
; Thanks: TrailMyx for his ConvertTimeHourMinSec sub
;         JoMac for his saveTextToFile.vbs script
;************************ Setup **********************************
gosub setup
;*********************** Main Loop *******************************
repeat
  gosub fishingLoop
 
  gosub dropBoots
  gosub dropSpecialFishes
 
  if %saveData
    gosub saveData
until #CharGhost = YES
halt
;************************* Subs **********************************
sub setup
  set %sellFishSteaks #true
  set %saveData #true
 
  set %maxWeight 570
 
  set %poleType KDF
  set %daggerType WSF
 
  gosub setID poleID %poleType  #charID
  gosub setID daggerID %daggerType #backpackID
  if %saveData
    gosub saveStartData
return

sub setID
  finditem %2 C_ , %3
  set % . %1 #findID
return

sub saveStartData
  set %goldType POF
  set %startTime #scnt
  set %lastSave %startTime
  gosub time #time
  finditem %goldType C_ , #backpackID
  set %startGold #findStack
  gosub writeStartData
return

sub writeStartData
  execute SaveTextToFile.Vbs #false #false #curPath fishing4x4DataHarbor.txt
  + Start Time: %time |
  + Start Gold: %startGold
return

sub fishingLoop
  for %fishingSpot 1 4
  {
    gosub pullFishes %fishingSpot
    gosub cutFish
    if %sellFishSteaks
      gosub sellFishSteaks
  }
return

sub pullFishes
  gosub fishingSpot %1
  gosub tileName %fishingSpotX %fishingSpotY
  event sysmessage %fishingSpotX %fishingSpotY
  while #result = #true
  {
    gosub usePole
    gosub scanMessages
  }
return

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

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

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

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

sub scanMessages
  set %maxTimeOutScan 15
  set %timeOut #scnt + %maxTimeOutScan
  set %jrnl #jindex
  set %successMessage pull_out
  set %failMessage fail_to_catch
  set %emptySpotMessage don't_seem_to_be_biting
  scanjournal %jrnl
 
  while #scnt < %timeOut
  {
    if %jrnl < #jindex
    {
      set %jrnl %jrnl + 1
      scanjournal %jrnl
    }
    set %spotWithFish %successMessage in #journal || %failMessage in #journal
    set %spotWithoutFish %emptySpotMessage in #journal
    if %spotWithFish
      return #true
    if %spotWithoutFish
      return #false
  }
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 #charPosZ
    wait 1s
    finditem %bootsType C_ , #backpackID
  }
return

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

sub saveData
  if #scnt >= %lastSave + 600
  {
    set %timeFishing #scnt - %startTime
    gosub ConvertTimeHourMinSec %timeFishing
    set %timeFishingConverted #result
    set %lastSave #scnt
   
    finditem %goldType C_ , #backpackID
    set %gold #findStack
    set %goldGained %gold - %startGold
    set %goldPerHour ( %goldGained * 3600 ) / %timeFishing
   
    gosub time #time
    gosub writeData
  }
return

sub writeData
  execute SaveTextToFile.Vbs #false #false #curPath fishing4x4DataHarbor.txt
  + Time: %time |
  + Time Fishing: %timeFishingConverted |
  + Gold: %gold |
  + Gold Gained: %goldGained |
  + Gold Per Hour: %goldPerHour
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 sellFishSteaks
  if %sellFishSteaks
    gosub sell
  else
    gosub checkWeight
return

sub sell
  set %vendorType IS_HS
  set %fishSteaksType IND
  finditem %vendorType G_2
  event property #findID
  set %canSell Fisher in #property && #findDist <= 2
  while ! %canSell
  {
    wait 1s
    finditem %vendorType G_2
    event property #findID
    set %canSell Fisher in #property && #findDist <= 2
  }
  finditem %fishSteaksType C_ , #backpackID
  if #findKind <> -1
    msg vendor sell $
return

sub checkWeight
  if #weight > %maxWeight
    halt
return

sub time
  set %time %1
  str ins %time : 3
  set %time #strRes
  str ins %time : 6
  set %time #strRes
return

; %1 = input - Time to convert
; #RESULT -  Time converted to H:MM:SS format
sub ConvertTimeHourMinSec
  namespace push
  namespace local ctime
  set !hourpart %1 / 3600
  set !secpart ( %1 % 3600 ) % 60
  set !minpart ( ( %1 % 3600 ) / 60 )
 
  if !hourpart >= 10
    set #RESULT !hourpart , :
  else
    set #RESULT 0 , !hourpart , :
  if !minpart < 10
    set #RESULT #RESULT , 0
  set #RESULT #RESULT , !minpart , :
  if !secpart < 10
    set #RESULT #RESULT , 0
  set #RESULT #RESULT , !secpart
  namespace pop
return #RESULT

30
Bug discussion / Re: Script UO crashing
« on: May 13, 2009, 08:52:04 AM »
I didn't have to install framework 3.5 to use HydraIRC

In fact I think framework 3.5 was installed before and Script UO worked fine, like now works fine when HydraIRC is closed

Pages: 1 [2] 3 4 5