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.


Topics - VicVega

Pages: [1] 2
1
Scripting Chat / Droping items problem
« on: January 24, 2010, 07:23:56 AM »
Si I've started to play again and I have some problems with my fishing script (wich worked fine before).

Droping boots of fishes in particular. So drops fishes and boots fine till a moment when it drops the fishes or the boots, and they go right back to the backpack.

So it enters in an infinite loop.

Code: [Select]
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

So now I've made a change in this part and it generates a random number (0 or 1) in order to drop the items right at my feet or a tile before:

Code: [Select]
sub dropBoots
  set %bootsType TVI_ZVI_ZVI_PVI_NVI
  finditem %bootsType C_ , #backpackID
  while #findKind <> -1
  {
    set %dropPosY #charPosY - #random % 2
    exevent drag #findID #findStack
    wait 1s
    exevent dropg #charPosX %dropPosY #charPosZ
    wait 1s
    finditem %bootsType C_ , #backpackID
  }
return

That works better but still it gets stuck droping fishes or boots, but much less times.

When this happens I've tried stoping the script and write a little one in order to drop the items and it happens the same, unless I change the tile I'm droping them.

Any idea why this could be happening?

I've stop playing for almost a year and I'm playing in the same server.

2
Scripting Chat / Tile problems
« on: January 22, 2010, 02:38:25 PM »
I've been out of UO for a while, I'm glad this forum it's still up and active.

So here is my question, I'm trying to use my macros but I have a problem with the tile comand which I don't understand.

So I try this:

tile init
tile cnt #charPosX #charPosY
tile get #charPosX #charPosY

But I don't get any results on the #tileCnt, #tileZ or #tileType variables.

Anything I could be missing?

PS: I also tried indicating the facets.

3
Script Debug / Mining 0.1 for Public Testing
« on: June 07, 2009, 09:10:44 AM »
Features: This script recalls to the mining spot, when overloaded recalls home and drops the ores and the jewelry to a chest in your home, and then recalls to the next mining spot on your runebook. If your shovel brokes, recalls home, picks up iron and tinkering tools from the chest and makes a new shovel. The script also writes to a miningData.txt file some data about your mining rates.

Here is a miningData.txt sample output:

Quote
Start Time: 18:08:01
Time: 18:18:21 | Time Mining: 00:10:20 | Ore Mined: 159 | Ore Per Hour: 923
Time: 18:28:21 | Time Mining: 00:20:20 | Ore Mined: 318 | Ore Per Hour: 938
Time: 18:38:40 | Time Mining: 00:30:38 | Ore Mined: 480 | Ore Per Hour: 940

Here is the mining.txt code, you need another three auxiliar scripts included on the zip:

Code: [Select]
;=================================================================
; Script Name: Mining
; Author: VicVega
; Version: 0.1
; Shard OSI / FS: UO Legends
; Revision Date: 7/5/2009
; Purpose: Mines, recalls, drops ores and mines again
; Globals: None
;=================================================================
; Instructions: You need auxiliar scripts saveTextFoFile.vbs, runebooks.txt and
; makeShovel.txt to be in the same folder as this script.
; You need to setup each mining position coords at the
; setupMiningPos sub. You need a runebook with the mining spots in order.
; Example: First Runebook Slot = First Mining Spot,
; Second Runebook Slot = Second Mining Spot ...
; You must specify the spot's number at %maxRunes variable
; You must specify in wich slot it's your rune for recalling home at the
; %runeHomeNo variable.
; You need a wood chest outside your home in order to drop the ingots and jewels.
; If your character it's an elf, you must adjust the %maxWeight variable
; Thanks: TrailMyx for his ConvertTimeHourMinSec sub
;         JoMac for his saveTextToFile.vbs script
;         Vito for his runeBook.txt script
;************************ Setup **********************************
gosub setup
;*********************** Main Loop *******************************
repeat
  gosub checkWeight
  gosub saveData
  gosub recallMiningPosition
  gosub mining
until #charGhost = yes
halt
;************************* Subs **********************************
sub setup
  gosub setupMiningPos
  set %maxWeight #maxWeight + 40
  set %oreType DWJ
  set %shovelType TWF_QPF
  set %recallType recall
  set %woodenChestType JIF
  finditem %woodenChestType G_2
  set %woodenChestID #findID
  gosub saveStartData
return

sub setupMiningPos
  set %posX1 xxxx
  set %posY1 xxxx
  set %posX2 xxxx
  set %posY2 xxxx
  set %posX3 xxxx
  set %posY3 xxxx

  set %homeX 733
  set %homeY 720

  set %runeHomeNo 8
  set %runeNo 0
  set %maxRunes 3
return

sub saveStartData
  set %startTime #scnt
  set %lastSave %startTime
  gosub time #time
  set %oreMined 0
  gosub writeStartData
return

sub writeStartData
  execute SaveTextToFile.Vbs #false #false #curPath miningData.txt
  + Start Time: %time
return

sub saveData
  if #scnt >= %lastSave + 600
  {
    set %timeMining #scnt - %startTime
    gosub ConvertTimeHourMinSec %timeMining
    set %timeMiningConverted #result
    set %lastSave #scnt
    set %orePerHour ( %oreMined * 3600 ) / %timeMining
    gosub time #time
    gosub writeData
  }
return

sub writeData
  execute SaveTextToFile.Vbs #false #false #curPath miningData.txt
  + Time: %time |
  + Time Mining: %timeMiningConverted |
  + Ore Mined: %oreMined |
  + Ore Per Hour: %orePerHour
return

sub recallHome
  call runeBook.txt %recallType %runeHomeNo
  gosub waitingRecallPos %homeX %homeY
return

sub recallMiningPosition
  set %runeNo %runeNo + 1
  if %Runeno > %MaxRunes
    set %runeNo 1

  set %posX  %posX . %RuneNo
  set %posY  %posY . %RuneNo

  wait 10
  call runeBook.txt %recallType %runeNo
  gosub waitingRecallPos %posX %posY
return

sub waitingRecallPos
  set %maxTimeOut 10
  set %posX %1
  set %posY %2
  set %timeOut #scnt + %maxTimeOut
  while #charPosX <> %posX && #scnt < %timeOut
    wait 1s
  set %timeOut #scnt + %maxTimeOut
  while #charPosY <> %posY && #scnt < %timeOut
    wait 1s
  if #scnt >= %timeOut
  {
    call runeBook.txt %recallType %runeNo
    gosub waitingRecallPos %posX %posY
  }
return

sub checkWeight
  if #weight >= %maxWeight
  {
    if %spotDepleted = #false
      set %runeNo %runeNo - 1
    gosub recallHome
    gosub dropItemsChest %oreType
    gosub dropJewels
  }
return

sub dropJewels
  set %turquoise ZWS
  set %fireRuby VWS
  set %darkSapphire AXS
  set %blueDiamond GXS
  set %perfectEmerald UWS
  set %ecruCitrine TWS

  gosub dropItemsChest %turquoise
  gosub dropItemsChest %fireRuby
  gosub dropItemsChest %darkSapphire
  gosub dropItemsChest %blueDiamond
  gosub dropItemsChest %perfectEmerald
  gosub dropItemsChest %ecruCitrine
return

sub dropItemsChest
  finditem %1 C_ , #backpackID
  while #findKind <> -1
  {
    if #findType = %oreType
      set %oreMined %oreMined + #findStack
    exevent drag #findID #findStack
    wait 10
    exevent dropc %woodenChestID
    wait 2s
    finditem %1 C_ , #backpackID
  }
return

sub mining
  set %spotDepleted #false
  gosub tileName
  while #weight <= %maxWeight && %spotDepleted = #false
  {
    gosub useShovel
    gosub scan
  }
return

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

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

    if you_dig in #journal || loosen_some in #journal
    {
      set %spotDepleted #false
      return
    }

    if there_is_no_metal in #journal
    {
      set %spotDepleted #true
      return
    }
  }
return

sub useShovel
  set #lTargetKind 3
  set #lTargetX #CHARPOSX
  set #lTargetY #CHARPOSY
  set #lTargetZ #charPosZ
  finditem %shovelType C_ , #backpackID
  while #findKind = -1
  {
    gosub recallHome
    call makeShovel.txt
    set %runeNo %runeNo - 1
    gosub recallMiningPosition
    finditem %shovelType C_ , #backpackID
  }
  set #LOBJECTID #FINDID
  event macro 17
  target 3s
  event macro 22
return

sub tileName
  set %miningPosX #charPosX + %x
  set %miningPosY #charPosY + %y
  tile init
  tile cnt %miningPosX %miningPosY
  for %j 1 #tilecnt
  {
    tile get %miningPosX %miningPosY  %j
    set %canMine cave_floor in #tileName
    if %canMine
    {
      set #lTargetTile #tileType
      return #true
    }
  }
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

4
Scripting Chat / Looping a mining script
« on: June 03, 2009, 01:27:26 PM »
So my mining script it's something like this at the moment (I only post now the significant code, the main loop):

Code: [Select]
repeat
      gosub checkWeight
      gosub recall firstSpot
      gosub mining
      gosub checkWeight
      gosub recall secondSpot
      gosub mining
until #charGhost = yes

Hope somebody gives me an idea how to loop this with less repetitive or redundant code in order to add mining spots and have a code less horrible.

5
Scripting Chat / About mining
« on: June 01, 2009, 01:23:22 PM »
I've found a hall 40 tiles long and 3 tiles wide all minables.

Something like this:

########################################
########################################
########################################

So if my character stands like this and mines in this four spots:

1#2#####################################
#C######################################
3#4#####################################

It also would mine the other spots one tile around the character?

And even more important, how many tiles should the character advance in order to get to a spot not depleted and mine again?

6
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

7
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

8
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

9
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

10
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

11
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

12
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

13
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

14
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

15
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.

Pages: [1] 2