Ходилка

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
Leo
Expert!
Posts: 791
Joined: 2005-01-15 19:15:05
Location: Dragon World
Contact:

Ходилка

Post by Leo »

Скажите, как переделаьб ходилку типа X,Y,Target в X,Y?

Code: Select all

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
Endif
Else
dx=x-UO.GetX()
dy=y-UO.GetY()
If dx==0 AND dy==0 Then
Exit=1
Endif
Endif
If dx<>0 AND dy<>0 Then
If dx>0 AND dy>0 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
If StepSucess==-1 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
StepSucess=Go(1,39,300) ;NE - RightArrow
If StepSucess==-1 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
Endif
Endif
Endif
If dx>0 AND dy<0 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
If StepSucess==-1 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
StepSucess=Go(3,40,300) ;SE - DownArrow
If StepSucess==-1 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
Endif
Endif
Endif
If dx<0 AND dy>0 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
If StepSucess==-1 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
StepSucess=Go(7,38,300) ;WN - UpArrow
If StepSucess==-1 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
Endif
Endif
Endif
If dx<0 AND dy<0 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
If StepSucess==-1 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
StepSucess=Go(5,37,300) ;SW - LeftArrow
If StepSucess==-1 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
Endif
Endif
Endif
Endif
If dx<>0 AND dy==0 Then
If dx>0 Then
StepSucess=Go(2,34,300) ;E - PgDown
If StepSucess==-1 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
If StepSucess==-1 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
Endif
StepSucess=Go(2,34,300) ;E - PgDown
Endif
Endif
If dx<0 Then
StepSucess=Go(6,36,300) ;W - Home
If StepSucess==-1 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
If StepSucess==-1 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
Endif
StepSucess=Go(6,36,300) ;W - Home
Endif
Endif
Endif
If dx==0 AND dy<>0 Then
If dy>0 Then
StepSucess=Go(4,35,300) ;S - End
If StepSucess==-1 Then
StepSucess=Go(3,40,300) ;SE - DownArrow
If StepSucess==-1 Then
StepSucess=Go(5,37,300) ;SW - LeftArrow
Endif
StepSucess=Go(4,35,300) ;S - End
Endif
Endif
If dy<0 Then
StepSucess=Go(0,33,300) ;N - PgUp
If StepSucess==-1 Then
StepSucess=Go(1,39,300) ;NE - RightArrow
If StepSucess==-1 Then
StepSucess=Go(7,38,300) ;WN - UpArrow
Endif
StepSucess=Go(0,33,300) ;N - PgUp
Endif
Endif
Endif
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
 
Endif
Endif
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
 
Endif
If x==UO.GetX() AND y==UO.GetY() AND OldDir<>UO.GetDir() Then
UO.Press(key)
wait(walkwait)
Endif
If x==UO.GetX() AND y==UO.GetY() Then
 
Endif
If x==UO.GetX() AND y==UO.GetY() Then
UO.Print("Zasada!")
return -1
Else
return 1
Endif
end sub
I'm
Expert!
Posts: 1396
Joined: 2004-10-15 22:38:04
Location: Moscow City.
Contact:

Post by I'm »

Мне почемуто кажется что нет смысла её переделовать.
ты можеш написать так WalkN(X,Y,"") и отправишся к точке XY
Leo
Expert!
Posts: 791
Joined: 2005-01-15 19:15:05
Location: Dragon World
Contact:

Post by Leo »

Это конечно можно, но скрипт говорит, что цель не найдена...
Savage
Expert!
Posts: 1205
Joined: 2004-04-04 11:13:54
Location: Балаково, Саратовская обл.
Contact:

Post by Savage »

Третий параметр серийник цели. Если он указан то чар чухает к ней. Если там пусто "" то чар чухает по координатам. Если у тебя правленная ходилка, найди исходную.
Destruction
Junior Expert
Posts: 3221
Joined: 2004-06-24 22:08:56

Post by Destruction »

Ваще скрипт смтреть не хочу, но

Code: Select all

If Target<>"" Then 

говорит само за себя - отращиваем прямые руки и все должно работать :twisted:
YokoInjection CodeSweeper
Function not found?
Possession of mathematics at the level of art - a gift that is only available for election.
Sorry for my clumsy English.
Telegram: @tatikom
Savage
Expert!
Posts: 1205
Joined: 2004-04-04 11:13:54
Location: Балаково, Саратовская обл.
Contact:

Post by Savage »

Destruction wrote:Ваще скрипт смтреть не хочу, но

Code: Select all

If Target<>"" Then 

говорит само за себя - отращиваем прямые руки и все должно работать :twisted:

Самый умный? :) Скопируй это в нотепад и подвигай стрелки.
Askaneli
Sphere expert
Posts: 1143
Joined: 2004-10-01 08:27:38
Location: Уфа

Post by Askaneli »

Savage wrote:
Destruction wrote:Ваще скрипт смтреть не хочу, но

Code: Select all

If Target<>"" Then 

говорит само за себя - отращиваем прямые руки и все должно работать :twisted:

Самый умный? :) Скопируй это в нотепад и подвигай стрелки.

Не получается отойти от дел ?
Сделал дело - флуди смело !!!
Savage
Expert!
Posts: 1205
Joined: 2004-04-04 11:13:54
Location: Балаково, Саратовская обл.
Contact:

Post by Savage »

Пока летишь куда нить далеко - заняться нечем, вот форум листаю иногда.
пс, я счас в иву гоняю. Платная но интересная всегда хотел про космос гаму магия в печенках уже...
www.eve-online.com
www.eve-online.ru
Beyonder
Expert!
Posts: 388
Joined: 2005-04-23 10:19:43
Contact:

Post by Beyonder »

Это к чему?
Post Reply