Page 1 of 1

Помогите со скриптом разобратся.

Posted: 2008-12-19 12:35:58
by Franco Nero
Здрастуите , я играю на шарде ДРВ и у меня есть скрипт которыи должен выполнять функции, чар встает на локации с монстрами и бьет определенного монстра режит его дагером заберает с него весь лут ну или если можно подредактировать определенные кампоненты, лечится после убииства ...ну и бежит к следующему монстру или ждет респауна.

Вот сам скрипт.

sub feather_bot()
while not uo.dead()
while uo.Count('0x1bd1')<=2000 ## Не понятно что это
if find_harpy()==1 then
kill_harpy()
loot_harpy()
else
waiting_for_respawn()
wait(10000)
endif
wend
end sub

sub find_harpy()
uo.set('finddistance', '30')
uo.findtype('0x001E', -1, 'ground') ##Находим Гарпию
if uo.findcount()>0 then
uo.print('Есть контакт!')
return 1
else
uo.print('Нэту никто!')
return 0
endif
end sub

sub kill_harpy()
var x, y
uo.addobject('harpy', 'finditem')
x = uo.getx('harpy')
y = uo.gety('harpy')
gotoXY(x,y,20)
uo.deletejournal()
uo.arm(2)
uo.attack('harpy')
uo.press(37)
while not uo.injournal('You gain')
wait(100)
wend
uo.print('Сдохли сЦуки!')
wait(1000)
end sub

sub loot_harpy()
var x, y, i
uo.addobject('harpy_corpse', 'lastcorpse')
if uo.getname('harpy_corpse') == 'A corpse of a harpy' then
x=uo.getX('harpy_corpse')
y=uo.getY('harpy_corpse')
gotoXY(x,y,1)
uo.deletejournal()
while not uo.injournal('You place the items on the corpse.')
uo.waittargetobject('harpy_corpse')
uo.usetype('0x0f51') ## режем труп гарпии
wait(5000)
wend
for i=1 to 10
uo.emptycontainer('100', 'harpy_corpse') ## лутим начисто
wait(500)
next
else
uo.ignore('harpy_corpse')
endif
wait(1000)
end sub




sub waiting_for_respawn()
uo.warmode(0)
while not uo.Hidden()
uo.useskill('Hiding')
wait(1000)
wend
end sub


sub abs(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub

sub autoheal() ## Этот макрос необходимо запускать параллельно, если жить охота :)
while not uo.dead()
wait(1000)
if uo.life<uo.str-10 then
while uo.life<uo.str
uo.exec("bandageself")
wait(3000)
wend
endif
wait(1000)
wend
end sub

sub gotoxy(x,y,prec)
var ld=0,ldc=0
var dx,dy
var mx,my
var ox,oy,mk,k
#uo.print(">")
#uo.track("1",str(x),str(y))
start:
mx=UO.GetX()
my=UO.GetY()
dx=mx-x
if dx<0 then
dx=0-dx
endif
dy=my-y
if dy<0 then
dy=0-dy
endif
if dy>dx then
dx=dy
end if
if dx<=prec then
return
end if
if not ldc then
uo.print(STR(dx))
end if
if dx<3 then
mk=70
else
mk=15
end if

ox=mx
oy=my
for k=1 to mk
mx=UO.GetX()
my=UO.GetY()
if mx<>ox or my<>oy then
goto sdidapl
end if
wait(10)
next
sdidapl:

mx=UO.GetX()
my=UO.GetY()
dx=mx-x
if dx<0 then
dx=0-dx
endif
dy=my-y
if dy<0 then
dy=0-dy
endif
if dy>dx then
dx=dy
end if

if dx<=prec then
return
end if
if ld==dx then
ldc=ldc+1
if ldc>100 then
uo.print("Can not reach location!")
return
end if
else
ld=dx
end if

if mx==x then
if my==y then
return
endif
if my>y then
#UO.Print("UR")
UO.Press(33)
goto start
endif
#UO.Print("DL")
UO.Press(35)
goto start
end if
if mx<x then
if my>y then
#UO.Print("R")
UO.Press(39)
goto start
endif
if my==y then
#UO.Print("DR")
UO.Press(34)
goto start
endif
#UO.Print("D")
UO.Press(40)
goto start
end if
if my<y then
#UO.Print("L")
UO.Press(37)
goto start
endif
if my==y then
#UO.Print("LU")
UO.Press(36)
goto start
endif
#UO.Print("U")
UO.Press(38)
goto start
end sub


Мне нужно что бы чар не снимал меч с щитом ...

А вот еще скрипт ... тут то же не понятно ..но наверно хадилка полутче.

DIM R[5]
R[1] = 0x0018 # Oei Lich.
R[2] = 0x0018
R[3] = 0x0018
R[4] = 0x0018
R[5] = 0x0018
VAR LastTimer, Attack
var a
repeat
for a=1 to 5
UO.DeleteJournal()
UO.FindType(R[a],-1,'ground')
if UO.FindCount("finditem")>0 then
Attack=UO.GetSerial('finditem')
UO.Exec('warmode 1')
UO.Attack(Attack)
WalkN(0,0,Attack)
LastTimer=UO.Timer()
repeat
wait(2000)
until uo.dead(Attack) or UO.InJournal('Body') OR LastTimer+150<UO.Timer()
endif
wait(500)
next
wait(200)
until uo.dead()
end sub

#==============================================================
# WalkN(X,Y,Serial) - char is walking by dX and dY step
# sub using Home, End, PgUp, PgDown keys
# d'not rebind this key from default action!
# serial - Serial of target or "" - string
# walkwait - delay after keypress
# Example:
# WalkN(5134,1086,'') - go to coordinates
# WalkN(0,0,'0x12345678') - go to target position
#--------------------------------------------------------------
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()
UO.Print("Target locked!")
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
CheckLag()
Endif
Endif

UO.Press(key)
wait(walkwait)

If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
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
CheckLag()
Endif

If x==UO.GetX() AND y==UO.GetY() Then
UO.Print("Zasada!")
return -1
Else
return 1
Endif
end sub

sub CheckLag()
UO.DeleteJournal()
UO.Click('backpack')
repeat
wait(500)
until UO.InJournal('backpack')
end sub


Только здесь он не хилится и не лутает .

Posted: 2008-12-19 12:39:22
by Franco Nero
Вот еще скриптик ...только их все нужно доработать из всех взять лутшее и создать один потрясающии скрипт а у меня не получается как не сторался .

sub kill()
uo.set('finddistance','8')
uo.findtype('тип скелета','-1','ground')
while uo.findcount()>0
go(uo.getx, uo.gety,'finditem')
uo.attack('finditem')
while uo.gethp('finditem')<>0
wait(100)
wend
loot()
uo.findtype('тип скелета','-1','ground')
wend
endsub

sub loot()
var corpse='0x2006'
var waittime=1000
var body,bodypack,i
DIM Loot[12]
Loot[0]=0x19B9
Loot[1]=0x19BA
Loot[2]=0x19B7
Loot[3]=0x19B8
Loot[4]=0x141A
Loot[5]=0x1416
Loot[6]=0x1410
Loot[7]=0x1417
Loot[8]=0x1418
Loot[9]=0x1419
Loot[10]=0x0E76
Loot[11]=0x1413
Loot[12]=0x1086
uo.set('finddistance','2')
while uo.countonground(corpse)>0
uo.findtype(corpse,'-1','ground')
body=uo.getserial('finditem')

uo.useobject('backpack')

repeat
wait(100)
until uo.getserial('lastcontainer')==uo.getserial('backpack')

uo.useobject(body)
repeat
wait(100)
until uo.getserial('lastcontainer')<>uo.getserial('backpack')

bodypack=uo.getserial('lastcontainer')
For i=0 to 12
repeat
UO.FindType(Loot[i],-1,bodypack)
if UO.GetQuantity('finditem') then
UO.MoveItem('finditem','backpack')
repeat
wait(100)
until uo.containerof('finditem')==uo.getserial('backpack')
wait(waittime)
endif
until uo.findcount()==0
next
uo.ignore(body)
wend
endsub

sub go(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()
UO.Print("Target locked!")
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
CheckLag()
Endif
Endif

UO.Press(key)
wait(walkwait)

If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
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
CheckLag()
Endif

If x==UO.GetX() AND y==UO.GetY() Then
UO.Print("Zasada!")
return -1
Else
return 1
Endif
end sub

sub CheckLag()
UO.DeleteJournal()
UO.Click('backpack')
repeat
wait(500)
until UO.InJournal('backpack')
end sub


##########################################

Если не сложно подпишите где в скрипте вставлять данные.
Я совсем в этом деле навичек.

Posted: 2008-12-19 16:08:59
by admir
оформи скрипты под тег [cоde] ... [/cоde]

Posted: 2008-12-20 13:49:58
by Franco Nero
Не понимаю что ты имееш ввиду ..я зделал все что в моих силах ..а теперья хз как зделать единныи из всех 3х скриптов нормальныи скрипт рабочии.

Posted: 2008-12-20 22:37:15
by Franco Nero
Admir можеш подредактировать скрипт я не могу понять где куда чего вставить ..что бы чар не снимал аружие с щитом и что бы список монстров я хз как зделать этот список ну например скилетов и личеи,
и чтоб резал дагером их снова брал в руки меч с щитом и лутал по списку ...а как вот список вещеи я не знаю ...помоги пожалуисто очень прошу .

Posted: 2008-12-20 22:37:49
by Franco Nero
вот этот скрипт ...тут он на гарпию настроен:




sub feather_bot()
while not uo.dead()
while uo.Count('0x1bd1')<=2000 ## Не понятно что это
if find_harpy()==1 then
kill_harpy()
loot_harpy()
else
waiting_for_respawn()
wait(10000)
endif
wend
end sub

sub find_harpy()
uo.set('finddistance', '30')
uo.findtype('0x001E', -1, 'ground') ##Находим Гарпию
if uo.findcount()>0 then
uo.print('Есть контакт!')
return 1
else
uo.print('Нэту никто!')
return 0
endif
end sub

sub kill_harpy()
var x, y
uo.addobject('harpy', 'finditem')
x = uo.getx('harpy')
y = uo.gety('harpy')
gotoXY(x,y,20)
uo.deletejournal()
uo.arm(2)
uo.attack('harpy')
uo.press(37)
while not uo.injournal('You gain')
wait(100)
wend
uo.print('Сдохли сЦуки!')
wait(1000)
end sub

sub loot_harpy()
var x, y, i
uo.addobject('harpy_corpse', 'lastcorpse')
if uo.getname('harpy_corpse') == 'A corpse of a harpy' then
x=uo.getX('harpy_corpse')
y=uo.getY('harpy_corpse')
gotoXY(x,y,1)
uo.deletejournal()
while not uo.injournal('You place the items on the corpse.')
uo.waittargetobject('harpy_corpse')
uo.usetype('0x0f51') ## режем труп гарпии
wait(5000)
wend
for i=1 to 10
uo.emptycontainer('100', 'harpy_corpse') ## лутим начисто
wait(500)
next
else
uo.ignore('harpy_corpse')
endif
wait(1000)
end sub




sub waiting_for_respawn()
uo.warmode(0)
while not uo.Hidden()
uo.useskill('Hiding')
wait(1000)
wend
end sub


sub abs(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub

sub autoheal() ## Этот макрос необходимо запускать параллельно, если жить охота
while not uo.dead()
wait(1000)
if uo.life<uo.str-10 then
while uo.life<uo.str
uo.exec("bandageself")
wait(3000)
wend
endif
wait(1000)
wend
end sub

sub gotoxy(x,y,prec)
var ld=0,ldc=0
var dx,dy
var mx,my
var ox,oy,mk,k
#uo.print(">")
#uo.track("1",str(x),str(y))
start:
mx=UO.GetX()
my=UO.GetY()
dx=mx-x
if dx<0 then
dx=0-dx
endif
dy=my-y
if dy<0 then
dy=0-dy
endif
if dy>dx then
dx=dy
end if
if dx<=prec then
return
end if
if not ldc then
uo.print(STR(dx))
end if
if dx<3 then
mk=70
else
mk=15
end if

ox=mx
oy=my
for k=1 to mk
mx=UO.GetX()
my=UO.GetY()
if mx<>ox or my<>oy then
goto sdidapl
end if
wait(10)
next
sdidapl:

mx=UO.GetX()
my=UO.GetY()
dx=mx-x
if dx<0 then
dx=0-dx
endif
dy=my-y
if dy<0 then
dy=0-dy
endif
if dy>dx then
dx=dy
end if

if dx<=prec then
return
end if
if ld==dx then
ldc=ldc+1
if ldc>100 then
uo.print("Can not reach location!")
return
end if
else
ld=dx
end if

if mx==x then
if my==y then
return
endif
if my>y then
#UO.Print("UR")
UO.Press(33)
goto start
endif
#UO.Print("DL")
UO.Press(35)
goto start
end if
if mx<x then
if my>y then
#UO.Print("R")
UO.Press(39)
goto start
endif
if my==y then
#UO.Print("DR")
UO.Press(34)
goto start
endif
#UO.Print("D")
UO.Press(40)
goto start
end if
if my<y then
#UO.Print("L")
UO.Press(37)
goto start
endif
if my==y then
#UO.Print("LU")
UO.Press(36)
goto start
endif
#UO.Print("U")
UO.Press(3
goto start
end sub

Posted: 2008-12-21 18:14:11
by Franco Nero
Ну господа ну помогите ... подскажите.