RECORD PATH - Lumber, mining, fishing ...

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
Felixuco
Posts: 5
Joined: 2005-03-06 00:08:51

RECORD PATH - Lumber, mining, fishing ...

Post by Felixuco »

This script records a path, useful in lumber, mining & fishing scripts. You must tweak a little to work with mining and fishing (journal messages).

Structure: CharX CharY TargType TargX TargY TargZ

Code: Select all

sub record_path()

   var Msg_Logs   = "You put the logs in your pack."
   var Msg_NoLogs   = "There are no logs here to chop."
   var Msg_Fail   = UO.GetName() + ": You hack at the tree for a while, but fail to produce any useable wood."
   var Msg_Error1   = "You can't reach this."
   var Msg_Error2   = "You can't think of a way to use that item."
   var Msg_Error3   = "It appears immune to your blow"
   var Msg_Error4   = "Targetting Cancelled"
   var Msg_Error5   = "Your ghostly hand passes through the object."
   var Msg_Stop   = UO.GetName() + ": Stop"
   
   var i      = 0
   var lasti   = 0
   
   DIM Path[3000]

   UO.Print("Selecciona la herramienta con la que grabaras la macro.")
   UO.AddType("Herramienta")
   while UO.Targeting()
      wait(100)
   wend
   
   repeat
      UO.DeleteJournal()
      UO.UseType("Herramienta")
      repeat
         wait(500)
      until UO.InJournal(Msg_Logs) || UO.InJournal(Msg_NoLogs) || UO.InJournal(Msg_Fail) || UO.InJournal(Msg_Error1) || UO.InJournal(Msg_Error2) || UO.InJournal(Msg_Error3) || UO.InJournal(Msg_Error4) || UO.InJournal(Msg_Error5)
      if UO.InJournal(Msg_Logs) || UO.InJournal(Msg_NoLogs) || UO.InJournal(Msg_Fail) then
         Path[i] = str(UO.GetX()) + " " + str(UO.GetY()) + " " + str(UO.LastTile(0)) + " " + str(UO.LastTile(1)) + " " + str(UO.LastTile(2)) + " " + str(UO.LastTile(3))
         i = i + 1
      end if
   until UO.InJournal(Msg_Stop) || i > 2999
   
   lasti = i - 1
   
   UO.TextClear()
   UO.TextOpen()
   
   UO.TextPrint("#######################################################")
   UO.TextPrint("# Autor: Felix aka In-Grid.")
   UO.TextPrint("# Version: 0.1")
   UO.TextPrint("#######################################################")
   UO.TextPrint("# Acuerdate de copiar y pegar todo este contenido en")
   UO.TextPrint("# la zona de declaracion de variables dentro de la")
   UO.TextPrint("# funcion principal Leñador")
   UO.TextPrint("#######################################################")
   UO.TextPrint("")
   UO.TextPrint("DIM Path[" + str(lasti + 1) + "]")
   for i = 0 to lasti
      UO.TextPrint('Path [' + str(i) + ']      = "' + Path[i] + '"')
   next
   UO.TextPrint("")
   UO.TextPrint("")
   UO.TextPrint("var lasti = " + str(lasti))
   
end sub



How to read this array, example:

Code: Select all

while temp[j] <> " "
   CharX = CharX + temp[j]
   j = j + 1
wend
j = j + 1
while temp[j] <> " "
   CharY = CharY + temp[j]
   j = j + 1
wend
j = j + 1
while temp[j] <> " "
   TargType = TargType + temp[j]
   j = j + 1
wend
j = j + 1
while temp[j] <> " "
   TargX = TargX + temp[j]
   j = j + 1
wend
j = j + 1
while temp[j] <> " "
   TargY = TargY + temp[j]
   j = j + 1
wend
j = j + 1
while j < len(temp)
   TargZ = TargZ + temp[j]
   j = j + 1
wend

Post Reply