Yoko

All sides of Injection
It is currently 2024-03-28 19:27:57

All times are UTC+02:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: 2010-11-15 03:03:19 
Offline

Joined: 2010-07-12 20:17:17
Posts: 30
помогите прикрутить ходилку в этом скрипте!
а имено где и менять задежку между шаками? штоб не гнала как дурная!
ато злодейский дрв выкидует хотя пинг уо.дрв.ру -t идёт без потерь и вот ЭТО меня немного смущает!
(надеюсь авторы скрипта не обидятся идо этот скрипт итак лежит в свободном доступе)
Code:
var FileName=('C:\ore.dat') 

###
var TryHiding=1
###
var TryRecall=0 ## 1 -
###
var RuneToHome=1 ## -
var RuneToMining=8 ## -
###
var GetFromFile=1 ## 1 -
###
var OreQty=600 ## -
var ControlOfDanger=0 ## 1
var ElementalKill=0 ## 1 -
var DangerousTime=60000 ## -
var CycleScript=1 ##
###
var Reconnect=1
###
var DisturbingSound=('E:\GAMES\Ultima Online 2D\alarm1.wav')
###
var DropX=2605
###
var DropY=1169 #
###
var DropOnVip=0
################################################################################
###################
###
### После настройки:
### Идите в место где будем копать.
### Запустите cкрипт GoMining(), инжект попросит вас указать Кирку(появится
### прицел, прицелом на неё),
### Рунбук(появится прицел, прицелом на него) ,Руну(прицелом на нее) и Сундук
### для логов.
### После этого чар пойдет по координатам и будет копать руду.
###########
### Код ###
###########
sub GoMining()
uo.Print('Выбери Кирку: ')
uo.Exec('addobject Pickaxe')
while uo.Targeting()
wait(100)
wend

if TryRecall==1 then
uo.Print('Выбери PунБук: ')
uo.Exec('addobject Runebook')
while uo.Targeting()
wait(100)
wend
end if

if ControlOfDanger==1 then
uo.Print('Выбери Руну: ')
uo.Exec('addobject Rune')
while uo.Targeting()
wait(100)
wend
end if

uo.Print('Выбери Сундук: ')
uo.Exec('addobject Chest')
while uo.Targeting()
wait(100)
wend

if ControlOfDanger==1 then
uo.Exec('exec ControlOfDanger')
end if

if Reconnect==1 then
uo.Exec('exec Reconnect')
end if

if DropOnVip==0 then
RecallToOre()
end if

uo.Exec('exec Mining')
end sub

sub Mining()
var i=0,j=0,k=0,r=0,q=0,ii,jj,f
var TopX=324,TopY=65
dim OreX[5000],OreY[5000],OreT[5000]
dim OreTile[21]
var flag=0,OreCount=0,clicks=0,flag2=0
####################
### Графика руды ###
####################
OreTile[0]=1339
OreTile[1]=1355
OreTile[2]=1354
OreTile[3]=1359
OreTile[4]=1358
OreTile[5]=1357
OreTile[6]=1352
OreTile[7]=1341
OreTile[8]=1363
OreTile[9]=1359
OreTile[10]=1339
OreTile[11]=1354
OreTile[12]=1386
OreTile[13]=1353
OreTile[14]=2278
OreTile[15]=2282
OreTile[16]=2281
OreTile[17]=2277
OreTile[18]=2278
OreTile[19]=2275
OreTile[20]=1351
OreTile[21]=0

uo.FilterSpeech('on')
uo.FilterSpeech('add', 'Where do you want to use the pickaxe?')

#####################################
### Загружаем координаты из файла ###
#####################################
if GetFromFile==1 then
uo.Print('Загружаем координаты из файла...')
f=file(FileName)
f.Open()
OreCount=safe call f.ReadNumber()
for i=1 to OreCount
OreT[i]=safe call f.ReadNumber()
OreX[i]=safe call f.ReadNumber()
OreY[i]=safe call f.ReadNumber()
next
f.Close()
else
######################################
### Собираем координаты из клиента ###
######################################
uo.Print('Собираем координаты руды в округе...')
repeat
clicks=0
flag=0
uo.DeleteJournal()
#######################
### Кликаем на тайл ###
#######################
uo.UseObject('Pickaxe')
wait(500)
uo.DeleteJournal()
while uo.Targeting()
wait(100)
wend
###########################
### Проверяем то ли это ###
###########################
flag=0
for k=0 to 21
if uo.LastTile(0)==OreTile[k]+1 then
flag=2
end if
next
if flag==0 then
for k=0 to 21
if uo.LastTile(0)==OreTile[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 OreCount>0 then
for ii=1 to OreCount
if OreX[ii]==uo.LastTile(1) and OreY[ii]==uo.LastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
OreCount=OreCount+1
OreX[OreCount]=uo.LastTile(1)
OreY[OreCount]=uo.LastTile(2)
OreT[OreCount]=uo.LastTile(0)
uo.Print('Найдена руда номер '+str(OreCount)+' : x='+str(uo.Lasttile(1))+'
y='+str(uo.LastTile(2)))
end if
end if
#####################
### Кликнули выше ###
#####################
if flag==2 then
flag2=0
if OreCount>0 then
for ii=1 to OreCount
if OreX[ii]==uo.LastTile(1) and OreY[ii]==uo.LastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
OreCount=OreCount+1
OreX[OreCount]=uo.LastTile(1)
OreY[OreCount]=uo.LastTile(2)
OreT[OreCount]=uo.LastTile(0)-1
uo.print('Найдена руда номер '+str(OreCount)+' : x='+str(uo.Lasttile(1))+'
y='+str(uo.LastTile(2)))
end if
end if
until (Flag==3) or (OreCount==5000)
uo.FilterSpeech('off')
uo.Print('Анализ закончен, координаты руды записаны в файл ' +FileName)
SaveToFile(OreCount,OreX,OreY,OreT)
end if
uo.Print('Координат найдено: '+str(OreCount))
wait(2000)
######################################
### Ходим по собранным координатам ###
######################################
while 1==1
if OreCount>0 then
for i=1 to OreCount

if TryRecall==1 and uo.Weight>OreQty then
ToRecall()
i=1
end if

if DropOnVip==1 and TryRecall==0 and uo.Weight>OreQty then
DropOnVip()
i=1
end if

j=i*2-1
if j>OreCount then
j=2*(OreCount-i+1)
end if
InfoOre()
flag=GotoXY(OreX[j],OreY[j],2)
if TryHiding==1 then
ToHide()
end if
if flag==1 then
GetOre(str(OreT[j]),str(OreX[j]),str(OreY[j]),str(uo.GetZ()))
end if
next
end if
wend
end sub

sub SaveToFile(OreCount,OreX,OreY,OreT)
var s=0,i=0,f
f=file(FileName)
f.Open()
f.Create()
s=safe call f.Writeln(OreCount)
for i=1 to OreCount
s=safe call f.Writeln(str(OreT[i])+' '+str(OreX[i])+' '+str(OreY[i]))
next
f.Close()
end sub

sub GetOre(Type,X,Y,Z)
var i
uo.Print('Начинаем копать...')
for i=1 to 20
if uo.Warmode()==1 then
return 0
end if
wait(200)
uo.DeleteJournal()
CheckLag()
wait(100)
uo.WaitTargetTile(Type,X,Y,Z)
uo.UseObject('Pickaxe')
wait(500)
if WaitForChange()==1 then
return 1
end if
next
return 0
end sub

sub WaitForChange()
var Text1=uo.GetName()+': You loosen some rocks but fail to find any useable
ore.'
var Text2='There is no ore here to mine.'
var Text3="You can't reach this."
var Text4="That is too far away."
var Text5="You can't do much in your current state."
var Text6="You have no line of sight to that location"
var Text7="You can't see the target"
var Text8="Try mining in rock."
var mess
for var i=0 to 200
mess=uo.Journal(0)
if uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 or uo.Journal(0)==Text6 or uo.Journal(0)==Text7 or uo.Journal(0)==Text8 then
return 1
end if
if uo.Journal(0)==Text1 then
wait(1000)
return 0
end if
if mess[0]=='Y' and mess[1]=='o' and mess[2]=='u' and mess[4]=='p' and mess[5] =='u' and mess[6]=='t' then
return 0
end if
wait(50)
next
return 0
end sub

sub Open(Container)
uo.DeleteJournal()
uo.UseObject(Container)
repeat
wait(500)
until uo.InJournal('Contains')
end sub

sub GotoXY(x,y,r)
var lastX=0,lastY=0,i=0
while Numb(y-uo.GetY())>r
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
if (y-uo.GetY())>r then
LastX=uo.GetX()
LastY=uo.GetY()
for i=0 to 2
uo.Press(35)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
if LastY==uo.GetY() then
for i=0 to 2
uo.Press(37)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
end if
if LastY==uo.GetY() then
for i=0 to 2
uo.Press(40)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
end if
if LastX==uo.GetX() and LastY==uo.GetY() then
for i=0 to 5
uo.Press(38)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
end if
end if
if (uo.GetY()-y)>r then
LastY=uo.GetY()
for i=0 to 2
uo.Press(33)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
if LastY==uo.GetY() then
for i=0 to 2
uo.Press(39)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
end if
if LastY==uo.GetY() then
for i=0 to 2
uo.Press(38)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
end if
if LastX==uo.GetX() and LastY==uo.GetY() then
for i=0 to 5
uo.Press(40)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
end if
end if
wend
while Numb(x-uo.GetX())>r
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
if (x-uo.GetX())>r then
LastX=uo.GetX()
LastY=uo.GetY()
for i=0 to 2
uo.Press(34)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
if LastX==uo.GetX() then
for i=0 to 2
uo.Press(40)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
end if
if LastX==uo.GetX() then
for i=0 to 2
uo.Press(39)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
end if
if LastX==uo.GetX() and LastY==uo.GetY() then
for i=0 to 5
uo.Press(37)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
end if
end if
if (uo.GetX()-x)>r then
LastX=uo.GetX()
for i=0 to 2
uo.Press(36)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
if LastX==uo.GetX() then
for i=0 to 2
uo.Press(38)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
end if
if LastX==uo.GetX() then
for i=0 to 2
uo.Press(37)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
end if
if LastX==uo.GetX() and LastY==uo.GetY() then
for i=0 to 5
uo.Press(39)
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
end if
next
end if
end if
wend
if Numb(x-uo.GetX())<=r and Numb(y-uo.GetY())<=r then
return 1
else
return 0
end if
return 0
end sub

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

sub InfoOre()
uo.Print('У вас всего '+str(uo.Count('0x19B7')+uo.Count('0x19B8')+uo.Count ('0x19B9')+uo.Count('0x19BA'))+' руды в сумке')
uo.Print('Из нее '+str(uo.Count('0x19B7','0x0000')+uo.Count('0x19B8','0x0000')+uo.Count('0x19B9','0x0000')+uo.Count('0x19BA','0x0000'))+' железо и ' +str (uo.Count('0x19B7')+uo.Count('0x19B8')+uo.Count('0x19B9')+uo.Count('0x19BA')-(uo.Count('0x19B7','0x0000')+uo.Count('0x19B8','0x0000')+uo.Count ('0x19B9','0x0000')+uo.Count('0x19BA','0x0000')))+' цветмет')
end sub

sub ToHide()
while not uo.Hidden()
uo.Print('Пытаемся уйти в хайд...')
uo.DeleteJournal()
uo.UseSkill('Stealth')
wait(6000)
wend
wait(100)
end sub

sub ToRecall()
RecallToHome()
DropOre()
RecallToOre()
end sub

sub RecallToHome()
uo.Print('Прыгаем Домой.')
RunebookRecall(RuneToHome)
end sub

sub RecallToOre()
uo.Print('Прыгаем в Пещеру.')
RunebookRecall(RuneToMining)
end sub

sub RunebookRecall(n)
var OldX,OldY,Time
OldX=uo.GetX()
OldY=uo.GetY()
repeat
uo.Exec('warmode 0')
uo.UseObject('Runebook')
CheckLag()
uo.Lclick(135, n*15+55)
CheckLag()
Time=uo.Timer()
repeat
wait(500)
until OldX<>uo.GetX() or OldY<>uo.GetY() or uo.Dead() or uo.InJournal('needs')or uo.InJournal('fizzles') or Time+200<uo.Timer()
uo.DeleteJournal()
until OldX<>uo.GetX() or OldY<>uo.GetY() or uo.Dead() or uo.InJournal('needs')
end sub

sub DropOre()
var o,exit
dim Ore[14]
Ore[0]=0x19B9
Ore[1]=0x19B7
Ore[2]=0x19BA
Ore[3]=0x19B8
Ore[4]=0x0F11
Ore[5]=0x0F16
Ore[6]=0x0F18
Ore[7]=0x0F15
Ore[8]=0x0F10
Ore[9]=0x0F0F
Ore[10]=0x0F26
Ore[11]=0x1F4C
Ore[12]=0x0EED
Ore[13]=0x0F20
ToHide()
if uo.Waiting() then
uo.CancelTarget()
end if
uo.SetReceivingContainer('Chest')
wait(500)
for o=0 to 13
exit=0
repeat
uo.FindType(Ore[o])
if uo.GetQuantity('finditem')>0 then
uo.Grab('0','finditem')
wait(1500)
else
exit=1
end if
until exit==1
next
uo.UnSetReceivingContainer('Chest')
end sub

sub DropOnVip()
Walk(DropX,DropY,'')
DropOre()
end sub

sub ControlOfDanger()
var danger
var RecallPhysicalDanger=1
var RecallSeenDanger=1
var RecallBluePlayer=1
while 1
uo.DeleteJournal()
while not uo.InJournal(':')
wait(100)
wend
danger=uo.GetNotoriety(uo.JournalSerial(0))
if uo.InJournal('OOPS') then
if ElementalKill==1 then
uo.Exec('exec ElementalKill')
end if
if ElementalKill==0 then
uo.Exec('exec RecallRune')
end if
end if
if RecallPhysicalDanger==1 then
if uo.InJournal('attacking you') then
uo.Exec('exec RecallRune')
end if
end if
if RecallSeenDanger==1 then
if danger==6 and uo.JournalSerial(0)<>uo.GetSerial() then
uo.Exec('exec RecallRune')
end if
if danger==4 and uo.JournalSerial(0)<>uo.GetSerial() then
uo.Exec('exec RecallRune')
end if
end if
if RecallBluePlayer==1 then
if danger==1 and uo.JournalSerial(0)<>uo.GetSerial() then
uo.Exec('exec RecallRune')
end if
end if
wend
end sub

sub RecallRune()
var MX=uo.GetX('self')
var MY=uo.GetY('self')
Terminate()
uo.PlayWav(DisturbingSound)
uo.UseType('0x0F0E','0x0631')
wait(100)
Recall:
uo.DeleteJournal()
if uo.Waiting() then
uo.CancelTarget()
end if
uo.WaittargetObject('Rune')
wait(100)
uo.Cast('Recall')
wait(3000)
if not uo.GetX('self')<>MX and not uo.GetY('self')<>MY then
goto Recall
end if
repeat
uo.DeleteJournal()
uo.WaittargetObject('Rune')
uo.Cast('Mark')
if uo.InJournal('mana for this spell') then
ManaUp('Bottle')
wait(100)
end if
wait(3000)
until not uo.InJournal('spell fizzles')
if uo.Life<uo.STR then
LifeUp('Bottle')
wait(100)
end if
if CycleScript==1 then
uo.Exec('exec DangerWait')
end if
if CycleScript==0 then
uo.Exec('exec ExitUO')
end if
end sub

sub DisturbingSound(amount)
var i
for i=1 to amount
uo.PlayWav(DisturbingSound)
wait(1500)
next
end sub

sub DangerWait()
wait(DangerousTime)
ToRecall()
uo.Exec('exec Mining')
end sub

sub ExitUO()
wait(3000)
uo.CloseUO()
end sub

sub LifeUp(Mode)
if Mode=='Healing' then
while uo.Life<uo.STR
uo.Exec('bandageself')
wait(4000)
wend
end if
if Mode=='Bottle' then
if uo.Life<uo.STR then
uo.UseType('0x0F0E','0x09BB')
wait(100)
end if
end if
end sub

sub ManaUp(Mode)
if Mode=='Meditation' then
while uo.Mana<uo.INT
uo.Exec('useskill Meditation')
wait(4000)
wend
end if
if Mode=='Bottle' then
if uo.Mana<uo.INT then
uo.UseType('0x0F0E','0x09DF')
wait(100)
end if
end if
end sub

sub ElementalKill()
var Count,LastTimer,Elemental
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
Terminate()
uo.UseType('0x0F0E','0x0631') ## - Инвизка(тип,цвет).
while uo.STR<uo.Life+1
if uo.Mana>=50 then
uo.WaitMenu('What','Daemon')
uo.Cast('Polymorph')
wait(8000)
else
uo.UseType('0x0F0E','0x09DF') ## - Тотал Мана(тип,цвет).
wait(3000)
end if
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(Elemental)
repeat
wait(1000)
if uo.Life<50 Then
uo.UseType('0x0F0E','0x09BB') ## - Греатер Хеал(тип,цвет).
end if
if uo.GetDistance(Elemental)>1 then
WalkN(0,0,Elemental)
end if
until uo.IsNPC(Elemental)==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
end if
until exit==1
next
### uo.Exec('warmode 1')
uo.Exec('warmode 0')
uo.Exec('exec Mining')
end sub

sub WalkN(x,y,Target)
var i,StepSucess
var DX,DY,exit=0
while exit<>1
if Target<>"" then
DX=uo.GetX(Target)-uo.GetX()
DY=uo.GetY(Target)-uo.GetY()
if uo.GetDistance(Target)<2 then
exit=1
end if
else
DX=X-uo.GetX()
DY=Y-uo.GetY()
exit=1
end if
end if
if DX<>0 and DY<>0 then
if DX>0 and DY>0 then
StepSucess=Go(3,40,300)
if StepSucess==-1 then
StepSucess=Go(7,38,300)
StepSucess=Go(1,39,300)
if StepSucess==-1 then
StepSucess=Go(5,37,300)
end if
end if
end if
if DX>0 and DY<0 then
StepSucess=Go(1,39,300)
if StepSucess==-1 then
StepSucess=Go(5,37,300)
StepSucess=Go(3,40,300)
if StepSucess==-1 then
StepSucess=Go(7,38,300)
end if
end if
end if
if DX<0 and DY>0 then
StepSucess=Go(5,37,300)
if StepSucess==-1 then
StepSucess=Go(1,39,300)
StepSucess=Go(7,38,300)
if StepSucess==-1 then
StepSucess=Go(3,40,300)
end if
end if
end if
if DX<0 and DY<0 then
StepSucess=Go(7,38,300)
if StepSucess==-1 then
StepSucess=Go(3,40,300)
StepSucess=Go(5,37,300)
if StepSucess==-1 then
StepSucess=Go(1,39,300)
end if
end if
end if
end if
if DX<>0 and DY==0 then
if DX>0 then
StepSucess=Go(2,34,300)
if StepSucess==-1 then
StepSucess=Go(3,40,300)
if StepSucess==-1 then
StepSucess=Go(1,39,300)
end if
StepSucess=Go(2,34,300)
end if
end if
if DX<0 then
StepSucess=Go(6,36,300)
if StepSucess==-1 then
StepSucess=Go(7,38,300)
if StepSucess==-1 then
StepSucess=Go(5,37,300)
end if
StepSucess=Go(6,36,300)
end if
end if
end if
if DX==0 and DY<>0 then
if DY>0 then
StepSucess=Go(4,35,300)
if StepSucess==-1 then
StepSucess=Go(3,40,300)
if StepSucess==-1 then
StepSucess=Go(5,37,300)
end if
StepSucess=Go(4,35,300)
end if
end if
if DY<0 then
StepSucess=Go(0,33,300)
if StepSucess==-1 then
StepSucess=Go(1,39,300)
if StepSucess==-1 then
StepSucess=Go(7,38,300)
endif
StepSucess=Go(0,33,300)
end if
end if
end if
wend
end sub

sub Go(dir,key,walkwait)
var X,Y,OldDir
X=uo.GetX()
Y=uo.GetY()
OldDir=uo.GetDir()
if uo.GetDir()<>dir then
uo.Press(key)
wait(walkwait)
if uo.GetDir()<>dir then
end if
end if
uo.Press(key)
wait(walkwait)
if X==uo.GetX() and Y==uo.GetY() then
end if
if X==uo.GetX() and Y==uo.GetY() and OldDir<>uo.GetDir() then
uo.Press(key)
wait(walkwait)
end if
if X==uo.GetX() and Y==uo.GetY() then
end if
if X==uo.GetX() and Y==uo.GetY() then
return -1
else
return 1
end if
end sub

sub Reconnect()
var ReconnectTime,rflag
ReconnectTime='0'
rflag=1
repeat
while (uo.ObjAtLayer('Bpack')=='')
if rflag then
ReconnectTime=Time()
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 Time()
var Date,nTime,uTime,i
uTime=str(uo.Time())
nTime=''
for i=0 to Len(uTime)
nTime=uTime[Len(uTime)-i]+nTime
if (i==2) or (i==4) then
nTime=':'+nTime
end if
next
uTime=str(uo.Date())
Date=''
for i=0 to Len(uTime)
Date=uTime[Len(uTime)-i]+Date
if (i==2) or (i==4) then
Date='.'+Date
end if
next
uTime=nTime+' @ '+Date
return uTime
end sub

sub Terminate()
uo.Exec('terminate Mining')
end sub

sub TerminateAll()
uo.Exec('terminate Mining')
uo.Exec('terminate ControlOfDanger')
uo.Exec('terminate Reconnect')
uo.Exec('terminate RecallRune')
uo.Exec('terminate DropOre')
uo.Exec('terminate DangerWait')
uo.Exec('terminate DangerWait')
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')
end sub

sub GoCorpse()
var Elemental='0x4000466F'
Walk(0,0,Elemental)
end sub

sub Walk(X,Y,Target)
var Targeting=''
var Result
var DX,DY,GLX,GLY
var DirW=0
var exit=0
while exit<>1
if Target<>'' then
Targeting=Target
DX=uo.GetX(Target)-uo.GetX()
DY=uo.GetY(Target)-uo.GetY()
if uo.GetDistance(Target)<2 then
exit=1
end if
else
DX=X-uo.GetX()
DY=Y-uo.GetY()
GLX=DX
GLY=DY
if DX==0 and DY==0 then
exit=1
end if
end if
if exit==0 then
if DX>0 and DY>0 then
DirW=9
end if
if DX>0 and DY<0 then
DirW=7
end if
if DX<0 and DY>0 then
DirW=3
end if
if DX<0 and DY<0 then
DirW=5
end if
if DX<>0 and DY==0 then
if DX>0 then
DirW=8
else
DirW=4
end if
end if
if DX==0 and DY<>0 then
if DY>0 then
DirW=2
else
DirW=6
end if
end if
Result=Go(DirW)
if Result==0 then
Result=Go(DirW-2)
if Result==0 then
Result=Go(DirW+2)
end if
end if
end if
wend
end sub

sub Go(dir)
var WalkWait=100
var Targeting=''
var X,Y,GLX,GLY
var check=1
var StartingDir=uo.GetDir()
X=uo.GetX()
Y=uo.GetY()
dim MoveKey[12]
MoveKey[0]=34
MoveKey[1]=40
MoveKey[2]=35
MoveKey[3]=37
MoveKey[4]=36
MoveKey[5]=38
MoveKey[6]=33
MoveKey[7]=39
MoveKey[8]=34
MoveKey[9]=40
MoveKey[10]=35
MoveKey[11]=37
dim StartDir[12]
StartDir[0]=2
StartDir[1]=3
StartDir[2]=4
StartDir[3]=5
StartDir[4]=6
StartDir[5]=7
StartDir[6]=0
StartDir[7]=1
StartDir[8]=2
StartDir[9]=3
StartDir[10]=4
StartDir[11]=5
while uo.GetDir()<>StartDir[dir]
uo.Press(MoveKey[dir])
wait(WalkWait)
if uo.GetDir()==StartingDir then
CheckLag()
end if
if (Targeting<>'' and uo.GetDistance(Targeting)<2) or (GLX==0 and GLY==0) then
return 1
end if
wend
uo.Press(MoveKey[dir])
wait(WalkWait)
if X==uo.GetX() and Y==uo.GetY() then
CheckLag()
uo.Press(MoveKey[dir])
wait(WalkWait)
end if
if X==uo.GetX() and Y==uo.GetY() then
return 0
else
return 1
end if
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 17 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