Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub CreateTrack()
- DIM coord_x[500];
- DIM coord_y[500];
- var count = 0, x = 0, y = 0;
- uo.print('Ðåæèì çàïèñè ìàðøðóòà. add - äîáàâèòü; done - ñîõðàíèòü')
- uo.deletejournal()
- repeat
- Wait(50)
- if UO.InJournal("add") then
- uo.deletejournal()
- x = uo.getX('self');
- y = uo.getY('self');
- coord_x[count] = x;
- coord_y[count] = y;
- count = count + 1;
- uo.print('Äîáàâëåíà òî÷êà' + ' ' + STR(x) + ' ' + STR(y))
- endif
- until UO.InJournal("done")
- SaveCoordToFile(coord_x, coord_y, count)
- end sub
- sub WalkTrack()
- var f=file("d:\games\UO\inja\scripts\track.dat"), x = 0, y = 0;
- uo.Print('Çàãðóæàåì êîîðäèíàòû èç ôàéëà...')
- f.open()
- while not f.eof() and not fatal error
- x=safe call f.ReadNumber()
- y=safe call f.ReadNumber()
- if not fatal error then
- uo.print('Èäåì íà ' + STR(x) + ' ' + STR(y))
- GotoXY(x, y)
- x = uo.getX('self')
- y = uo.getY('self')
- uo.print('Ïðèøëè ' + STR(x) + ' ' + STR(y))
- endif
- wend
- f.close()
- end sub
- sub SaveCoordToFile(x, y, count)
- var f=file("d:\games\UO\inja\scripts\track.dat") , i = 0, s;
- f.open()
- f.create()
- for i = 0 to count-1
- s = safe call f.writeln(str(x[i])+' '+str(y[i]))
- next
- f.close()
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement