Advertisement
Guest User

Untitled

a guest
May 3rd, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1.  
  2.  
  3. sub CreateTrack()
  4. DIM coord_x[500];
  5. DIM coord_y[500];
  6. var count = 0, x = 0, y = 0;
  7.  
  8. uo.print('Ðåæèì çàïèñè ìàðøðóòà. add - äîáàâèòü; done - ñîõðàíèòü')
  9.  
  10. uo.deletejournal()
  11. repeat
  12. Wait(50)
  13.  
  14. if UO.InJournal("add") then
  15. uo.deletejournal()
  16. x = uo.getX('self');
  17. y = uo.getY('self');
  18. coord_x[count] = x;
  19. coord_y[count] = y;
  20. count = count + 1;
  21. uo.print('Äîáàâëåíà òî÷êà' + ' ' + STR(x) + ' ' + STR(y))
  22. endif
  23.  
  24. until UO.InJournal("done")
  25.  
  26. SaveCoordToFile(coord_x, coord_y, count)
  27.  
  28. end sub
  29.  
  30. sub WalkTrack()
  31. var f=file("d:\games\UO\inja\scripts\track.dat"), x = 0, y = 0;
  32. uo.Print('Çàãðóæàåì êîîðäèíàòû èç ôàéëà...')
  33. f.open()
  34. while not f.eof() and not fatal error
  35. x=safe call f.ReadNumber()
  36. y=safe call f.ReadNumber()
  37. if not fatal error then
  38. uo.print('Èäåì íà ' + STR(x) + ' ' + STR(y))
  39. GotoXY(x, y)
  40. x = uo.getX('self')
  41. y = uo.getY('self')
  42. uo.print('Ïðèøëè ' + STR(x) + ' ' + STR(y))
  43. endif
  44. wend
  45. f.close()
  46. end sub
  47.  
  48. sub SaveCoordToFile(x, y, count)
  49. var f=file("d:\games\UO\inja\scripts\track.dat") , i = 0, s;
  50. f.open()
  51. f.create()
  52. for i = 0 to count-1
  53. s = safe call f.writeln(str(x[i])+' '+str(y[i]))
  54. next
  55. f.close()
  56. end sub
  57.  
  58. sub GotoXY(x,y)
  59. var myX,myY,lastX=0,lastY=0,i,halt=0,z,r=0
  60. for i=1 to 60
  61. myX=uo.getX();
  62. myY=uo.getY();
  63. if LastX==myX and LastY==myY then
  64. halt=halt+1
  65. else
  66. halt=0
  67. end if
  68. if halt>=10 then
  69. if uo.GetDir()==1 then
  70. for z=0 to 8
  71. uo.Press(40)
  72. next
  73. end if
  74. if uo.GetDir()==3 then
  75. for z=0 to 8
  76. uo.Press(37)
  77. next
  78. end if
  79. if uo.GetDir()==5 then
  80. for z=0 to 8
  81. uo.Press(38)
  82. next
  83. end if
  84. if uo.GetDir()==7 then
  85. for z=0 to 8
  86. uo.Press(39)
  87. next
  88. end if
  89. halt=15
  90. end if
  91. if Numb(x-myX)<=1 and Numb(y-myY)<=2 then
  92. return 1
  93. end if
  94. if x<=myX then
  95. if y<=myY then
  96. for z=0 to 3
  97. uo.Press(38)
  98. next
  99. else
  100. for z=0 to 3
  101. uo.Press(37)
  102. next
  103. end if
  104. else
  105. if y<=myY then
  106. for z=0 to 3
  107. uo.Press(39)
  108. next
  109. else
  110. for z=0 to 3
  111. uo.Press(40)
  112. next
  113. end if
  114. end if
  115. lastX=myX
  116. lastY=myY
  117. wait(200)
  118. next
  119. return 0
  120. end sub
  121.  
  122. sub Numb(num)
  123. if num>=0 then
  124. return num
  125. else
  126. return num*(-1)
  127. end if
  128. end sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement