запускаю мейн гружу его через автолоад. и если и крашит то под конец скрипта фастлут.
Code:
sub Loot()
VAR WaitTime=400
VAR Exit=0, i
DIM Loot[191]
Loot[0]=0x0EED
Loot[1]=0x0F7B
Loot[2]=0x0F7A
Loot[3]=0x0F84
Loot[4]=0x0F85
Loot[5]=0x0F86
Loot[6]=0x0F88
Loot[7]=0x0F8C
Loot[8]=0x0F8D
Loot[9]=0x0F90
Loot[10]=0x0F7E
Loot[11]=0x1078
Loot[12]=0x1078
Loot[13]=0x09F1
Loot[14]=0x0E34
Loot[15]=0x0F25
Loot[16]=0x09F1
Loot[17]=0x0F20
Loot[18]=0x0F26
Loot[19]=0x0F30
Loot[20]=0x0F8E
Loot[21]=0x14EB
Loot[22]=0x0F79
Loot[23]=0x0F3F
Loot[24]=0x0F79
Loot[25]=0x0F91
Loot[26]=0x0F78
Loot[27]=0x204E
Loot[28]=0x1515
Loot[29]=0x1B76
Loot[30]=0x1414
Loot[31]=0x1410
Loot[32]=0x1C04
Loot[33]=0x1411
Loot[34]=0x1413
Loot[35]=0x1412
Loot[36]=0x0F0C
Loot[37]=0x0F0C
Loot[38]=0x0F08
Loot[39]=0x0F08
Loot[40]=0x0F0C
Loot[41]=0x1F5F
Loot[42]=0x1F5F
Loot[43]=0x1F5F
Loot[44]=0x1F5F
Loot[45]=0x0E76
Loot[46]=0x0E76
Loot[47]=0x09B0
Loot[48]=0x09B0
Loot[49]=0x1BDD
Loot[50]=0x1BDD
Loot[51]=0x1BDD
Loot[52]=0x1BDD
Loot[53]=0x1BDD
Loot[54]=0x1BDD
Loot[55]=0x1BDD
Loot[56]=0x1BDD
Loot[57]=0x1BDD
Loot[58]=0x1BDD
Loot[59]=0x1BDD
Loot[60]=0x1BDD
Loot[61]=0x1BDD
Loot[62]=0x1BDD
Loot[63]=0x1BEF
Loot[64]=0x1BEF
Loot[65]=0x1BEF
Loot[66]=0x1BEF
Loot[67]=0x1BEF
Loot[68]=0x1BEF
Loot[69]=0x1BEF
Loot[70]=0x1BEF
Loot[71]=0x19B9
Loot[72]=0x19B9
Loot[73]=0x19B9
Loot[74]=0x19B9
Loot[75]=0x19B9
Loot[76]=0x19B9
Loot[77]=0x19B9
Loot[78]=0x204E
Loot[79]=0x1515
Loot[80]=0x1B76
Loot[81]=0x1414
Loot[82]=0x1410
Loot[83]=0x1C04
Loot[84]=0x1411
Loot[85]=0x1413
Loot[86]=0x1412
Loot[87]=0x204E
Loot[88]=0x1515
Loot[89]=0x1B76
Loot[90]=0x1414
Loot[91]=0x1410
Loot[92]=0x1C04
Loot[93]=0x1411
Loot[94]=0x1413
Loot[95]=0x1412
Loot[96]=0x204E
Loot[97]=0x1515
Loot[98]=0x1B76
Loot[99]=0x1414
Loot[100]=0x1410
Loot[101]=0x1C04
Loot[102]=0x1411
Loot[103]=0x1413
Loot[104]=0x1412
Loot[105]=0x0E21
Loot[106]=0x13BA
Loot[107]=0x1406
Loot[108]=0x13B1
Loot[109]=0x0F4F
Loot[110]=0x13FC
Loot[111]=0x13FE
Loot[112]=0x143E
Loot[113]=0x1F14
Loot[114]=0x0F4C
Loot[115]=0x1B78
Loot[116]=0x1541
Loot[117]=0x0E21
Loot[118]=0x13BA
Loot[119]=0x1406
Loot[120]=0x13B1
Loot[121]=0x0F4F
Loot[122]=0x13FC
Loot[123]=0x13FE
Loot[124]=0x143E
Loot[125]=0x1F14
Loot[126]=0x0F4C
Loot[127]=0x1B78
Loot[128]=0x1541
Loot[129]=0x0E21
Loot[130]=0x13BA
Loot[131]=0x1406
Loot[132]=0x13B1
Loot[133]=0x0F4F
Loot[134]=0x13FC
Loot[135]=0x13FE
Loot[136]=0x143E
Loot[137]=0x1F14
Loot[138]=0x0F4C
Loot[139]=0x1B78
Loot[140]=0x1541
Loot[141]=0x0E20
Loot[142]=0x0E20
Loot[143]=0x1549
Loot[144]=0x1BC4
Loot[145]=0x1BC3
Loot[146]=0x1BC4
Loot[147]=0x1BC3
Loot[148]=0x1BC4
Loot[149]=0x1BC3
Loot[150]=0x13BD
Loot[151]=0x108A
Loot[152]=0x108A
Loot[153]=0x108A
Loot[154]=0x1B7A
Loot[155]=0x1549
Loot[156]=0x1F5F
Loot[157]=0x1F4C
Loot[158]=0x1F42
Loot[159]=0x1F4A
Loot[160]=0x1F50
Loot[161]=0x1F44
Loot[162]=0x1F52
Loot[163]=0x1F42
Loot[164]=0x1F49
Loot[165]=0x1F5F
Loot[166]=0x1F4C
Loot[167]=0x1F42
Loot[168]=0x1F4A
Loot[169]=0x1F50
Loot[170]=0x1F44
Loot[171]=0x1F52
Loot[172]=0x1F42
Loot[173]=0x1F49
Loot[174]=0x1F5F
Loot[175]=0x1F4C
Loot[176]=0x1F42
Loot[177]=0x1F4A
Loot[178]=0x1F50
Loot[179]=0x1F44
Loot[180]=0x1F52
Loot[181]=0x1F42
Loot[182]=0x1F49
Loot[183]=0x13BD
Loot[184]=0x13BD
Loot[185]=0x1549
Loot[186]=0x1440
Loot[187]=0x1440
Loot[188]=0x1440
Loot[189]=0x1415
Loot[190]=0x1415
Loot[191]=0x0F0A
UO.DeleteJournal("Unknown")
UO.UseObject('lastcorpse')
if UO.GetQuantity('lastcorpse') then
UO.SetArm('temp')
UO.WaitTargetObject('lastcorpse')
UO.UseType('0x13F6')
wait(500)
UO.Arm('temp')
wait(500)
endif
UO.SetReceivingContainer('0x418ADB2D')
For i=0 to 191
UO.FindType(Loot[i],-1,'ground')
if UO.GetQuantity('finditem') then
UO.Grab(STR(0),'finditem')
wait(WaitTime)
endif
if UO.GetQuantity('lastcorpse') then
UO.FindType(Loot[i],-1,'lastcorpse')
if UO.GetQuantity('finditem') then
if Loot[i]==0x1078 then
UO.WaitTargetObject('finditem')
UO.UseType('0x0F9E')
else
UO.Grab(STR(0),'finditem')
endif
wait(WaitTime)
endif
endif
next
heal()
end sub
sub heal()
if uo.life < 90 then
repeat
uo.bandageself()
wait(100)
UO.UseType('0x1406')
wait(100)
UO.UseType('0x1B76')
wait(100)
UO.DeleteJournal("barely help")
wait(10)
UO.DeleteJournal("put the bloody")
wait(10)
repeat
wait(100)
until UO.InJournal("barely help") or UO.InJournal("put the bloody")
wait(10)
until uo.life >= 98
wait(10)
end if
wait(100)
UO.DeleteJournal()
uo.exec('exec main')
end sub
sub main()
VAR MaxVes=600
VAR n=1, z=0, f=0, yyy=0
var animal=0x0015 #??? ?????????
uo.ignorereset()
Repeat
uo.Set('finddistance', n)
uo.FindType(animal, -1, 'ground')
f=f+1
if f==12 then
walker(6100,3060,1)
end if
if n==10 then
uo.useskill('Stealth')
wait(1150)
end if
if uo.FindCount() then
f=0
uo.resend()
n=1
uo.attack('finditem')
z=1
repeat
if uo.GetDistance('finditem') > 1 then
walker(uo.GetX('finditem'),uo.GetY('finditem'),1)
else
wait(100)
if uo.life < 80 then
if uo.life < 40 then
uo.exec('exec walk')
end if
repeat
uo.bandageself()
wait(100)
UO.UseType('0x1406')
wait(100)
UO.UseType('0x1B76')
wait(100)
UO.DeleteJournal("barely help")
UO.DeleteJournal("put the bloody")
repeat
wait(100)
until UO.InJournal("barely help") or UO.InJournal("put the bloody")
until uo.life >= 90
uo.attack('finditem')
end if
if uo.armor<=81 then
uo.cast('Protection','self')
wait(3000)
uo.attack('finditem')
endif
end if
until uo.dead() or uo.GetX('finditem')==0
wait(100)
uo.exec('exec Loot')
uo.exec('terminate main')
else
n=n+1
if n>10 then
n=1
endif
end if
if z==1 then
z=0
Loot()
endif
Until uo.Dead() || UO.Weight > MaxVes
end sub
Sub walk()
walker(6100,3060,1)
endsub
########################################## ??????? 3 ##########################
#var Prec=3 # ??? ?????? ??????? ??????? ? ???? (Precision)
#var MaxTraceDistance=15 # ???????????? ????? ??????. ?????????? ??????? ? ??????? ????????? ??????????. ???? ??????? ????? #??????? ?????, ??????? ????? ????? ? ????? ??? ???? ????? ????? ? ????????? ??????.
#var Speed=2 # ????? ????. ??????? ????? ?????? ?? ???. ???? 3 ??????? ?????? ???. ?????? ????? ????????? ?????. ??? ??????? #???????? 3, ??? ???????? - 1.
#var StepTimeOut=400 # ???? ???????? ? ???????????? ??????, ??????? ???? ????? ?????? ? ?????. ???? ?? ???????? - ??????? #????. ???? ????????? ?????? ?????????, ??????? ?????? ???????????? ?????? ?????.
#UO.SetGlobal("Logging","1") # - ?????????? ?????????? ?????????.
#UO.SetGlobal("BlindWalk","0") # - ?? ???????????? ???????? ??????, ? ???????????? ?????? ???????. ??? ???????? ??????????? #????????.
#? ??????? IsPass, ??????????? ?????? ?????????? ??????.
#Walker(X,Y,Prec) - ???? ? ???? ? ???????????? X,Y. ?????????? 1 ? ?????? ????????? ?????????? ????, ? 0 - ??? ??????????? ?????? (???? ?? ??????)
#Tracer(StartDir,Direction) - ??????????? 1 ????. ?????????? ??????????? ?? ???????? ?????????? ?????????? ? ?????. StartDir #- ??????????? ?????????? ????????, Direction (-1 ??? +1) ??????????? ??????. -1 - ?? ??????? ???????, +1 ?????? ??????? #???????. ??????????? ?????? ?????????? ??????? ???????:
#1 - ????? ????
#2 - ????
#3 - ?????? ????
#4 - ??????
#5 - ?????? ?????
#6 - ?????
#7 - ????? ?????
#8 - ?????
#Tracer(StartDir,Direction) - ???????? ???????? ??? ??????? ????? ?????? ??? ??? ??? ????? ???????? ????? ?????????? (1 #?????? ??????? = 1 ??? ??????).
#####################################################
# WW W WW AA LL Kk KK EE EE RRR #
# WW W WW AA A LL Kk K EEE R R #
# WW W WW AA A LL KKK EEEEE R R #
# WW WW WW AAAA LL KKK EEE RRR #
# WWW WWW AA A LLLL KK Kk EE EE R RR #
####################################################
var MaxTraceDistance=10
var TraceLoopIncrease=5#?????????? MaxTraceDistance ??? ?????????? ?????????? ?????
var LimitTrace=15#??????? ????? ? ??? ??????? ?? ????????? ????? ?????? ?????????? ??????? (?????? ???).
var Speed=2
var StepTimeOut=500#??????? ????. ????????????? ?? ? ?????? ?????, ? ? ?????? ???? + ?????? ?????.
# ??? ?????? - 500+Ping
# ??? ????/?????? ?? ?????? - 300+Ping
# ??? ?? ?????? - 150 + Ping
var CheckCnt=1 #?????????? ?????? ????????. ??????????? ? ??????? ??? ???????. ???????????? ?????? ?? ??????? ?? ???????????? ????????. ??? ??????? ????? ????? ????.
var DynamicPause=30 #??????????? ????? ? ??????. ??? ?????? ????? - ??? ?????? ?????? ? ??? ?????? ???????? ??????????.
sub ttt()
walker(2886-5,757+4,1)
end sub
Sub Walker(GoX,GoY,Prec)
UO.SetGlobal("Logging","0")
UO.SetGlobal("BlindWalk","0")
var LastDir
var MoveRes
var TracerCnt
UO.SetGlobal("GlobalGoX",str(GoX))
UO.SetGlobal("GlobalGoY",str(GoY))
while not IsEnd(GoX,GoY,Prec)
TracerCnt = MaxTraceDistance
repeat
LogInfo('Just walking')
LastDir=GoUntilHit(GoX,GoY,Prec)
if IsEnd(GoX,GoY,Prec) then
return 1
end if
LogInfo('Tracing')
MoveRes = FullAroundTrace(LastDir,GoX,GoY,Prec,TracerCnt)
if TracerCnt > LimitTrace then
return 0
endif
TracerCnt = TracerCnt + TraceLoopIncrease
until MoveRes == 1
wend
return 1
end sub
Sub FullAroundTrace(StartDir,GoX,GoY,Prec,MaxTrace)
var LineX=UO.GetX()
var LineY=UO.GetY()
var CurDir=StartDir
var Direction=CountDirection(GoX,GoY,CurDir,Prec)
var StartX,StartY
var MovesDone=0
repeat
StartX=UO.GetX()
StartY=UO.GetY()
CurDir=Tracer(CurDir,Direction,Prec)
if (CurDir==GetDir(GoX,GoY,Prec)) then
return 1
endif
if MovesDone>0 and PrevMoveCross(GetDirToDir(UO.GetDir(),Prec),LineX,LineY,GoX,GoY,StartX,StartY,Prec) then
return 1
end if
MovesDone=MovesDone+1
CurDir=AddToDir(CurDir,-Direction,Prec)
until MovesDone>MaxTrace
return 0
end sub
Sub CountDirection(GoX,GoY,StartDir,Prec)
var GoDir=GetDir(GoX,GoY,Prec)
var MyX=UO.GetX()
var MyY=UO.GetY()
if GoDir<StartDir then
return -1
end if
if GoDir>StartDir then
return 1
end if
if Abs(MyX-GoX)>Abs(MyY-GoY) then
if (GoDir==3) OR (GoDir==7) then
return -1
else
return 1
end if
else
if (GoDir==1) or (GoDir==5) then
return -1
else
return 1
end if
end if
end sub
Sub PrevMoveCross(Dir,x1,y1,x2,y2,StartX,StartY,Prec)
var x3,y3,x4,y4
x3=StartX
y3=StartY
x4=StartX+(XFromDir(Dir)-StartX)*Speed
y4=StartY+(YFromDir(Dir)-StartY)*Speed
return LinesCrossing(x1,y1,x2,y2,x3,y3,x4,y4,Prec)
end sub
Sub LinesCrossing(x1,y1,x2,y2,x3,y3,x4,y4,Prec)
if x1==x3 and y1==y3 then
return false
end if
LogInfo('Start cross check')
var ua1=(x4-x3)*(y1-y3)-(y4-y3)*(x1-x3)
var ub1=(y4-y3)*(x2-x1)-(x4-x3)*(y2-y1)
var ua2=(x2-x1)*(y1-y3)-(y2-y1)*(x1-x3)
var ub2=(y4-y3)*(x2-x1)-(x4-x3)*(y2-y1)
#Check for parallel lines
if (ub1 == 0) or (ub2 == 0) then
return false
end if
var u1=ua1/ub1
var u2=ua2/ub2
if IsDiap(u1,0,1,0.01) and IsDiap(u2,0,1,0.01) then
LogInfo('Vectors crossing info:')
LogInfo('x1= '+str(x1))
LogInfo('y1= '+str(y1))
LogInfo('x2= '+str(x2))
LogInfo('y2= '+str(y2))
LogInfo('x3= '+str(x3))
LogInfo('y3= '+str(y3))
LogInfo('x4= '+str(x4))
LogInfo('y4= '+str(y4))
return true
else
LogInfo('End cross check')
return false
end if
end sub
Sub IsDiap(X,X0,X1,Prec)
if X<=X0+Prec and X>=X1-Prec OR X>=X0-Prec and X<=X1+Prec then
return true
end if
return false
end sub
Sub GoUntilHit(GoX,GoY,Prec)
var LastDir
LastDir=GetDir(GoX,GoY,Prec)
var CouldMove
repeat
LastDir=GetDir(GoX,GoY,Prec)
if LastDir<>0 and not IsEnd(GoX,GoY,Prec) then
CouldMove=TryDir(LastDir,Prec)
end if
until LastDir==0 or IsEnd(GoX,GoY,Prec) or not CouldMove
return LastDir
end sub
Sub IsEnd(GoX,GoY,Prec)
if Abs(UO.GetX()-GoX)<=Prec and Abs(UO.GetY()-GoY)<=Prec then
LogInfo('END FOUND')
return true
else
return false
end if
end sub
Sub GetDir(GoX,GoY,Prec)
var MyX=UO.GetX()
var MyY=UO.GetY()
var DiffX=Abs(UO.GetX()-GoX)
var DiffY=Abs(UO.GetY()-GoY)
var GoDir=0
if (DiffX/(DiffY+0.1))>=2 then
if (MyX>GoX) then
GoDir=7
else
GoDir=3
end if
else
if (DiffY/(DiffX+0.1))>=2 then
if (MyY>GoY) then
GoDir=5
else
GoDir=1
end if
else
if (MyX>GoX) and (MyY>GoY) then
GoDir=6
else
if (MyX>GoX) and (MyY<GoY) then
GoDir=8
else
if (MyX<GoX) and (MyY>GoY) then
GoDir=4
else
if (MyX<GoX) and (MyY<GoY) then
GoDir=2
end if
end if
end if
end if
end if
end if
return GoDir
end sub
Sub Tracer(StartDir,Direction,Prec)
var CurDir=StartDir
var Result
repeat
Result=TryDir(CurDir,Prec)
if not Result then
CurDir=AddToDir(CurDir,Direction,Prec)
end if
until Result
return Result
end sub
Sub AddToDir(Dir,Cnt,Prec)
var NewDir=Dir
NewDir=NewDir+Cnt
while NewDir>8
NewDir=NewDir-8
wend
while NewDir<1
NewDir=NewDir+8
wend
return NewDir
end sub
Sub TryDir(Dir,Prec)
var BegX=UO.GetX() # Ia?aeuiia O
var BegY=UO.GetY() # Ia?aeuiia Y
var Counter=0
var GoX=BegX
var GoY=BegY
GoX=XFromDir(Dir)
GoY=YFromDir(Dir)
if not IsPass(GoX,GoY) then
LogInfo(str(GoX)+':'+str(GoY)+' is not passable')
return false
end if
return TurnAndGoDir(Dir,Prec)
end sub
Sub XFromDir(Dir)
if Dir==2 OR Dir==3 Or Dir==4 then
return (UO.GetX()+1)
end if
if Dir==6 OR Dir==7 Or Dir==8 then
return (UO.GetX()-1)
end if
return (UO.GetX())
end sub
Sub YFromDir(Dir)
if Dir==8 OR Dir==1 Or Dir==2 then
return (UO.GetY()+1)
end if
if Dir==4 OR Dir==5 Or Dir==6 then
return (UO.GetY()-1)
end if
return (UO.GetY())
end sub
Sub TurnAndGoDir(Dir,Prec)
var StartDir=GetDirToDir(UO.GetDir(),Prec)
var StartX=UO.GetX()
var StartY=UO.GetY()
var EndDir
var Counter=0
var TestCounter=CheckCnt
#Direction Test
repeat
Counter = 0
LogInfo('Dir: '+str(StartDir)+' Counter: '+str(Counter))
PressDir(Dir)
repeat
EndDir=GetDirToDir(UO.GetDir(),Prec)
wait(DynamicPause)
Counter=Counter+1
until StartDir<>EndDir or StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=StepTimeOut/DynamicPause
TestCounter = TestCounter - 1
LogInfo('Dir: '+str(EndDir)+' Counter: '+str(Counter))
until TestCounter <= 0 or Counter < StepTimeOut/DynamicPause
if Counter>=StepTimeOut/DynamicPause then
LogInfo('Direction timeout reached')
return 0
end if
#End direction Test
if StartY<>UO.GetY() or StartX<>UO.GetX() then
return Dir
end if
#Start Primary test
TestCounter=CheckCnt
repeat
GoDir(Dir,Prec)
Counter=0
repeat
wait(DynamicPause)
Counter=Counter+1
until StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=StepTimeOut/DynamicPause
TestCounter = TestCounter - 1
until TestCounter <= 0 or Counter < StepTimeOut/DynamicPause
#End primary test
if Counter>=StepTimeOut/DynamicPause then
LogInfo('Step timeout reached')
return 0
else
return Dir
end if
end sub
Sub GetDirToDir(GotDir,Prec)
var ChangedDir=-GotDir
ChangedDir=AddToDir(ChangedDir,5,Prec)
return ChangedDir
end sub
Sub DirToInj(Dir)
dim Dirs[9]
Dirs[1]=1
Dirs[2]=2
Dirs[3]=3
Dirs[4]=6
Dirs[5]=9
Dirs[6]=8
Dirs[7]=7
Dirs[8]=4
return (Dirs[Dir])
end sub
Sub PressDir(Dir)
dim Dirs[9]
Dirs[1]=35
Dirs[2]=40
Dirs[3]=34
Dirs[4]=39
Dirs[5]=33
Dirs[6]=38
Dirs[7]=36
Dirs[8]=37
UO.Press(Dirs[Dir],1)
end sub
Sub GoDir(Dir,Prec)
dim Dirs[9]
Dirs[1]=35
Dirs[2]=40
Dirs[3]=34
Dirs[4]=39
Dirs[5]=33
Dirs[6]=38
Dirs[7]=36
Dirs[8]=37
var DistanceX=Abs(UO.GetX()-val(UO.GetGlobal("GlobalGoX")))
var DistanceY=Abs(UO.GetY()-val(UO.GetGlobal("GlobalGoY")))
var GoDistance
if (DistanceX-Prec)<Speed then
GoDistance=DistanceX-Prec
else
if (DistanceY-Prec)<Speed then
GoDistance=DistanceY-Prec
else
GoDistance=Speed
endif
endif
UO.Press(Dirs[Dir],GoDistance)
end sub
Sub IsPass(X,Y)
if UO.GetGlobal("BlindWalk") then
return true
endif
dim Types[60]
Types[1]=3
Types[2]=25
Types[3]=51
Types[4]=63
Types[5]=113
Types[6]=140
Types[7]=172
Types[8]=219
Types[9]=232
Types[10]=235
Types[11]=239
Types[12]=243
Types[13]=248
Types[14]=251
Types[15]=264
Types[16]=267
Types[17]=282
Types[18]=289
Types[19]=321
Types[20]=379
Types[21]=420
Types[22]=440
Types[23]=476
Types[24]=499
Types[25]=513
Types[26]=542
Types[27]=578
Types[28]=586
Types[29]=622
Types[30]=700
Types[31]=804
Types[32]=1740
Types[33]=1758
Types[34]=1770
Types[35]=1779
Types[36]=1779
Types[37]=1881
Types[38]=1886
Types[39]=1801
Types[40]=1805
Types[41]=1813
Types[42]=1820
Types[43]=1831
Types[44]=1833
Types[45]=1843
Types[46]=1850
Types[47]=1873
Types[48]=1876
Types[49]=1885
Types[50]=1888
Types[51]=1946
Types[52]=1969
Types[53]=2500
Types[54]=2539
for var i=1 TO 53 STEP 2
if UO.PrivateGetTile(X,Y,-1,Types[i],Types[i+1]) then
return true
end if
next
return false
end sub
Sub LogInfo(Line)
if not UO.GetGlobal("Logging")=="0" then
UO.TextOpen()
UO.TextPrint(str(UO.GetX())+":"+str(UO.GetY())+" - "+Line);
end if
end sub
Sub Abs(X)
if X>0 then
return X
else
return (-X)
end if
end sub
########################################## ????? ??????? 3 ##########################