Приветики, посмотрите сюда пожалуйста...

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
Kitten
Posts: 40
Joined: 2007-10-20 07:45:56

Приветики, посмотрите сюда пожалуйста...

Post by Kitten »

Добрый вечер! Играю на Утопии.
Вобщем есть скрипт на ламер, раньше работал идеально, теперь при выборе деревьев вручную (чтобы потом автомтически бегал), доходя до 4-7 дерева пишет "Unhandled exception in parser.". Помогите пожалуйтса, не пойму в чем дело. Дэдвуды убрала, чтоб не собирал их.

Code: Select all

################## 
### Переменные ###
##################
###################################################################################################
var f=file("C:\trees3.dat") ## - Путь к файлу в котором будут хранится координаты деревьев.
###
var TryHiding=0 ## 1 - Перед тем как рубить дерево, будет пытаться уйти в хайд, 0 - не будет .
###
var LogsQty=300 ## - Количество логов, добыв которое надо ,бежать домой, выкладывать в прилоченную кучку.
###
var GetFromFile=0 ## 1 - Координаты деревьев будут считыватся из файла, 0 - собиратся из клиента, то есть нужно будет промаркать самому, тыкнув топором.
### (сначала соберите а потом считывайте из файла).
var Reconnect=0 ## 1 - Включить реконнект на сервер если выкинет, 0 - отключить реконнект.
###########
### Код ###
###########
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 LogsTile
var Kucha_deadwoodX,Kucha_deadwoodY
var flag=0,treeCount=0,clicks=0,flag2=0
var Axe="0x0F43"
var Kucha_LogX=199 #Координаты прилоченной кучи
var Kucha_LogY=1391 #Координаты прилоченной кучи


########################
### Графика деревьев ###
########################
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")


if Reconnect==1 then
uo.Exec('exec Reconnect')
end if
#####################################
### Загружаем координаты из файла ###
#####################################
if GetFromFile==1 then
uo.Print('Load data from file...')
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()
else
######################################
### Собираем координаты из клиента ###
######################################
uo.Print('Select Pickaxe: ')
uo.Exec('addobject Pickaxe')
while uo.Targeting()
wait(100)
wend
uo.Print('Manual take coord...')
repeat
clicks=0
flag=0
uo.DeleteJournal()
#######################
### Кликаем на тайл ###
#######################
uo.UseObject('Pickaxe')
waitForTarget()
uo.DeleteJournal()
WaitForTryRock()
###############################
### Проверяем дерево ли это ###
###############################
flag=0
for k=0 to 40
if uo.LastTile(0)==TreeTile[k]+1 then
flag=2
end if
next
if flag==0 then
for k=0 to 40
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('Tree found '+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('Tree found '+str(treeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2)))
end if
end if
until (Flag==3) or (treeCount==25)
uo.Exec("filterspeech off")
uo.Print('Analize finished, coord save to file C:\trees3.dat')
SaveToFile(treeCount,TreeX,TreeY,TreeT)
end if
uo.Print('Tree found: '+str(treeCount))
wait(2000)
######################################
### Ходим по собранным координатам ###
######################################
while 1==1
if treeCount>0 then
for i=1 to treeCount
######################################
###Выкладываем логи
    if uo.Count('0x1BDD','0x0000')>LogsQty then   
     flag=GotoXY(Kucha_LogX,Kucha_LogY)
      if flag==1 then
   uo.FindType(0x1BDD)
   if uo.GetQuantity('finditem')>0 then
        ProDrop('0x1BDD','0x0000')
         wait(500)
      end if
###Конец (Выкладываем логи)
###Выкладываем дедвуды
   uo.FindType(0x0F90)
   if uo.GetQuantity('finditem')>0 then
        ProDrop('0x0F90','0x0000')
         wait(500)
      end if
###Конец (Выкладываем дедвуды)
    end if
    goto prod
    else
    prod:
######################################
uo.Print('Go to tree '+str(i)+': x='+str(TreeX[i])+' y='+str(TreeY[i]))
InfoLogs()
InfoLogs_deadwood()
flag=GotoXY(TreeX[i],TreeY[i])
if flag==1 then
if TryHiding==1 then
ToHide()
end if
GetTree(str(TreeT[i]),str(TreeX[i]),str(TreeY[i]),str(uo.GetZ()))
end if
next
end if
wend
end sub

sub alarm()
repeat
if UO.InJournal('attacking') then
UO.deletejournal()
uo.playwav("C:\WINDOWS\Media\TC Delete Complete.wav")
wait(3000)
endif
wait(10000)
until 1==0
end sub

sub ProDrop(T,C)
UO.FindType(T,C,'backpack')
Var b = UO.GetSerial("finditem")
UO.FindType(T,C,'ground')
Var g = UO.GetSerial("finditem")
UO.MoveItem(b, "0", g,str(uo.getx(g)),str(uo.gety(g)),"0")
Wait(500)
If Uo.Count(T,C) > 0 Then
Clear(T,C)
endIF
end sub

sub Clear(T,C)
Var Count = UO.Count(T,C)
UO.FindType(T,C,'backpack')
Var b = UO.GetSerial("finditem")
UO.FindType(T,C,'ground')
Var g = UO.GetSerial("finditem")
Wait(500)
UO.MoveItem(b, "0", g,str(uo.getx(g)),str(uo.gety(g)),"0")
Wait(500)
If UO.Count(T,C) == Count Then
 If (UO.Count('finditem')+Count) < 60000 Then
  uo.ignore('finditem')
  ProDrop(T,C)
endIf
endIf
end sub

sub GetTree(Type,X,Y,Z)
var LastTimer
uo.Print('Begin...')
uo.DeleteJournal()
uo.WaitTargetTile(Type,X,Y,Z)
#uo.UseObject('0x0F43')
uo.UseType('0x0F43')
wait(1000)
uo.say(".macro on")
wait(200)
LastTimer=uo.Timer()
while WaitForChange(LastTimer)==0
wait(200)
wend
return 1
#end if
#return 0
end sub

sub WaitForChange(Timer)
var Text1="There's not enough wood here to chop." #нету дерева !
var Text2="That is too far away"
var Text3="There's not enough wood here to chop"
var mess
mess=uo.Journal(0)
#uo.print(mess)
if uo.inJournal("There's not enough wood here to chop") or uo.inJournal("That is too far away") or (uo.Timer()>Timer+5000) then
uo.print('Tree is free')
return 1
end if
if mess[0]=='Y' and mess[1]=='o' and mess[2]=='u' then
return 0
uo.print('Tree is full')
end if
wait(50)
return 0
end sub

sub ToHide()
while not uo.Hidden()
uo.Print('Trying Hide...')
uo.DeleteJournal()
uo.UseSkill('Stealth')
wait(6000)
wend
wait(100)
end sub

sub WaitForHide()
var Text1=uo.GetName()+": You have hidden yourself well"
var Text2=uo.GetName()+": You can't seem to hide here."
var mess
for var i=0 to 200
mess=uo.Journal(0)
if uo.Journal(0)==Text1 then
return 1
end if
if uo.Journal(0)==Text2 then
return 0
end if
wait(50)
next
return 0
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 50
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("C:\trees3.dat")
var s=0,i=0
f.open()
f.create()
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()
end sub

sub InfoLogs()
uo.Print(str(uo.Count('0x1BDD'))+' logs in beg ')
uo.Print(str(uo.Count('0x1BDD','0x0000'))+' simply ' +str(uo.Count('0x1BDD')-uo.Count('0x1BDD','0x0000'))+' colored')
end sub
sub InfoLogs_deadwood()
uo.Print(str(uo.Count('0x0F90'))+' logs in beg ')
uo.Print(str(uo.Count('0x0F90','0x0044'))+' simply ' +str(uo.Count('0x0F90')-uo.Count('0x0F90','0x0044'))+' colored')
end sub

sub Reconnect()
var ReconnectTime,rFlag
ReconnectTime='0'
rFlag=1
repeat
while (uo.ObjAtLayer('Bpack')=='')
if rFlag then
ReconnectTime=MakeTime()
rFlag=0
end if
wait(20000)
uo.Say('')
wait(3000)
uo.Say('')
wait(3000)
uo.Say('')
wait(3000)
uo.LDblClick(357,164)
uo.LClick(616,459)
wait(3000)
wend
wait(3000)
if (rFlag==0) and (ReconnectTime<>'0') then
uo.TextOpen()
uo.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
rFlag=1
ReconnectTime='0'
end if
until false
end sub

sub MakeTime()
var d,t,ret,i
ret=str(uo.Time())
t=""
for i=0 to Len(ret)
t=ret[Len(ret)-i]+t
if (i==2) or (i==4) then
t=":"+t
end if
next
ret=str(uo.Date())
d=""
for i=0 to Len(ret)
d=ret[Len(ret)-i] + d
if (i==2) or (i==4) then
d="."+d
end if
next
ret=t+" @ "+d
return ret
end sub

sub Terminate()
uo.Print('All function terminated!')
uo.DeleteJournal()
uo.Exec('terminate all')
wait(100)
uo.Exec('terminate all')
wait(100)
uo.Exec('terminate all')
wait(100)
end sub

sub CheckLag()
if uo.Waiting()>0 then
uo.Exec('canceltarget')
end if
uo.DeleteJournal()
uo.Click('backpack')
repeat
wait(50)
until uo.InJournal('backpack')
#BETEP™#
end sub

sub all()
uo.Exec('terminate all')
end sub



#############################################
sub SlimeKill()
repeat
If uo.injournal('attacking you') Then
uo.deletejournal()
uo.exec('terminate Lumberjacking')
uo.warmode(1)
If uo.injournal('a corpse') Then
uo.deletejournal()
wait(5000)
Lumberjacking()
endif
wait(1000)
Until 0==1
Yura
Posts: 71
Joined: 2008-03-03 09:19:21
Location: SPB

Post by Yura »

Code: Select all

############################### 
### Проверяем дерево ли это ###
###############################
flag=0
for k=0 to 40

40 тут быть не должно.. 28 надо
и ниже такой-же цикл...

PS
Если что то меняеш, то лучше сохраняй предыдущую версию скрипта
Kitten
Posts: 40
Joined: 2007-10-20 07:45:56

Post by Kitten »

Yura wrote:40 тут быть не должно.. 28 надо
и ниже такой-же цикл...
PS
Если что то меняеш, то лучше сохраняй предыдущую версию скрипта

спасибо, я попробую, а бэкап пропал с флешкой вместе, вытащили в трамвае +(

Code: Select all

############################### 
### Проверяем дерево ли это ###
###############################
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 40
if uo.LastTile(0)==TreeTile[k] then

а вот тут должно быть 40?
Yura
Posts: 71
Joined: 2008-03-03 09:19:21
Location: SPB

Post by Yura »

viewtopic.php?t=2901
где-то тут лежит оригинал скрипта.... сравни или скачай заново
Kitten
Posts: 40
Joined: 2007-10-20 07:45:56

Post by Kitten »

Yura wrote:https://yoko.uokit.com/viewtopic.php?t=2901
где-то тут лежит оригинал скрипта.... сравни или скачай заново

так поменяла 40 на 28, то же самое +(
там есть похожие, но у них реколл, а как переделать на то чтоб рядом с домом рубил и в прилоканную кучку скидывал не знаю +(
Yura
Posts: 71
Joined: 2008-03-03 09:19:21
Location: SPB

Post by Yura »

В обоих циклах?

Code: Select all

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
Kitten
Posts: 40
Joined: 2007-10-20 07:45:56

Post by Kitten »

Yura wrote:В обоих циклах?

ну да
щас нашла что то старенькое, попробую запустить
да и что то я не могу найти в режиме Manual take coords, количество деревьев где менять О_о
тут? где "to 40" ?

Code: Select all

sub WaitForTarget() 
for var i=0 to 40
if uo.Targeting()==1 then
return 1
end if
wait(200)
next
return 0
end sub
Yura
Posts: 71
Joined: 2008-03-03 09:19:21
Location: SPB

Post by Yura »

в данном скрипте ограничено количество деревьев до 25

Code: Select all

until (Flag==3) or (treeCount==25)


надо больше - изменяй, или вообще удали второе условие
Yura
Posts: 71
Joined: 2008-03-03 09:19:21
Location: SPB

Post by Yura »

Kitten wrote:
Yura wrote:В обоих циклах?

ну да
щас нашла что то старенькое, попробую запустить
да и что то я не могу найти в режиме Manual take coords, количество деревьев где менять О_о
тут? где "to 40" ?

Code: Select all

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


не... тут ненадо
Kitten
Posts: 40
Joined: 2007-10-20 07:45:56

Post by Kitten »

Ребят, спасибо большое, нашла старый скрипт, все работает без нареканий.
Спасибо за отзывчивость :wink:
Post Reply