Page 1 of 1

Переделайте Скрипт

Posted: 2007-07-09 20:06:35
by PIKACHU-Bayt
Вот тут у меня мининг я писал половину сам, но так как я не умею работать с файлами в скриптах БОЛЬШАЯ ПРОСЬБА- Переправить этот скрипт чтоб тайлы читал с файла!

Code: Select all

sub main()
var ox,oy,temp,i
DIM Tiles[99]
Tiles[0]= "1340 1224 1261 0"
Tiles[1]= "1340 1224 1260 0"
Tiles[2]= "1340 1225 1262 0"
Tiles[3]= "1340 1225 1261 0"
Tiles[4]= "1340 1225 1260 0"
Tiles[5]= "1340 1225 1259 0"
Tiles[6]= "1340 1225 1258 0"
Tiles[7]= "1340 1225 1257 0"
Tiles[8]= "1340 1226 1254 0"
Tiles[9]= "1340 1226 1255 0"
Tiles[10]= "1340 1226 1256 0"
Tiles[11]= "1340 1226 1257 0"
Tiles[12]= "1340 1226 1258 0"
Tiles[13]= "1340 1226 1259 0"
Tiles[14]= "1340 1226 1260 0"
Tiles[15]= "1340 1226 1261 0"
Tiles[16]= "1340 1226 1262 0"
Tiles[17]= "1340 1226 1263 0"
Tiles[18]= "1340 1227 1263 0"
Tiles[19]= "1340 1227 1262 0"
Tiles[20]= "1340 1227 1261 0"
Tiles[21]= "1340 1227 1260 0"
Tiles[22]= "1340 1227 1259 0"
Tiles[23]= "1340 1227 1258 0"
Tiles[24]= "1340 1227 1257 0"
Tiles[25]= "1340 1227 1256 0"
Tiles[26]= "1340 1227 1255 0"
Tiles[27]= "1340 1227 1254 0"
Tiles[28]= "1340 1227 1253 0"
Tiles[29]= "1340 1228 1253 0"
Tiles[30]= "1340 1228 1254 0"
Tiles[31]= "1340 1228 1255 0"
Tiles[32]= "1340 1228 1256 0"
Tiles[33]= "1340 1228 1257 0"
Tiles[34]= "1340 1228 1258 0"
Tiles[35]= "1340 1228 1259 0"
Tiles[36]= "1340 1228 1260 0"
Tiles[37]= "1340 1228 1261 0"
Tiles[38]= "1340 1229 1261 0"
Tiles[39]= "1340 1229 1260 0"
Tiles[40]= "1340 1229 1259 0"
Tiles[41]= "1340 1229 1258 0"
Tiles[42]= "1340 1230 1258 0"
Tiles[43]= "1340 1230 1259 0"
Tiles[44]= "1340 1230 1260 0"
Tiles[45]= "1340 1230 1261 0"
Tiles[46]= "1340 1231 1261 0"
Tiles[47]= "1340 1231 1260 0"
Tiles[48]= "1340 1231 1259 0"
Tiles[49]= "1340 1231 1258 0"
Tiles[50]= "1340 1231 1257 0"
Tiles[51]= "1340 1232 1257 0"
Tiles[52]= "1340 1232 1258 0"
Tiles[53]= "1340 1232 1259 0"
Tiles[54]= "1340 1232 1260 0"
Tiles[55]= "1340 1232 1261 0"
Tiles[56]= "1340 1232 1262 0"
Tiles[57]= "1340 1233 1262 0"
Tiles[58]= "1340 1233 1261 0"
Tiles[59]= "1340 1233 1260 0"
Tiles[60]= "1340 1233 1259 0"
Tiles[61]= "1340 1233 1258 0"
Tiles[62]= "1340 1233 1257 0"
Tiles[63]= "1340 1233 1256 0"
Tiles[64]= "1340 1233 1255 0"
Tiles[65]= "1340 1233 1254 0"
Tiles[66]= "1340 1233 1253 0"
Tiles[67]= "1340 1232 1253 0"
Tiles[68]= "1340 1231 1253 0"
Tiles[69]= "1340 1230 1253 0"
Tiles[70]= "1340 1230 1252 0"
Tiles[71]= "1340 1230 1251 0"
Tiles[72]= "1340 1230 1250 0"
Tiles[73]= "1340 1230 1249 0"
Tiles[74]= "1340 1230 1248 0"
Tiles[75]= "1340 1230 1247 0"
Tiles[76]= "1340 1231 1247 0"
Tiles[77]= "1340 1231 1248 0"
Tiles[78]= "1340 1231 1249 0"
Tiles[79]= "1340 1231 1250 0"
Tiles[80]= "1340 1231 1251 0"
Tiles[81]= "1340 1231 1252 0"
Tiles[82]= "1340 1232 1252 0"
Tiles[83]= "1340 1232 1251 0"
Tiles[84]= "1340 1232 1250 0"
Tiles[85]= "1340 1232 1249 0"
Tiles[86]= "1340 1232 1248 0"
Tiles[87]= "1340 1232 1247 0"
Tiles[88]= "1340 1232 1246 0"
Tiles[89]= "1340 1232 1245 0"
Tiles[90]= "1340 1233 1245 0"
Tiles[91]= "1340 1233 1246 0"
Tiles[92]= "1340 1233 1247 0"
Tiles[93]= "1340 1233 1248 0"
Tiles[94]= "1340 1233 1249 0"
Tiles[95]= "1340 1233 1250 0"
Tiles[96]= "1340 1233 1251 0"
Tiles[97]= "1340 1233 1252 0"
Tiles[98]= "1340 1234 1250 0"
Tiles[99]= "1340 1234 1251 0"
agan:
for i=0 to 99
temp=Tiles[i]
ox=VAL(temp[5]+temp[6]+temp[7]+temp[8])
oy=VAL(temp[10]+temp[11]+temp[12]+temp[13])
GoToTile(ox,oy,0,True)
next
GoToTile(2558,497,0,True)
goto agan
end sub

sub Kopat()
var ok
ok=0
#UO.say("guard")
while (ok<1)

UO.DeleteJournal()
uo.exec("waittargettile 0 0 0 0")
uo.usetype("pickaxe")
repeat
wait(10)
Until (UO.InJournal("loosen")) or (UO.InJournal("You put")) or (UO.InJournal("There is no ore")) or (UO.InJournal("etes")) or (UO.InJournal("target info"))
if UO.InJournal("You put") then 
Skid()
end if
if UO.InJournal("There is no ore") or (UO.InJournal("etes")) then
ok=1
end if
wend
end sub

Var MoveDelay=400
Var MoveNumber=1
Var Ep=0.172

Sub Perp(Dir) 
Var D 
D=Dir 
If Dir==1 Then 
  D=3 
EndIf 
If Dir==2 Then 
  D=4 
EndIf 
If Dir==3 Then 
  D=-1 
EndIf 
If Dir==4 Then 
  D=-2 
EndIf 
If Dir==-1 Then 
  D=-3 
EndIf 
If Dir==-2 Then 
  D=-4 
EndIf 
If Dir==-3 Then 
  D=1 
EndIf 
If Dir==-4 Then 
  D=2 
EndIf 
RETURN D 
EndSub 

Sub MoveOnce(Dir,Del,Rev) 
Var Num 
If Rev Then 
  Num=MoveNumber+1 
Else 
  Num=MoveNumber 
EndIf 
If (Num>0) and (Dir<>0) Then 
  If Dir==1 Then 
   UO.Press(38,Num,Del) 
  EndIf 
  If Dir==2 Then 
   UO.Press(33,Num,Del) 
  EndIf 
  If Dir==3 Then 
   UO.Press(39,Num,Del) 
  EndIf 
  If Dir==4 Then 
   UO.Press(34,Num,Del) 
  EndIf 
  If Dir==-1 Then 
   UO.Press(40,Num-1,Del) 
  EndIf 
  If Dir==-2 Then 
   UO.Press(35,Num,Del) 
  EndIf 
  If Dir==-3 Then 
   UO.Press(37,Num,Del) 
  EndIf 
  If Dir==-4 Then 
   UO.Press(36,Num,Del) 
  EndIf 
  If Rev Then 
   If Dir<>-1 Then 
    UO.Press(40,1,Del) 
   EndIf 
  EndIf 
EndIf 
EndSub 

Sub GetQDir(x,y) 
Var J=0 
If X==0 Then 
  J=1 
Else 
  If (Y/X)<ep Then 
   J=3 
  Else 
   If (X/Y)<ep Then 
    J=1 
   Else 
    J=2 
   EndIf 
  EndIf 
EndIf 
RETURN J 
EndSub 

sub GetDir(myx,myy,ox,oy) 
Var I,J 
J=0 
Var X=ox-myx 
Var Y=oy-myy 
I=GetQDir(Abs(X),Abs(Y)) 
If X>=0 Then 
  If Y>=0 Then 
   If I==1 Then 
    J=-2 
   Else 
    If I==2 Then 
     J=-1 
    Else 
     If I==3 Then 
      J=4 
     EndIf 
    EndIf 
   EndIf 
  Else 
   If I==1 Then 
    J=2 
   Else 
    If I==2 Then 
     J=3 
    Else 
     If I==3 Then 
      J=4 
     EndIf 
    EndIf 
   EndIf 
  EndIf 
Else 
  If Y>=0 Then 
   If I==1 Then 
    J=-2 
   Else 
    If I==2 Then 
     J=-3 
    Else 
     If I==3 Then 
      J=-4 
     EndIf 
    EndIf 
   EndIf 
  Else 
   If I==1 Then 
    J=2 
   Else 
    If I==2 Then 
     J=1 
    Else 
     If I==3 Then 
      J=-4 
     EndIf 
    EndIf 
   EndIf 
  EndIf 
EndIf 
RETURN J 
endsub 

sub abs(a) 
Var b 
If a<0 Then 
  b=-a 
Else 
  b=a 
endif 
return b 
endsub 

Sub PermResend() 
Var Mn=9 
Repeat 
  UO.Resend() 
  Wait(MoveDelay*Mn) 
Until (1>2) 
EndSub 

sub max(A,B) 
Var C 
If A>B Then 
  C=A 
Else 
  C=B 
EndIf 
Return C 
EndSub 

sub GetDistance(X,Y) 
return max(abs(X-uo.getx()),abs(Y-uo.gety())) 
endsub 

sub GoToTile(OX,OY,N,S) 
var myx, myy, MD, J 
var Lx1 ,Ly1 
var Lx2 ,Ly2 
var Sx ,Sy 
var T 
var Des=N 
J=1 
MD=MoveDelay*1.5 
myx=uo.getx() 
myy=uo.gety() 
MoveOnce(GetDir(uo.getx(),uo.gety(),ox,oy),MD,False) 
Sx=0 
Sy=0 
Lx1=uo.getx()/2 
Ly1=uo.gety()/2 
Lx2=Lx1/2 
Ly2=Ly1/2 
T=UO.Timer() 
If (GetDistance(ox,oy)<>N) or ((not S) and GetDistance(ox,oy)>N) Then 
  UO.Exec('exec PermResend') 
EndIf 
While ((GetDistance(ox,oy)<>N) or ((not S) and GetDistance(ox,oy)>N)) and (OX>=0) and (OY>=0) 
  If ((UO.Timer()-T)*15>MoveDelay) Then 
   T=UO.Timer() 
   UO.Print(Str(uo.getx())+' '+Str(uo.gety())+' '+Str(ox)+' '+Str(oy)+' '+Str(GetDir(uo.getx(),uo.gety(),ox,oy))+' '+Str(T)) 
   Lx2=Lx1 
   Ly2=Ly1 
   Lx1=myx 
   Ly1=myy 
   myx=uo.getx() 
   myy=uo.gety() 
  endIf 
  MD=MoveDelay 
  If ((OX-uo.getx())*(OX-uo.getx())+(OY-uo.gety())*(OY-uo.gety())>0) Then 
   MD=MD*3/GetDistance(ox,oy) 
  EndIf 
  wait(MD) 
  If GetDistance(OX,OY)>Des Then 
   MoveOnce(GetDir(uo.GetX(),uo.GetY(),ox,oy),MD,False) 
  Else 
   If S Then 
    If GetDistance(OX,OY)<Des Then 
     If GetDistance(OX,OY)<>0 Then 
      MoveOnce(GetDir(ox,oy,uo.GetX(),uo.GetY()),MD,False) 
     Else 
      MoveOnce(GetDir(uo.GetX(),uo.GetY(),Lx2,Ly2),MD,False) 
     EndIf 
    EndIf 
   EndIf 
  EndIf 
  If GetDistance(OX,OY)<>Des Then 
   If (Lx2==uo.getx()) and (Ly2==uo.gety()) Then 
    If (Sx<>uo.getx()) or (Sy<>uo.gety()) Then 
     J=1 
    EndIf 
    J=J+1 
    UO.Resend() 
    Sx = uo.getx() 
    Sy = uo.gety() 
    Stun(ox,oy,J) 
   EndIf 
  EndIf 
Wend 
UO.Exec('terminate PermResend') 
Kopat()
endsub 

Sub Stun(X,Y,N) 
Var I 
Var myx 
Var myy 
myx = uo.getx() 
myy = uo.gety() 
For I=1 to N 
  MoveOnce(perp(GetDir(myx,myy,x,y)),MoveDelay,False) 
Next 
Wait(MoveDelay) 
UO.Resend() 
If (myx==uo.getx()) and (myy==uo.gety()) Then 
  For I=1 to N 
   MoveOnce(-perp(GetDir(myx,myy,x,y)),MoveDelay,False) 
  Next 
  Wait(MoveDelay) 
  UO.Resend() 
EndIf 
If (myx==uo.getx()) and (myy==uo.gety()) Then 
  For I=1 to N 
   MoveOnce(-GetDir(myx,myy,x,y),MoveDelay,False) 
  Next 
  Wait(MoveDelay) 
  Stun(x,y,N) 
EndIf    
EndSub 

sub NearTile(Obj,Des) 
var ox, oy, myx, myy, MD, J 
var Lx1 ,Ly1 
var Lx2 ,Ly2 
var Sx ,Sy 
var T 
UO.Click(Obj) 
MD=MoveDelay*1.5 
ox=uo.GetX(Obj) 
oy=uo.GetY(Obj) 
J=1 
myx = uo.getx() 
myy = uo.gety() 
Sx=0 
Sy=0 
Lx1=myx/2 
Ly1=myy/2 
Lx2=Lx1/2 
Ly2=Ly1/2 
T=UO.Timer() 
If not (UO.GetDistance(Obj)==Des) Then 
  UO.Exec('exec PermResend') 
EndIf 
While not (UO.GetDistance(Obj)==Des) 
  ox=uo.GetX(Obj) 
  oy=uo.GetY(Obj) 
  If ((UO.Timer()-T)*15>MoveDelay) Then 
   T=UO.Timer() 
   UO.Print('Go to '+Str(Des)+' to '+UO.GetName(Obj)) 
   UO.Print(Str(UO.GetDistance(Obj))) 
   UO.Print(Str(uo.GetX())+' '+Str(uo.GetY())+' '+Str(uo.GetX(Obj))+' '+Str(uo.GetY(Obj))+' '+Str(GetDir(uo.GetX(),uo.GetY(),uo.GetX(Obj),uo.GetY(Obj)))+' '+Str(T)) 
   Lx2=Lx1 
   Ly2=Ly1 
   Lx1=myx 
   Ly1=myy 
   myx=uo.getx() 
   myy=uo.gety() 
  endIf 
  MD=MoveDelay*1.5 
  If (UO.GetDistance(Obj)>0) Then 
   MD=MD/UO.GetDistance(Obj) 
  EndIf 
  wait(MD) 
  If UO.GetDistance(Obj)>Des Then 
   MoveOnce(GetDir(uo.GetX(),uo.GetY(),uo.GetX(Obj),uo.GetY(Obj)),MD,False) 
  Else 
   If UO.GetDistance(Obj)<Des Then 
    If UO.GetDistance(Obj)<>0 Then 
     MoveOnce(GetDir(uo.GetX(obj),uo.GetY(obj),uo.GetX(),uo.GetY()),MD,False) 
    Else 
     MoveOnce(GetDir(uo.GetX(),uo.GetY(),Lx2,Ly2),MD,False) 
    EndIf 
   EndIf 
  EndIf 
  If UO.GetDistance(Obj)<>Des Then 
   If (Lx2==uo.getx()) and (Ly2==uo.gety()) Then 
    If (Sx<>uo.getx()) or (Sy<>uo.gety()) Then 
     J=1 
    EndIf 
    J=J+1 
    UO.Resend() 
    Sx = uo.getx() 
    Sy = uo.gety() 
    Stun(uo.GetX(Obj),uo.GetY(Obj),J) 
   EndIf 
  EndIf 
Wend 
UO.Exec('terminate PermResend') 
endsub

sub Skid()

end sub

Posted: 2007-07-09 20:16:36
by PIKACHU-Bayt
И чтоб тайлы в файле были без ковычек и всего прочего чтоб одни цифры