Значит так... Не стоит размножать топики со своим скриптом, вполне возможно было написать, что возникла ошибка line 619 и сюда (и не надо делать репли со всем скриптом (очень трудно читать такие сообщения))
А теперь по существу. Я говорил, что разбераться со скриптом мне не интересно - это действительно так, но меня задела ошибка (так как об этой ошибке ты не говорил до моего изменения) на строке 619. (Как указал в соседнем топие Millerbear - все дело в ходилке.) Может быть быть все из-за моих дополнений? Поэтому добавил свою модифицированную ходилку Revenant'а (координаты пути к ресу взял из соседнего топика, так что надо только тестить, ходилка включается только когда надо идти ресаться, но она без обхода препятстий (надеюсь на пути препятствий нет)). Если скрипт опять будет выдавать ошибку на строках от 510 до 630, то это уже точно касается ходилки gotoxy(), а пока попробуй так:
Code: Select all
# 1. Добавлил функция разметки от банка к месту реса - MarkWay.
# Эта функция выполняется один раз, после чего необходимо внести
# изменения в процедуре GoToResurrect. (все это делается в редакторе инжи)
# Сохраняешь изменения и забываешь про эту разметку навсегда.
# Вопрос: Почему разметку надо делать начиная у банка?
# Ответ: Потому что такова логика твоего скрипта. Живой чар или
# мертвый после добычи руды он все равно идет к банку.
# 2. Если интересно, то посмотри внимательно весь скрипт, я оставил
# немного комментариев.
# 3. Если скрипт работать не будет, не обессудь, дальше разбирать с
# данным скриптом интереса нет, так как ему необходима глобальная
# переделка.
VAR BagInBank = '0x4009D5EC' #<<< ID мешка с реагентами, лежащего в банке.
sub Vertijok()
UO.Print("!!Viberi kirku!!")
UO.Exec('addobject Shovel')
While UO.targeting()
Wait(3000)
Wend
uo.print('!!Viberi runu damoi!! ')
uo.exec('addobject runeHome')
while uo.targeting()
wait(15000)
wend
#######################################
uo.print('!!Viberi sunduk s regami!! ')
uo.exec('addobject Sunduk')
while uo.targeting()
wait(100)
wend
#######################################
uo.print('!!Viberi runu v saxtu!! ')
uo.exec('addobject runeCave')
while uo.targeting()
wait(100)
wend
#######################################
#GoToMine() #<<< Закоментировал. Больше не будет медитировать перед копкой.
#repeat #<<< нет until (поэтому закомментировал)
while not uo.dead()
GoToMine()
gotoxy(2562,491,0)
GetOre()
GoToHome()
GoToMine()
gotoxy(2558,497,0)
GetOre()
GoToHome()
GoToMine()
gotoxy(2560,493,0)
GetOre()
GoToHome()
GoToMine()
gotoxy(2563,488,0)
GetOre()
GoToHome()
GoToMine()
gotoxy(2565,483,0)
GetOre()
GoToHome()
GoToMine()
gotoxy(2570,480,0)
GetOre()
GoToHome()
GoToMine()
gotoxy(2575,477,0)
GetOre()
GoToHome()
GoToMine()
gotoxy(2578,480,0)
GetOre()
GoToHome()
GoToMine()
gotoxy(2573,483,0)
GetOre()
GoToHome()
GoToMine()
gotoxy(2570,486,0)
GetOre()
GoToHome()
wend
endsub
################################################################
sub GoToHome()
gotoxy(2566,481,0)
gotoxy(2558,505,0)
gotoxy(2552,505,0)
gotoxy(2552,501,0)
gotoxy(2525,501,0)
gotoxy(2525,515,0)
gotoxy(2507,515,0)
gotoxy(2507,542,0)
if UO.Dead() then #<<<
GoToResurrect() #<<< ДОБАВИЛ ВОЗРОЖДЕНИЕ.
endif #<<<
uo.say('bank')
wait(3000)
uo.waittargetobject('runeHome') ; домой
wait(500)
uo.cast('Recall')
wait(3000)
loot()
wait(3000)
#reccal: #<<< а это к чему? и почему эта метка находится здесь?
uo.deletejournal()
if uo.waiting() then
uo.canceltarget()
endif
endsub
################################################################
Sub GoToMine()
med()
regi()
wait(500)
uo.waittargetobject('runeCave') ; V saxtu
uo.cast('Recall')
#goto reccal #<<< goto ссылается на метку в другой процедуре???
#endif #<<< а где if ... then ?
wait(5000)
gotoxy(2558,497,0)
endsub
################################################################
sub Start()
If UO.GetGlobal('MiningCheck')=='on' Then
UO.SetGlobal('MiningCheck','on')
UO.Exec('Exec Terminate')
Else
UO.Exec('Exec Select')
UO.SetGlobal('MiningCheck','on')
EndIf
endsub
##############################
### Копаем руду возле себя ###
##############################
Sub GetOre()
var mx, my, mz, i, j, CheckTime, CheckLag=0
###
var Wait_1 = "You put"
var Wait_2 = "heavy"
var Wait_3 = "Это слишком далеко отсюда."
var Wait_4 = "Тут не осталось руды."
var Wait_5 = "but fail"
var Wait_6 = "Туда Вам не дотянуться"
var Wait_7 = "in rock"
var Wait_8 = "You have found some"
###
var Fizzle_1 = "Тут не осталось руды."
var Fizzle_2 = "Это слишком далеко отсюда."
var Fizzle_3 = "Туда Вам не дотянуться"
var Fizzle_4 = "in rock"
###
mx = UO.GetX('self')
my = UO.GetY('self')
mz = UO.GetZ('self')
For i = mx-3 TO mx+3
For j = my-3 TO my+3
Hide()
UO.Print("Get Coordinate: "+str(mx-i)+" "+str(my-j))
REPEAT
CheckLag = CheckLag+1
#EndIf #<<< где if ... then ?
Hide()
If UO.Waiting() Then
UO.Targeting()
EndIf
UO.WaitTargeTtile('1341',str(i),str(j),str(mz))
UO.UseObject('Shovel')
CheckTime = UO.Timer()
UO.DeleteJournal()
REPEAT
Wait(300)
Until UO.InJournal(Wait_1) or UO.InJournal(Wait_2) or UO.InJournal(Wait_3) or UO.InJournal(Wait_4) or UO.InJournal(Wait_5) or UO.InJournal(Wait_6) or UO.InJournal(Wait_7) or UO.InJournal(Wait_8) or (CheckTime+150)<UO.Timer() or UO.Dead()
If UO.InJournal(Wait_8) Then
#смысл этой проверки?
EndIf
If CheckLag==10 Then
CheckLag = 0
Wait(9000)
EndIf
Until UO.InJournal(Fizzle_1) or UO.InJournal(Fizzle_2) or UO.InJournal(Fizzle_3) or UO.InJournal(Fizzle_4) or UO.Dead()
Next
Next
#REPEAT #<<< а это для чего?
endsub
######################################################################################
Sub loot()
hide()
uo.UseSkill('Stealth')
wait(3000)
begin:
if uo.waiting() then
uo.canceltarget()
endif
VAR a,Exit
VAR UnloadCont='0x412546E4' ; ID sunduka
DIM Ore[5]
Ore[0]=0x19B9 ; 4 and more ore
Ore[1]=0x19B7 ; 1 ore
Ore[2]=0x19BA ; 2 ore
Ore[3]=0x19B8 ; 3 ore
UO.SetReceivingContainer(UnloadCont)
wait(500)
For a=0 to 3
Exit=0
repeat
UO.FindType(Ore[a])
if UO.GetQuantity('finditem')>0 then
UO.Grab('0','finditem')
wait(1500)
Else
Exit=1
endif
until Exit==1
Next
UO.UnSetReceivingContainer()
uo.print('vigruzili vsiu rudu pora kopati dalise???')
endsub
#######################
### Прячимся в хайд ###
#######################
Sub hide()
while not UO.Hidden() and not UO.Dead()
UO.Warmode("0")
uo.print("Nikaimsia")
UO.UseSkill("Hiding")
wait(4000)
wend
endsub #<<<добавил, так как отсутствовало.
################################################################
################################################################
Sub med()
VAR LastTimer
UO.DeleteJournal()
while UO.Mana<UO.Int
LastTimer=UO.Timer()
UO.UseSkill('Meditation')
repeat
wait(100)
until UO.InJournal("You are") OR UO.InJournal("You lose") OR UO.Timer()>LastTimer+200
UO.DeleteJournal()
wait(200)
wend
endsub
################################################################
Sub regi()
VAR r, q, n, amount = 5
Dim reg[4]
reg[1] = '0x0F7A'
reg[2] = '0x0F7B'
reg[3] = '0x0F86'
reg[4] = '0x0E21'
For r = 1 to 4
if uo.count( reg[r] )<>amount then
q = amount - uo.count( reg[r] )
if q <> 0 then
if q > 0 then
uo.useobject("Sunduk")
wait(250)
uo.findtype( reg[r] , -1 ,"Sunduk")
If uo.findcount() == 0 then
uo.msg('Ia vzial regi!')
return
endif
uo.moveitem('finditem', STR(q) )
wait(1000)
else
q = q*-1
uo.findtype( reg[r] )
uo.moveitem('finditem', STR(q) ,"Sunduk")
wait(1000)
endif
endif
endif
next
While uo.Count('0x0F09','0x0060') < 2
uo.findtype('0x0F09','0x0060',"Sunduk")
if uo.FindCount() then
uo.moveitem('finditem')
checklag()
wait(1000)
endif
wend
uo.print('Vziali regi ...')
endsub
################################################################
Sub Kill()
var Count,LastTimer,Golem
var o,exit
dim Ore[13]
Ore[1]=0x19B9
Ore[2]=0x19B7
Ore[3]=0x19BA
Ore[4]=0x19B8
Ore[5]=0x0F11
Ore[6]=0x0F16
Ore[7]=0x0F18
Ore[8]=0x0F15
Ore[9]=0x0F10
Ore[10]=0x0F0F
Ore[11]=0x0F26
Ore[12]=0x1F4C
Ore[13]=0x0EED
hide()
while uo.STR<uo.Life+1
if uo.Mana>=50 then
uo.WaitMenu('What','Daemon')
uo.Cast('Polymorph')
wait(8000)
else
med()
wait(3000)
endif
wend
LastTimer=uo.Timer()
repeat
uo.BandageSelf()
wait(4000)
until uo.Life==uo.STR or LastTimer+300<uo.Timer()
uo.UseType('0x1B76') ## - Хеатер Щит(тип).
uo.DeleteJournal()
uo.Exec('warmode 1')
uo.FindType('0x0010',-1,'ground')
Elemental=uo.GetSerial('finditem')
uo.Attack(Golem)
repeat
wait(1000)
if uo.Life<50 Then
uo.Bandageself()
endif
if uo.GetDistance(Golem)>1 then
gotoxy(0,0,'finditem')
endif
until uo.IsNPC(Golem)==0
wait(3000)
uo.Exec('warmode 0')
wait(1000)
LastTimer=uo.Timer()
uo.DeleteJournal()
for o=1 to 13
exit=0
repeat
uo.FindType(Ore[o],-1,'ground')
if uo.GetQuantity('finditem')>0 then
uo.Grab('0','finditem')
wait(1500)
else
exit=1
endif
until exit==1
next
### uo.Exec('warmode 1')
uo.Exec('warmode 0')
uo.Exec('exec Mining')
endsub
####################################
### Смотрим скока накопали руды. ###
####################################
Sub InfoOre()
var i, ii, a, LogsTime=PrintTime()
Dim Ore[3]
Ore[0] = '0x19B9' ; 4 and more ore
Ore[1] = '0x19B8' ; 3 ore
Ore[2] = '0x19BA' ; 2 ore
Ore[3] = '0x19B7' ; 1 ore
Dim NameOre[13]
NameOre[0] = 'Iron'
NameOre[1] = 'Cooper'
NameOre[2] = 'Agapite'
NameOre[3] = 'Golden'
NameOre[4] = 'Orion'
NameOre[5] = 'Verite'
NameOre[6] = 'Dwarf'
NameOre[7] = 'Silver'
NameOre[8] = 'Shadow'
NameOre[9] = 'Valorite'
NameOre[10] = 'Crystal'
NameOre[11] = 'Magma'
NameOre[12] = 'Obsidian'
NameOre[13] = 'Mytheril'
Dim ColorOre[13]
ColorOre[0] = '0x0000'
ColorOre[1] = '0x0641'
ColorOre[2] = '0x0400'
ColorOre[3] = '0x084d'
ColorOre[4] = '0x048a'
ColorOre[5] = '0x07d1'
ColorOre[6] = '0x0488'
ColorOre[7] = '0x0482'
ColorOre[8] = '0x0770'
ColorOre[9] = '0x0515'
ColorOre[10] = '0x0487'
ColorOre[11] = '0x0486'
ColorOre[12] = '0x0485'
ColorOre[13] = '0x048d'
UO.TextOpen()
UO.TextPrint("#####################")
UO.TextPrint("## Время: "+LogsTime+" ##")
UO.TextPrint("#####################")
For i = 0 TO 3
For ii = 0 TO 13
If a<>0 Then
UO.TextPrint(NameOre[ii]+" Ore: "+STR(a))
EndIf
Next
Next
UO.TextPrint("#####################")
endsub
Sub GetAmount(Type,Color,Cont)
var item_amount = 0
UO.IgnoreReset()
REPEAT
UO.FindType(Type, Color, Cont)
If UO.FindCount() Then
If UO.GetQuantity('finditem')==0 Then
item_amount = item_amount + 1
Else
item_amount = item_amount + UO.GetQuantity('finditem')
EndIf
UO.Ignore('finditem')
UO.FindType(Type, Color, Cont)
EndIf
Until UO.FindCount()==0 or UO.Dead()
UO.IgnoreReset()
Return item_amount
endsub
##############
### Часики ###
##############
Sub PrintTime()
var HR = ''
var MIN = ''
var SEC = ''
var CurrentTime = UO.Time()
If CurrentTime>99999 Then
HR = Mid(STR(CurrentTime),0,2)
MIN = Mid(STR(CurrentTime),2,2)
SEC = Mid(STR(CurrentTime),4,2)
Else
If CurrentTime > 9999 Then
HR = '0'+Mid(STR(CurrentTime),0,1)
MIN = Mid(STR(CurrentTime),1,2)
SEC = Mid(STR(CurrentTime),3,2)
Else
If CurrentTime > 999 Then
HR = '00'
MIN = Mid(STR(CurrentTime),0,2)
SEC = Mid(STR(CurrentTime),2,2)
Else
If CurrentTime > 99 Then
HR = '00'
MIN = '0'+Mid(STR(CurrentTime),0,1)
SEC = Mid(STR(CurrentTime),1,2)
Else
If CurrentTime > 9 Then
HR = '00'
MIN = '00'
SEC = STR(CurrentTime)
Else
HR = '00'
MIN = '00'
SEC = '0'+STR(CurrentTime)
EndIf
EndIf
EndIf
EndIf
EndIf
Return (HR+':'+MIN+':'+SEC)
endsub
##################
### РЕКОНЕКТОР ###
##################
Sub Reconnect()
var ReconnectTime,rFlag
ReconnectTime = '0'
rFlag = 1
REPEAT
While UO.ObjAtLayer('Bpack')==''
If rFlag Then
ReconnectTime = PrintTime()
rFlag = 0
EndIf
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'
EndIf
Until false
endsub
Sub gotoxy(x,y,prec)
var ld=0,ldc=0
var dx,dy
var mx,my
var ox,oy,mk,k
#uo.print(">")
#uo.track("1",str(x),str(y))
start:
mx=UO.GetX()
my=UO.GetY()
dx=mx-x
if dx<0 then
dx=0-dx
endif
dy=my-y
if dy<0 then
dy=0-dy
endif
if dy>dx then
dx=dy
endif
if dx<=prec then
return
endif
if not ldc then
uo.print(STR(dx))
endif
if dx<3 then
mk=70
else
mk=15
endif
ox=mx
oy=my
for k=1 to mk
mx=UO.GetX()
my=UO.GetY()
if mx<>ox or my<>oy then
goto sdidapl
endif
wait(10)
next
sdidapl:
mx=UO.GetX()
my=UO.GetY()
dx=mx-x
if dx<0 then
dx=0-dx
endif
dy=my-y
if dy<0 then
dy=0-dy
endif
if dy>dx then
dx=dy
endif
if dx<=prec then
return
endif
if ld==dx then
ldc=ldc+1
if ldc>100 then
uo.print("Can not reach location!")
return
endif
else
ld=dx
endif
if mx==x then
if my==y then
return
endif
if my>y then
#UO.Print("UR")
UO.Press(33)
goto start
endif
#UO.Print("DL")
UO.Press(35)
goto start
endif
if mx<x then
if my>y then
#UO.Print("R")
UO.Press(39)
goto start
endif
if my==y then
#UO.Print("DR")
UO.Press(34)
goto start
endif
#UO.Print("D")
UO.Press(40)
goto start
endif
if my<y then
#UO.Print("L")
UO.Press(37)
goto start
endif
if my==y then
#UO.Print("LU")
UO.Press(36)
goto start
endif
#UO.Print("U")
UO.Press(38)
goto start
endsub
#######################################################################
# Процедура разметки пути от банка к месту реса. #
# В ключевых точках щелкаем прицелом по персонажу. #
# Разметка пути завершается нажатием клавиши [ESC]. #
# После завершения разметки пути из текстового окна вставляем #
# получившийся текст в процедуру GoToResurrect. #
#---------------------------------------------------------------------#
sub MarkWay()
DIM XPoint[100], YPoint[100]
VAR idPoint
VAR i, iCount = 1
VAR FlagMark = true
while FlagMark
UO.Print("Отметь точку маршрута.")
UO.AddObject('TRGT')
while UO.Targeting()
wait(200)
wend
idPoint = UO.GetSerial('TRGT')
if idPoint == UO.GetSerial('self') then
XPoint[iCount] = UO.GetX()
YPoint[iCount] = UO.GetY()
iCount = iCount + 1
UO.Print("ТОЧКА пути занесена в маршрут.")
endif
if idPoint <> UO.GetSerial('self') then
XPoint[iCount] = UO.GetX()
YPoint[iCount] = UO.GetY()
FlagMark = false
UO.Print("Место возраждения занесено в маршрут.")
endif
wend
UO.TextOpen()
UO.TextClear()
UO.TextPrint("#=== Текст скопировать в функцию GoToResurrect().")
UO.TextPrint("#================================================")
UO.TextPrint(" VAR LastIndexDIM = " + str(iCount))
UO.TextPrint(" DIM koord_X[" + str(iCount) + "], koord_Y[" + str(iCount) + "]")
for i = 1 to iCount
UO.TextPrint(" koord_X[" +str(i) + "] = " + str(XPoint[i]))
UO.TextPrint(" koord_Y[" +str(i) + "] = " + str(YPoint[i]))
next
endsub
SUB GoToResurrect() # Идем к месту возраждения и орём там, пока не реснут.
#======== ВСТАВТЕ ПОЛУЧИВШИЙСЯ ТЕКСТ ========#
#==== от этого комментария до следующего ====#
VAR LastIndexDIM = 18
DIM koord_X[18], koord_Y[18]
koord_X[1] = 2506
koord_Y[1] = 540
koord_X[2] = 2514
koord_Y[2] = 540
koord_X[3] = 2517
koord_Y[3] = 540
koord_X[4] = 2517
koord_Y[4] = 554
koord_X[5] = 2517
koord_Y[5] = 561
koord_X[6] = 2528
koord_Y[6] = 563
koord_X[7] = 2546
koord_Y[7] = 563
koord_X[8] = 2552
koord_Y[8] = 569
koord_X[9] = 2552
koord_Y[9] = 573
koord_X[10] = 2556
koord_Y[10] = 577
koord_X[11] = 2559
koord_Y[11] = 577
koord_X[12] = 2562
koord_Y[12] = 580
koord_X[13] = 2567
koord_Y[13] = 580
koord_X[14] = 2567
koord_Y[14] = 610
koord_X[15] = 2578
koord_Y[15] = 610
koord_X[16] = 2578
koord_Y[16] = 598
koord_X[17] = 2574
koord_Y[17] = 594
koord_X[18] = 2574
koord_Y[18] = 594
#==== вставте текст до этого комментария ====#
#============================================#
VAR i, k = 0
# Бежим к месту возрождения.
for i = 1 to LastIndexDIM
Walk_R3(koord_X[i], koord_Y[i], 0)
next
# Кричим: "Ресните", - пока не реснут.
while UO.Dead()
UO.Say("Ресните меня пожалуйста.")
wait(3000)
wend
# После реса идем к обратно к банку.
for i = LastIndexDIM to 1 step -1
Walk_R3(koord_X[i], koord_Y[i], 0)
next
GetReagentsFromBank()
endsub
#Полный копипаст твоей функции regi с небольшими изменениями.
SUB GetReagentsFromBank()
#VAR BagInBank = '0x00000000' #<<<Вынес в глобальные переменные
VAR r, q, n, amount = 5
Dim reg[4]
reg[1] = '0x0F7A'
reg[2] = '0x0F7B'
reg[3] = '0x0F86'
reg[4] = '0x0E21'
UO.Say('bank')
wait(3000)
UO.UseObject(BagInBank)
wait(3000)
For r = 1 to 4
if uo.count( reg[r] )<>amount then
q = amount - uo.count( reg[r] )
if q <> 0 then
if q > 0 then
uo.useobject("Sunduk")
wait(250)
uo.findtype( reg[r] , -1 ,BagInBank)
If uo.findcount() == 0 then
uo.msg('Ia vzial regi!')
return
endif
uo.moveitem('finditem', STR(q) )
wait(1000)
else
q = q*-1
uo.findtype( reg[r] )
uo.moveitem('finditem', STR(q) ,BagInBank)
wait(1000)
endif
endif
endif
next
While uo.Count('0x0F09','0x0060') < 2
uo.findtype('0x0F09','0x0060',BagInBank)
if uo.FindCount() then
uo.moveitem('finditem')
checklag()
wait(1000)
endif
wend
uo.print('Vziali regi ...')
endsub
SUB Walk_R3(X,Y,pr)
#Небольшая переделка ходилки Revenant'а, без обход апрепятствий.
#Переделывал GAUHAR.
#X,Y - координаты цели.
#pr - точность подхода к координатам цели.
VAR KEY='38333936 034373540', n, m
VAR xs=UO.GetX(), ys=UO.GetY(), ds = UO.GetDir(), k
while ((X-xs>pr or xs-X>pr) and X<>xs) or ((Y-ys>pr or ys-Y>pr) and Y<>ys)
if X < xs then
n = 1
endif
if X == xs then
n = 2
endif
if X > xs then
n = 3
endif
if Y < ys then
m = 1
endif
if Y == ys then
m = 2
endif
if Y > ys then
m = 3
endif
UO.Press(val(mid(KEY, 2*n+6*m-8, 2)))
k = 0
while xs == UO.GetX() and ys == UO.GetY() and ds == UO.GetDir() and k < 100
wait(10)
k = k + 1
wend
xs = UO.GetX()
ys = UO.GetY()
ds = UO.GetDir()
wend
endsub
#--------------------------------------------------------------#
################################################################