Yoko

All sides of Injection
It is currently 2026-01-18 13:36:33

All times are UTC+02:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
 Post subject: RunUO runebook miner.
PostPosted: 2005-01-25 22:51:35 
Offline

Joined: 2004-09-07 22:36:09
Posts: 22
Location: Poland
Hi.

Me again. Its rather proof of concept (well works well, but injection sucks when it comes to complicated unatended scripts for longer period, those dunno-what-from parser errors after 2 hours of script running).

Ok. That shit just use runebook to recall to mine, then it digs ore from around, drops at house, stocking with reg and shovel automatically.

U can use my stocking sub check_regs from other script ive posted 10 mins ago. Its not here for simple reason. Ive wrote it after mining :P

Vars:
mine_rb - whoa! thats runebook with runes to ore spots
mine_tool - guess?
ruda - ore obj type
home_rb - runebook with rune to home (to stock and drop ore)
ore_cont - where to drop ore? it has to be in range from home rune
home_x home_y - u really dont need, i was writing for fast ... btw. recall routing sucks here, so feel free to change it, and then u wont need those two vars.

Rest of vars are RunUO cliloc messages. Like "You've got ore" or sth. Dont take care of them ;P They're defined good.

Btw. Feel free to comment it. If I seem to dont know about sth, just tell me Im not posting it for ppl who cant script for theirselfs. I post for ppl who can script, so then I hope my scripts will help them, and theyll help me.

Code:
#
# (c) ziemniaq - ziemni@risp.pl
#
sub mine_rb()
  var mine_rb = 0x400F1322
  var mine_tool = 0xF39
 
  var ruda = 0x19B9
  var action_delay = 650

  var home_rb = 0x400F126F
  var home_rune = 3
  var ore_cont = "0x400D1A3F"
  var home_x = 1000
  var home_y = 1000


  var reg_bm = 0x0F7B
  var reg_bp = 0x0F7A
  var reg_mr = 0x0F86
 
# Where do you wish to dig.
  var mine_prompt = "cliloc# 0xACF9"
  var mine_stop = "cliloc# 0xAD00"
  var mine_fail = "cliloc# 0xAD03"
# You dig some iron ore.
 
 
 
  var ore_types = 8
  dim mine_ore[10]
    mine_ore[1] = "cliloc# 0x5DE0"   # iron
    mine_ore[2] = "cliloc# 0x5DE2"   # shadow
    mine_ore[3] = "cliloc# 0x5DE1"   # dull
    mine_ore[4] = "cliloc# 0x5DE4"   # bronze
    mine_ore[5] = "cliloc# 0x5DE5"   # gold
    mine_ore[6] = "cliloc# 0x5DE3"   # copper
    mine_ore[7] = "cliloc# 0x5DE6"   # agapite
    mine_ore[8] = "cliloc# 0x5DE7"   # verite
  var i = 1,j,z
  var max_spots = 64
 
  var f = file("6.cfg")
  if NOT f.open() then
    UO.Print("Blad otwarcia pliku")
    return FALSE
  endif

  dim runa[64],prop_x[64],prop_y[64],spot_type[64],spot_x[64],spot_y[64],spot_z[64]
 
  for i = 1 to 64
    runa[i] = f.ReadNumber()
    prop_x[i] = f.ReadNumber()
    prop_y[i] = f.ReadNumber()
    spot_type[i] = f.ReadNumber()
    spot_x[i] = f.ReadNumber()
    spot_y[i] = f.ReadNumber()
    spot_z[i] = f.ReadNumber()
  next
 
  f.close()


  var akt_spot = 1
   
while TRUE
  while UO.GetX('self') <> prop_x[akt_spot] OR UO.GetY('self') <> prop_y[akt_spot]
    recaluj(mine_rb,runa[akt_spot])
    i = 0
    z = TRUE
    while i < 7000 AND z
      if UO.GetX('self') == prop_x[akt_spot] AND UO.GetY('self') == prop_y[akt_spot] then
        z = false
      endif
      i = i + 50
      wait(50)
    wend
  wend
  remove_from_journal(mine_stop)
  UO.Print("dupa")
  while NOT UO.InJournal(mine_stop) AND UO.Weight < 370
    if UO.Waiting() then
      UO.CancelTarget()
    endif
   
  #  UO.Print("Targetting.. " + STR(spot_type[akt_spot]) + " " + STR(spot_x[akt_spot] ) + " " + STR( spot_y[akt_spot]) + " " + STR( spot_z[akt_spot]) )
  #  UO.WaitTargetTile(spot_type[akt_spot],spot_x[akt_spot],spot_y[akt_spot],spot_z[akt_spot])
    UO.Exec("waittargettile " + STR(spot_type[akt_spot]) + " " + STR(spot_x[akt_spot] ) + " " + STR( spot_y[akt_spot]) + " " + STR( spot_z[akt_spot]) )
    UO.UseType(mine_tool)
    remove_from_journal(mine_prompt)
   
    j = 0
    while j < 5000 AND NOT UO.InJournal(mine_prompt)
      wait(50)
      j = j + 50
    wend
   
    for j = 1 to ore_types
      remove_from_journal(mine_ore[j])
    next
    remove_from_journal(mine_fail)
    z = TRUE
    j = 0
    while z AND j < 5000 AND NOT UO.InJournal(mine_fail) AND NOT UO.InJournal(mine_stop)
      for i = 1 to ore_types
        if UO.InJournal(mine_ore[i]) then
          z = FALSE
        endif
      next
      j = j + 100
      wait(100)
    wend
    if UO.InJournal(mine_stop) then
      wait(action_delay)
    endif
   
  wend
  if UO.Weight > 370 then
   
# recall

    while UO.GetX('self') <> home_x OR UO.GetY('self') <> home_y
      recaluj(home_rb,home_rune)
      wait(5000)
    wend
   
# przerzucenie rudy
    while UO.Count(ruda) > 0
      wait(action_delay)
      UO.FindType(ruda)
      # na wypadek jakby sie poruszylo przez te 650ms
      if UO.Count(ruda) > 0 then
        UO.MoveItem('finditem',-1,ore_cont)
      endif
    wend
#skoro w domciu to sprawdzamy regi
 
  uzupelnij(reg_bm,20,50,ore_cont)
  uzupelnij(reg_bp,20,50,ore_cont)
  uzupelnij(reg_mr,20,50,ore_cont)
  uzupelnij(mine_tool,2,2,ore_cont)


  endif
  akt_spot = akt_spot + 1
  if akt_spot > max_spots then
    akt_spot = 1
  endif
wend

end sub


Well next thing. Thats a bad one. You have to own file. Mysterious file with some mysterious numbers. Ok. Ive made macro to record it. Its shitty u have to record it smoothly. Start it. It will recall to first rune from ur runebook. Click 4 tiles around u where u want to mine. Then wait. It should recall to next rune. Repeat for whole runebook.

Code:
#
# (c) ziemniaq - ziemni@risp.pl
#
sub rec()

 var mine_rb = 0x400F1322
 var ile_run = 16
 var akt_runa = 1
 var my_x
 var my_y
  var f = file("6.cfg")
 
  UO.Exec("set injectecho 1")
 
  if NOT f.open() then
    if NOT f.create() then
       return FALSE
    endif
  endif
 
  var i = 1
  var last

# zerowac lasttile !

  last = UO.LastTile()



while akt_runa < ile_run + 1
  UO.Print("Dupa")
  my_x = UO.GetX('self')
  my_y = UO.GetY('self')
 recaluj(mine_rb,akt_runa) 
 wait(3000)
i = 1 
while i < 5
     
      UO.InfoTile()
     
      while UO.LastTile() == last
        wait(10)
      wend
     
      last = UO.LastTile()
     
      UO.Print("Last tile : "  + STR(last))

     f.Write(STR(akt_runa) + " " + STR(UO.GetX('self')) + " " + STR(UO.GetY('self')) + " ")
       f.WriteLn(last)
      i = i + 1
wend

akt_runa = akt_runa + 1
wend
  f.close()
end sub


Forgotten: two subs u need... one for recalling to rune number x from runebook, second to stock (its described in other topic with magery trainer)

Code:
#
# (c) ziemniaq - ziemni@risp.pl
#
sub recaluj(runebook, runa)
  UO.Exec("recall " + STR(runebook) + " " + STR(( runa -1 )* 6 + 5))
end sub

sub uzupelnij(objtype, min_qty, do_ilu, container)
var i
var action_delay = 650
var old_qty
var grab_qty
while UO.Count(objtype) < min_qty
  UO.UseObject(container)
  while STR(container) <> STR(UO.GetSerial('lastcontainer'))
   
    i = 0
    while i < 3500 AND NOT STR(container) == STR(UO.GetSerial('lastcontainer'))
      i = i + 100
      wait(100)
    wend
   if STR(container) <> STR(UO.GetSerial('lastcontainer')) then
      UO.UseObject(container)
   endif
  wend

  wait(action_delay)
 
   old_qty = UO.Count(objtype)
  UO.FindType(objtype,"-1",container)
    if UO.FindCount() > 0 then
    grab_qty = do_ilu - old_qty
#      UO.MoveItem('finditem', grab_qty, 'backpack')
#UO.Grab(do_ilu - old_qty,'finditem')
    UO.Exec("grab " + STR(grab_qty) + " finditem" )
      i = 0
      while i < 1500 AND NOT UO.Count(objtype) == old_qty
        i = i + 100
        wait(100)
      wend
      wait(action_delay)
    endif
    UO.Print("po wszystkim")
wend
end sub


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:  
Powered by phpBB® Forum Software © phpBB Limited