Yoko

All sides of Injection
It is currently 2026-01-18 16:33:24

All times are UTC+02:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: 2005-04-03 10:35:07 
Offline

Joined: 2005-03-06 00:08:51
Posts: 5
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:
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:
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



Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited