Yoko

All sides of Injection
It is currently 2026-01-16 20:19:01

All times are UTC+02:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 2012-01-15 17:25:34 
Offline

Joined: 2010-12-01 08:01:12
Posts: 19
he guys, I am using a simple walking lumberjack script, which works fine...
but if it gets stuck in the middle i need to go back on the position is started and start over again...
so I wanted to put some ID when i start (so it will ask me where to start)... works fine but if i dont know the ID of the move (variable n in the script) then im fucked...

so al works fine, i can define ID where to start, but I need the script to show me the ID of every move i do

Code:
UO.deletejournal()

n = readnumfromjournal()

while not uo.dead()
  While not (way[n] == "X")
     direction = ""
     While not (way[n] == " ")
        direction = direction + way[n]
        n = n + 1
     Wend
     UO.Print("Action: " + direction + ", ID# " + n)

... blabla ...

end sub

sub WaitForJournal(text)
     repeat
          wait(200)
     until uo.inJournal(text)
     wait(500)
end sub

sub readnumfromjournal()
  uo.deletejournal()
  uo.print("ID to start:")
  uo.click("self")
  repeat
    wait(100)
  until sayi("1|2|3|4|5|6|7|8|9|0")
  var radek = uo.injournal("1|2|3|4|5|6|7|8|9|0")-1

  var m   
  var name = uo.getname("self")
  while name == ""
    uo.click("self")
    wait(1000)
    name = uo.getname("self")
  wend
  uo.print("Starting at ID# " + mid(uo.journal(radek), len(name)+2, 10))
  return val(mid(uo.journal(radek), len(name)+2, 10))
end sub

sub sayi(text)
  if uo.journalserial(uo.injournal(text)-1) == uo.getserial('self') then
    return 1
  else
    return 0
  endif
end sub


when try it shows error "Runtime error - Invalid operation for this type" on row UO.Print("Action: " + direction + ", ID# " + n), well i dont know how to print the n variable

anyway on the row uo.print("Starting at ID# " + mid(uo.journal(radek), len(name)+2, 10)) it actually prints it, just dont know what mid() and len() does, so it could be my second question what those functions does


Top
   
PostPosted: 2012-01-15 17:34:47 
Offline
User avatar

Joined: 2006-12-08 10:51:50
Posts: 718
Location: Москва
1) UO.Print("Action: " + direction + ", ID# " + str(n))
2) len returns the length of the string
uo.Print(str(len('1234'))) => 4
uo.Print(str(len('123'))) => 3
3)
Code:
var string = '0123456789'
  uo.print(mid(string, 2, 5))
=> '2345'


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

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 3 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