чутка поправить надо...

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
Lumberjacker
Posts: 16
Joined: 2009-01-14 23:34:57

чутка поправить надо...

Post by Lumberjacker »

Вот скрипт на лумбер:

Code: Select all

sub CheckLag() 
   UO.DeleteJournal()
   UO.Click('backpack')

   repeat
      wait(500)
   until UO.InJournal('backpack')
end sub

################################################################################
###################
var OreQty=400 ## - Ставим Макс Количество Веса при Разгрузке
###
var Axe='0x400052F9' ## - Ставим айди Тапора
###
var RuneToHome='0x40012EEE' ## - Стави айди руны дамой к Сундуку
###
var RuneToTrees='0x400167DC' ## - Ставим айди руны в Лес
###
var Treesfile = "D:\Games\ultima online\Inject\Script\trees1.dat" ## - Путь и файл в котором будут хранится координаты деревьев.
###
var MaxTreesCount =300 ## Количество деревьев для марка...
###
var TryHiding=1 ## 1 - Перед тем как рубить дерево, будет пытаться уйти в хайд, 0 - не будет .
###
var GetFromFile=1 ## 1 - Координаты деревьев будут считыватся из файла, 0 - собиратся из клиента
### (сначала соберите а потом считывайте из файла).
###
var EatingFood=0 ## 1 - Будем есть, 0 - нет. 
###
var TypeFood='0x097B' ## - Тип еды которую будем кушать. (сейчас фиштейки)
###
var Chest='0x40019D02' ## - ID сундука куда будут выгружаться логи.
###
var oldX,oldY,time ## - Для рекола.
###
###########
### Код ###
###########
var f=file(Treesfile)
sub Lumberjacking()
var i=0,j=0,k=0,r=0,q=0,ii,jj
var TopX=324,TopY=65
dim TreeX[5000], TreeY[5000],TreeT[5000]
dim TreeTile[29]
var flag=0,treeCount=0,clicks=0,flag2=0
########################
### Графика деревьев ###
########################
TreeTile[0]=3277
TreeTile[1]=3280
TreeTile[2]=3283
TreeTile[3]=3286
TreeTile[4]=3289
TreeTile[5]=3291
TreeTile[6]=3294
TreeTile[7]=3296
TreeTile[8]=3299
TreeTile[9]=3302
TreeTile[10]=3393
TreeTile[11]=3394
TreeTile[12]=3395
TreeTile[13]=3396
TreeTile[14]=3415
TreeTile[15]=3416
TreeTile[16]=3417
TreeTile[17]=3418
TreeTile[18]=3419
TreeTile[19]=3438
TreeTile[20]=3439
TreeTile[21]=3440
TreeTile[22]=3441
TreeTile[23]=3442
TreeTile[24]=3460
TreeTile[25]=3461
TreeTile[26]=3462
TreeTile[27]=3290
TreeTile[28]=3288

uo.Exec("filterspeech on")
uo.Exec("filterspeech add 'Where do you want to use the pickaxe?'")
#####################################
### Загружаем координаты из файла ###
#####################################
if GetFromFile==1 then
uo.Print('Загружаем координаты из файла...')
f.open()
treeCount=safe call f.ReadNumber()
for i=1 to treeCount
TreeT[i]=safe call f.ReadNumber()
TreeX[i]=safe call f.ReadNumber()
TreeY[i]=safe call f.ReadNumber()
next
f.close()
repeat
  UO.DeleteJournal()
  UO.waittargetobject('les')
  UO.Cast("Recall")
  oldX=UO.GetX()
  oldY=UO.GetY()
  while not UO.InJournal("The spell fizzle") and oldX == UO.GetX() and oldY == UO.GetY()
    Wait(100)
  wend
Until not UO.InJournal("The spell fizzle")
else
######################################
### Собираем координаты из клиента ###
######################################
uo.Print('Выбери Кирку: ')
uo.Exec('addobject Pickaxe')
while uo.Targeting()
wait(100)
wend
uo.Print('мутим чо вырубить на вечер...')
repeat
clicks=0
flag=0
uo.DeleteJournal()
#######################
### Кликаем на тайл ###
#######################
uo.UseObject('Pickaxe')
waitForTarget()
uo.DeleteJournal()
WaitForTryRock()
###############################
### Проверяем дерево ли это ###
###############################
flag=0
for k=0 to 28
if uo.LastTile(0)==TreeTile[k]+1 then
flag=2
end if
next
if flag==0 then
for k=0 to 28
if uo.LastTile(0)==TreeTile[k] then
flag=1
end if
next
end if
if uo.Lasttile(1)==uo.getX() and uo.Lasttile(2)==uo.gety() then
flag=3
end if
#########################
### Кликнули на ствол ###
#########################
if flag==1 then
flag2=0
if treeCount>0 then
for ii=1 to treeCount
if TreeX[ii]==uo.LastTile(1) and TreeY[ii]==uo.LastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
treeCount=treeCount+1
TreeX[treeCount]=uo.LastTile(1)
TreeY[treeCount]=uo.LastTile(2)
TreeT[treeCount]=uo.LastTile(0)
uo.Print('Найдено дерево '+str(treeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2))+' '+str(treeCount))
end if
end if
##########################
### Кликнули по листве ###
##########################
if flag==2 then
flag2=0
if treeCount>0 then
for ii=1 to treeCount
if TreeX[ii]==uo.LastTile(1) and TreeY[ii]==uo.LastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
treeCount=treeCount+1
TreeX[treeCount]=uo.LastTile(1)
TreeY[treeCount]=uo.LastTile(2)
TreeT[treeCount]=uo.LastTile(0)-1
uo.print('Найдено дерево '+str(treeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2)))
end if
end if
until (Flag==3) or (treeCount==MaxTreesCount)
uo.Print('Анализ закончен.')
uo.Exec("filterspeech off")
SaveToFile(treeCount,TreeX,TreeY,TreeT)
end if
uo.Print('Деревьев найдено: '+str(treeCount))
wait(2000)
######################################
### Ходим по собранным координатам ###
######################################
while 1==1
if treeCount>0 then
for i=1 to treeCount
end if
If UO.weight >= 400 Then
repeat
  UO.DeleteJournal()
  UO.waittargetobject('home')
  UO.Cast("Recall")
  oldX=UO.GetX()
  oldY=UO.GetY()
  while not UO.InJournal("The spell fizzle") and oldX == UO.GetX() and oldY == UO.GetY()
    Wait(100)
  wend
Until not UO.InJournal("The spell fizzle")
   DropLogs()
repeat
  UO.DeleteJournal()
  UO.waittargetobject('les')
  UO.Cast("Recall")
  oldX=UO.GetX()
  oldY=UO.GetY()
  while not UO.InJournal("The spell fizzle") and oldX == UO.GetX() and oldY == UO.GetY()
    Wait(100)
  wend
Until not UO.InJournal("The spell fizzle")
end if
uo.Print('Go to Tree '+str(i)+': x='+str(TreeX[i])+' y='+str(TreeY[i]))
InfoLogs()
flag=GotoXY(TreeX[i],TreeY[i])
if flag==1 then
   if TryHiding==1 then
      ToHide()
   endif
   GetTree(str(TreeT[i]),str(TreeX[i]),str(TreeY[i]),str(uo.GetZ()))
endif
next
endif
wend
end sub

Sub GetTree(Type,X,Y,Z)
var i
UO.Print('Ha4iHaem Py6Ky DePeBa...')
wait (100)
CheckLag()
UO.Warmode()
repeat
  UO.DeleteJournal()
    UO.WaitTargetTile(Type,X,Y,Z)
  UO.UseObject('0x400052F9')
     Wait(100)
  while not UO.InJournal("You put the ") and not UO.InJournal('There are no logs left here to chop.') and not UO.InJournal('It appears immune to your blow') and not UO.InJournal('You hack at the tree for a while, ') and not UO.InJournal("You can't reach this") and not UO.InJournal("That's too far away to chop.")
     Wait(1200)
  wend
Until UO.InJournal('There are no logs left here to chop.') or UO.InJournal('It appears immune to your blow') or UO.InJournal("You can't reach this") or UO.InJournal("That's too far away to chop.")
return 0
end sub

Sub ToHide()
while not UO.Hidden()
  UO.Print('Пытаемся уйти в хайд...')
  UO.DeleteJournal()
  UO.WarMode(0)
  UO.UseSkill('Stealth')
  while not UO.InJournal("You have hidden yourself well") and not UO.InJournal("You can't seem to hide here.") 
   Wait(100)
  wend
wend
wait(100)
end sub


Sub WaitForTryRock()
var Text1="That is too far away."
var Text2="Try mining in rock."
var Text3="There is no ore here to mine."
var Text4="You have no line of sight to that location"
var Text5="You can't see the target"
for var i=0 to 10
if uo.Journal(0)==Text1 or uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 or uo.Journal(0)==Text5 then
return 1
end if
wait(200)
next
return 0
end sub

Sub WaitForTarget()
for var i=0 to 50
if uo.Targeting()==1 then
return 1
end if
wait(200)
next
return 0
end sub

Sub WaitForChangeXY(myX,myY,lastX,lastY)
for var i=1 to 50
if lastX<>myX or lastY<>myY then
return 1
end if
wait(200)
next
return 0
end sub

Sub GotoXY(x,y)
var myX,myY,lastX=0,lastY=0,i,halt=0,z,r=0
for i=1 to 60
myX=uo.getX();
myY=uo.getY();
if LastX==myX and LastY==myY then
halt=halt+1
else
halt=0
end if
if halt>=10 then
if uo.GetDir()==1 then
for z=0 to 8
uo.Press(40)
next
end if
if uo.GetDir()==3 then
for z=0 to 8
uo.Press(37)
next
end if
if uo.GetDir()==5 then
for z=0 to 8
uo.Press(38)
next
end if
if uo.GetDir()==7 then
for z=0 to 8
uo.Press(39)
next
end if
halt=15
end if
if Numb(x-myX)<=1 and Numb(y-myY)<=2 then
return 1
end if
if x<=myX then
if y<=myY then
for z=0 to 3
uo.Press(38)
next
else
for z=0 to 3
uo.Press(37)
next
end if
else
if y<=myY then
for z=0 to 3
uo.Press(39)
next
else
for z=0 to 3
uo.Press(40)
next
end if
end if
lastX=myX
lastY=myY
wait(200)
next
return 0
end sub

Sub Numb(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub

Sub SaveToFile(treeCount,TreeX,TreeY,TreeT)
var f=file(Treesfile)
var s=0,i=0
f.open()
f.create()
uo.Print('Сохранение в файл: '+TreesFile)
s=safe call f.writeln(treeCount)
for i=1 to treeCount
   s=safe call f.writeln(str(TreeT[i])+' '+str(TreeX[i])+' '+str(TreeY[i]))
next
f.close()
uo.Print('Координаты деревьев записаны в файл: '+Treesfile)
end sub

sub DropLogs()
if uo.Waiting() then
   uo.CancelTarget()
endif
uo.Print('Скидываем товар.')
uo.SetReceivingContainer(Chest)
wait(100)
repeat
  UO.FindType('0x1BDD','-1','my')
  Wait(1200)
  if UO.GetQuantity('finditem') > 0 then
     UO.Grab('0','finditem')
  endif
  Wait(100)
until not UO.Count('0x1BDD')
uo.Print('Товар на месте.')

if EatingFood==1 then
   EatFood()
endif

uo.UnSetReceivingContainer(Chest)
end sub


Sub InfoLogs()
uo.Print('У вас всего '+str(uo.Count('0x1BDD'))+' логов в сумке')
uo.Print('Из них '+str(uo.Count('0x1BDD','0x0000'))+' простых и ' +str(uo.Count('0x1BDD')-uo.Count('0x1BDD','0x0000'))+' цветных')
end sub

sub Open(Container)
    UO.DeleteJournal()
    UO.UseObject(Container)
   repeat
    wait(100)
   Until UO.InJournal('Contains')
endsub

Sub EatFood()
if UO.Waiting() then
   UO.CancelTarget()
endif
uo.SetReceivingContainer('backpack')
Open(Chest)
UO.FindType(TypeFood,'-1',Chest)
UO.Grab('100','finditem')
wait(500)
repeat
UO.UseType(TypeFood)
wait(500)
until uo.InJournal('You are simply too full to eat any more!')
UO.SetReceivingContainer(Chest)
wait(500)
UO.FindType(TypeFood)
if UO.GetQuantity('finditem') > 0 then
   UO.Grab('0','finditem')
endif
UO.UnSetReceivingContainer(Chest)
end sub

sub AttackEnts()
uo.DeleteJournal()
var Enemy='0x00000000'
repeat
if uo.InJournal('attacking you') or uo.InJournal('Vas Corp Por') or uo.InJournal('In Ex Grav') or uo.InJournal('In Sanct Ylem') or uo.InJournal('In Por Ylem') or uo.InJournal('Kal Vas Flam') or uo.InJournal('Por Ort Grav') or uo.InJournal('An Mani') or uo.InJournal('An Ex Por') or uo.InJournal('Wis Quas') or uo.life < uo.str then
uo.Exec('terminate Lumberjacking') 
Enemy=uo.JournalSerial(uo.InJournal('is attacking you')-1)
uo.DeleteJournal()
RecallAtAttack()
end if
wait(1000)
until false
end sub



sub RecallAtAttack()
var mX,mY
reccal:
uo.DeleteJournal()
if uo.Waiting() then
uo.CancelTarget()
end if
mX=uo.getX("self")
mY=uo.getY("self")
uo.DeleteJournal()
UO.UseType( '0x0F06' )
uo.waittargetobject('home')
UO.UseType( '0x1F4C' )
uo.Print('Fucking hippies')
wait(3000)
if not uo.getX("self")<>mX and not uo.getY("self")<>mY then
goto reccal
end if
uo.Print('Yea baby')
Wait(5000)
Terminate()
end sub

Sub Terminate()
UO.Print("Mining script: Off!")
UO.DeleteJournal()
UO.Exec('terminate all')
wait(100)
UO.Exec('terminate all')
wait(100)
UO.Exec('terminate all')
wait(100)
End sub
[/code]

Проблемка в том , что скрипт время от времени циклит. Чар начинает нон стопом пытаться вырубить одно и то же дерево. Там на весь экран надпись вылезает что он рубит но ничего не удалось вырубить (...any usable wood) и так до тех пор пока его в ручную не отведешь от дерева. Как сделать проверку чтобы если его зациклит он шел дальше по координатам к следущему дереву?
И еще там побег сделан если он видит что его кто-то атачит, это не ахти. Я нашел скрипт "побег при появлении кого-либо". Подскажите как заменить процедуру побега.

Code: Select all

sub Recall() 
var rune = ' ID of your rune '
var player
uo.Set('finddistance','15')
var i
  DIM people[2]
 
  people[0]='0x0190' ; Тип male
  people[1]='0x0191' ; Тип female

  uo.Ignore('self')
  for i = 0 to 1
    uo.FindType(people[i],'-1','ground')
    player = uo.GetSerial('finditem')
    wait(500)
    if uo.FindCount() then
      uo.WaitTargetObject(rune)
      uo.Cast('Recall')
    else
      uo.Print('No one has been found ')
    end if
  next
  uo.IgnoreReset()
end sub


И если тут заменить uo.Cast('Recall') на uo.usetype("тайп скролла реколл") он будет работать со скроллом? Я просто не охти в скриптах так бы сам сделал :cry:
GwinPin
Posts: 3
Joined: 2009-03-30 11:09:09

Post by GwinPin »

Найди в том скрипте, что ты выложил, функцию GetTree() и замени на мой вариант. После 5 неудачных срубов с дерева - пойдёт к другому.

Code: Select all

Sub GetTree(Type,X,Y,Z) 
var i, counter
UO.Print('Ha4iHaem Py6Ky DePeBa...')
wait (100)
CheckLag()
UO.Warmode()
counter=0
repeat
  UO.DeleteJournal()
    UO.WaitTargetTile(Type,X,Y,Z)
  UO.UseObject('0x4001E318')
     Wait(100)
  while not UO.InJournal("You put the ") and not UO.InJournal('There are no logs left here to chop.') and not UO.InJournal('It appears immune to your blow') and not UO.InJournal('You hack at the tree for a while, ') and not UO.InJournal("You can't reach this") and not UO.InJournal("That's too far away to chop.")
     Wait(1500)
     If uo.InJournal("You hack at") then
     counter=counter+1
     endif
  wend
Until UO.InJournal('There are no logs left here to chop.') or UO.InJournal('It appears immune to your blow') or UO.InJournal("You can't reach this") or UO.InJournal("That's too far away to chop.") or counter==5
return 0
end sub
Post Reply