Долго мучался
Posted: 2007-09-17 16:44:11
Кароче проблема такая, включаю скрипт летит к вендору и пишит такую тему
Whom do you want to beg?
You can't see the target
Всё перебробовал! Шард Oldp XL скрипт на летание по вендорам по рунбуку
Помогите разобраться
Whom do you want to beg?
You can't see the target
Всё перебробовал! Шард Oldp XL скрипт на летание по вендорам по рунбуку
Code: Select all
#####################################################
#####################################################
############# Scripted by Occult ####################
#####################################################
############# OldParadise XL Begging ################
#####################################################
######### Version 1.4 ###############################
#####################################################
#####################################################
#------------------------------
#Change Log
# *If npc hase no money, he will go to next respawn.
# *Added second runebook recall.
# *Fixed message bug.
# *Fixed reconnector bug.
var book1='0x40015852' #runebook 1
var book2='0x40015852' #runebook 2
sub begging()
var k,j,b
var second=1 # 0 - two runebooks, 1 - one runebook.
#----------------------------------------
# NPC ID [,info]
#----------------------------------------
DIM ven[16]
ven[1]='0x400BE337' #Britain tinker
ven[2]='0x400BDC6E' #Moonglow provisioner
ven[3]='0x400BD799' #Moonglow carpenter
ven[4]='0x400BD09A' #Minoc butcher
ven[5]='0x40097A16' #Minoc banker
ven[6]='0x4009799D' #Britain blue boar
ven[7]='0x40097A1A' #Moonglow provisioner
ven[8]='0x4009799A' #Britain bowyer2
ven[9]='0x40097AD0' #Britain armorer
ven[10]='0x40095337' #Moonglow tinker
ven[11]='0x40097A14' #Britain farmer
ven[12]='0x40097AD1' #Britain hides
ven[13]='0x40097AD5' #Britain tailor2
ven[14]='0x400978FB' #Moonglow cook
ven[15]='0x40097AD2' #Moonglow bs
ven[16]='0x4009799B' #Moonglow cook2
DIM vem[16]
vem[1]='0x400B40E7' #Britain scribe
vem[2]='0x400193E2' #Minoc bs
vem[3]='0x4001A618' #Minoc tailor
vem[4]='0x400193E7' #Minoc carpenter
vem[5]='0x4001A617' #Minoc provisioner
vem[6]='0x4001C0FA' #Minoc cook
vem[7]='0x4001A616' #Minoc tamer
vem[8]='0x4001A61A' #Minoc butcher
vem[9]='0x40097A1C' #Moonglow alchemic
vem[10]='0x40097A4E' #Moonglow alchemic 2
vem[11]='0x400979A0' #Britain bs
vem[12]='0x400978FC' #Britain bs2
vem[13]='0x4009799F' #Britain architect
vem[14]='0x40097999' #Britain armor2
vem[15]='0x40097A18' #Britain provisioner
vem[16]='0x4009799E' #Britain jeweler
while not uo.dead()
for k=1 to 16
recall(book1,k)
UO.DeleteJournal()
repeat
wait(500)
SuperWalk(0,0,ven[k])
UO.WaitTargetObject(ven[k])
UO.Useskill('Begging')
#wait(500)
until UO.InJournal("You put the gold") or UO.InJournal("You receive") or (uo.JournalSerial(uo.InJournal("no money")-1))==ven[k]
next
if second==0 then
for j=1 to 16
recall(book2,j)
UO.DeleteJournal()
repeat
wait(500)
SuperWalk(0,0,vem[j])
UO.WaitTargetObject(vem[j])
UO.Useskill('Begging')
#wait(500)
until UO.InJournal("You put the gold") or UO.InJournal("You receive") or (uo.JournalSerial(uo.InJournal("no money")-1))==vem[j]
next
end if
wend
endsub
#==========================================================
# Recall System
# idrb - runebook id
# nrune - rune number
#----------------------------------------------------------
#---------------------------
# Runebook recall
# reagent use
#---------------------------
sub Recall(idrb,nrune)
Dim gumpreturn[16]
gumpreturn[1]="0x0014"
gumpreturn[2]="0x0016"
gumpreturn[3]="0x0018"
gumpreturn[4]="0x001A"
gumpreturn[5]="0x001C"
gumpreturn[6]="0x001E"
gumpreturn[7]="0x0020"
gumpreturn[8]="0x0022"
gumpreturn[9]="0x0024"
gumpreturn[10]="0x0026"
gumpreturn[11]="0x0028"
gumpreturn[12]="0x002A"
gumpreturn[13]="0x002C"
gumpreturn[14]="0x002E"
gumpreturn[15]="0x0030"
gumpreturn[16]="0x0032"
UO.Recall(idrb,gumpreturn[nrune])
UO.Exec('terminate Reconnector')
wait(5000)
UO.Exec('exec Reconnector')
wait(5000)
Uo.DeleteJournal()
endsub
#==============================================================
# SuperWalk(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!
# walkwait - delay after keypress
#--------------------------------------------------------------
sub SuperWalk(x,y,Target)
VAR i
VAR dir,ldir,rdir,key,olddir
VAR dx,dy,Exit=0
VAR CacheLimit=9,CacheIndex="Text"
DIM CacheX[10], CacheY[10]
CacheX[0]="Test"
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
return
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 ; GoSE
dir=3
ldir=2
rdir=4
key=40 ; DownArrow
olddir=UO.GetDir()
If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
If olddir==2 Then ; GoNE
dir=1
ldir=0
rdir=1
key=39 ; RightArrow
While UO.GetDir()<>1
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoSW
dir=5
ldir=5
rdir=6
key=37 ; LeftArrow
While UO.GetDir()<>5
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
If dx>0 AND dy<0 Then ; GoNE
dir=1
ldir=0
rdir=2
key=39 ; RightArrow
olddir=UO.GetDir()
If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
If olddir==0 Then ; GoWN
dir=7
ldir=6
rdir=7
key=38 ; UpArrow
While UO.GetDir()<>7
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoSE
dir=3
ldir=3
rdir=4
key=40 ; DownArrow
While UO.GetDir()<>3
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
If dx<0 AND dy>0 Then ; GoSW
dir=5
ldir=4
rdir=6
key=37 ; LeftArrow
olddir=UO.GetDir()
If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
If olddir==6 Then ; GoWN
dir=7
ldir=7
rdir=0
key=38 ; UpArrow
While UO.GetDir()<>7
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoSE
dir=3
ldir=2
rdir=3
key=40 ; DownArrow
While UO.GetDir()<>3
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
If dx<0 AND dy<0 Then ; GoWN
dir=7
ldir=6
rdir=0
key=38 ; UpArrow
olddir=UO.GetDir()
If StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key) Then
If olddir==0 Then ; GoNE
dir=1
ldir=1
rdir=2
key=39 ; RightArrow
While UO.GetDir()<>1
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoSW
dir=5
ldir=4
rdir=5
key=37 ; LeftArrow
While UO.GetDir()<>5
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
Endif
If dx<>0 AND dy==0 Then
If dx>0 Then ; GoE
dir=2
key=34 ; PgDown
olddir=UO.GetDir()
If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
If olddir==2 Then ; GoSE
dir=3
ldir=3
rdir=4
key=40 ; DownArrow
While UO.GetDir()<>3
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoNE
dir=1
ldir=1
rdir=0
key=39 ; RightArrow
While UO.GetDir()<>1
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
If dx<0 Then ; GoW
dir=6
key=36 ; Home key
olddir=UO.GetDir()
If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
If olddir==0 Then ; GoWN
dir=7
ldir=7
rdir=0
key=38 ; UpArrow
While UO.GetDir()<>7
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoSW
dir=5
ldir=4
rdir=5
key=37 ; LeftArrow
While UO.GetDir()<>5
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
Endif
If dx==0 AND dy<>0 Then
If dy>0 Then ; GoS
dir=4
key=35 ; End
If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
If olddir==2 Then ; GoSE
dir=3
ldir=2
rdir=3
key=40 ; DownArrow
While UO.GetDir()<>3
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoSW
dir=5
ldir=6
rdir=5
key=37 ; LeftArrow
While UO.GetDir()<>5
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
If dy<0 Then ;GoN
dir=0
key=33 ; PgUp
olddir=UO.GetDir()
If StepEdit(UO.GetX(),UO.GetY(),dir,key) Then
If olddir==2 Then ; GoNE
dir=1
ldir=1
rdir=2
key=39 ; RightArrow
While UO.GetDir()<>1
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Else ; GoWN
dir=7
ldir=7
rdir=6
key=38 ; UpArrow
While UO.GetDir()<>7
StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
Wend
Endif
Endif
Endif
Endif
Wend
end sub
sub StepEdit(x,y,dir,key)
VAR walkwait=300
VAR ErrLevel=0
If UO.GetDir()<>dir Then
checkstam()
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir Then
CheckLag()
Endif
Endif
checkstam()
UO.Press(key)
wait(walkwait)
If x==UO.GetX() AND y==UO.GetY() Then
CheckLag()
If x==UO.GetX() AND y==UO.GetY() Then
;zatik
ErrLevel=1
Endif
Endif
Return ErrLevel
end sub
sub StepArrow(x,y,dir,ldir,rdir,key)
VAR walkwait=300
VAR ErrLevel=0
If UO.GetDir()<>dir Then
checkstam()
UO.Press(key)
wait(walkwait)
If UO.GetDir()<>dir AND UO.GetDir()<>ldir AND UO.GetDir()<>rdir Then
CheckLag()
Endif
Endif
If UO.GetX()==x AND UO.GetY()==y Then
checkstam()
UO.Press(key)
wait(walkwait)
If UO.GetDir()==dir AND UO.GetX()==x AND UO.GetY()==y Then
CheckLag()
If UO.GetDir()==dir AND UO.GetX()==x AND UO.GetY()==y Then
; zatik
ErrLevel=1
Endif
Endif
Endif
Return ErrLevel
end sub
#========================================
# Functions
# chechstam()
# checklag()
# reconnector()
#----------------------------------------
sub checkstam()
var refresh = '0x0F0B'
if uo.stamina < 10 then
uo.findtype(refresh,-1,'backpack')
if uo.findcount() then
uo.usetype(refresh)
wait(1000)
else
uo.print("Nety Refreshey! Stoim...")
repeat
wait(500)
until uo.stamina >= 10
endif
else
endif
endsub
sub CheckLag()
uo.DeleteJournal()
uo.Click('backpack')
repeat
wait(50)
until UO.InJournal('backpack')
endsub
sub Reconnector()
var ReconnectTime, RFlag
ReconnectTime = '0'
RFlag = 1
Repeat
While (UO.ObjAtLayer('Bpack') == '')
if RFlag Then
ReconnectTime = MakeTime()
RFlag = 0
endif
Wait(20000) # WorldSave Protection
UO.Say('')
Wait(3000)
UO.Say('')
Wait(3000)
UO.Say('')
Wait(3000)
UO.LDblClick(357,164)
UO.LClick(616,459)
Wait(3000)
WEnd
Wait(3000)
if (RFlag == 0) and (ReconnectTime <> '0') Then
UO.Exec('terminate Begging')
wait(1000)
UO.Exec('exec Begging')
wait(1000)
UO.TextOpen()
UO.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
RFlag = 1
ReconnectTime = '0'
endif
Until false
end sub
sub MakeTime()
VAR D, T, Ret, i
Ret = STR(UO.Time())
T = ""
For i = 0 To Len(Ret)
T = Ret[Len(Ret)-i] + T
If (I == 2) OR (I == 4) Then
T = ":" + T
EndIf
Next
Ret = STR(UO.Date())
D = ""
For i = 0 To Len(Ret)
D = Ret[Len(Ret)-i] + D
If (I == 2) OR (I == 4) Then
D = "." + D
EndIf
Next
Ret = T + " @ " + D
RETURN Ret
end sub
Помогите разобраться