Page 1 of 1

Фишинг

Posted: 2005-07-07 11:57:12
by Leo
Решил я забацать скрипт на фишинг для ДРВ, что бы стоять рядом с домиком на берегу, когда карта - складывает её в мешок, рыба - в треш. Слепил всё это из разных скриптов, но скрипт работает некоректно. Незнаю как прописать, что бы при выловке рыбы он скидывал её в треш.

Code: Select all

VAR Cont = '0x401260D2' # сейф, где будут карты 
VAR trash = '0x400E5E23'# треш кэн
VAR pole = '0x0DBF'     # тип удочки                      
VAR foodT = '0x097B'    # тип еды                        
VAR BagCount = '0x0E76' # тип мешков                  
VAR Item = '0x14EB'     # тип карт                          
var walkwait=500     
var QB 
var inWalk=1, inFishing=0                                   
var time, k=0, oldX, oldY.                                   
var fizl=0, control=8, cel='', glX, glY, whGo=1.             

sub main() 
DIM xM[4] 
xM[1] = 2015 
xM[2] = 2015 
xM[3] = 2015 
DIM yM[4] 
yM[1] = 534 
yM[2] = 536
yM[3] = 538 
var x, y, z=UO.GetZ("self") 
DIM text[8] 
text[1] = 'Tattered treasure' 
text[2] = 'You pull out a' 
text[3] = 'You fish a while' 
text[4] = 'That is too far away' 
text[5] = 'Try fishing in water' 
text[6] = 'There are no fish here' 
text[7] = 'location' 
UO.Set('finddistance','20') 
if UO.GetX()<>1053 OR UO.GetY()<>3501 then 
endif 
While True 
if whGo<3 then 
whGo=whGo+1 
else 
whGo=1 
endif 
for x=-6 to 6 
for y=-6 to 6 
inFishing=0 
Repeat 
UO.DeleteJournal() 
ToHide() 
UO.WaitTargetTile("1341",STR(UO.GetX()+x),STR(UO.GetY()+Y),z) 
UO.UseType(pole) 
time=UO.Timer() 
Repeat 
wait(500) 
Until UO.InJournal(text[2]) OR UO.InJournal(text[3]) OR UO.InJournal(text[4]) OR UO.InJournal(text[5]) OR UO.InJournal(text[6]) OR UO.InJournal(text[7]) OR UO.Timer()>time+250 
if UO.InJournal(Text[2]) then 
fizl=0 
endif 
if UO.InJournal(text[3]) then 
fizl=fizl+1 
endif 
if fizl==control then 
wait(8000) 
fizl=0 
FastLootCheck() 
endif 
if NOT (UO.InJournal(text[1]) OR UO.InJournal(text[3])) then 
inFishing=1 
else 
if UO.InJournal(text[1]) then 
Find() 
trash()
endif 
endif 
Food() 
Until inFishing==1 
next 
next 
if inWalk==1 then 
Walk(xM[whGo],yM[whGo],'') 
else 
inWalk=1 
endif 
endif 
Wend 
end sub

sub trash()
UO.SetReceivingContainer('trash') 
UO.findtype('0x09CC','0x0000','ground')
UO.grab ('3','finditem') 
wait (500) 
UO.findtype('0x09CD','0x0000','ground')
UO.grab ('3','finditem') 
wait (500) 
UO.findtype('0x09CE','0x0000','ground')
UO.grab ('3','finditem') 
wait (500) 
UO.findtype('0x09CF','0x0000','ground')
UO.grab ('3','finditem') 
wait (500) 
UO.findtype('0x0DD6','0x05F6','ground')
UO.grab ('1','finditem') 
wait (500) 
UO.findtype('0x0DD6','0x01BB','ground')
UO.grab ('1','finditem') 
wait (500) 
UO.UnSetReceivingContainer() 
end sub

sub UnLoadItem() 
VAR BagID 
VAR i=0 
VAR m=0 
Repeat 
UO.DeleteJournal() 
UO.FindType(BagCount,'-1',Cont) 
UO.Click('finditem') 
m = 0 
Repeat 
Wait(1000) 
Until UO.InJournal("a bag") 
If UO.InJournal("a bag") Then 
BagID=UO.JournalSerial(UO.InJournal("a bag")-1) 
UO.SetJournalLine(UO.InJournal("a bag")-1,"") 
UO.FindType('-1','-1',BagID) 
If UO.FindCount('finditem') < 250 then 
m = UO.FindCount('finditem') 
UO.SetReceivingContainer(BagID) 
UO.FindType(Item,'-1','me') 
UO.Grab('0','finditem') 
UO.ConColor('0x0021') 
UO.Set('quiet','0') 
UO.Print(UO.Print('In BagPack#'+Str(i+1)+' items '+Str(m)+'')) 
UO.Set('quiet','1') 
UO.ConColor('0x0035') 
Wait(1000) 
UO.UnSetReceivingContainer() 
Else 
i = i + 1 
UO.Ignore(BagID, 'on') 
EndIf 
EndIf 
If i == QB Then 
UO.IgnoreReset() 
i = 0 
EndIf 
UO.FindType(Item,'-1','me') 
Until UO.FindCount('finditem') < 1 
end sub

sub ToHide() 
while NOT UO.Hidden() 
UO.DeleteJournal() 
UO.Exec('warmode 0') 
UO.UseSkill('Stealth') 
wait(2000) 
time=UO.Timer() 
repeat 
wait(500) 
until UO.InJournal('You have hidden') OR UO.InJournal('seem to') OR UO.InJournal('preoccupied') OR time+200<UO.Timer() 
wend 
end sub 

sub Find() 
UO.Set('finddistance','2') 
var find = '0x14EB' ;tattered map 
UO.Set('finddistance','2') 
UO.Findtype(find,-1,1) 
if UO.FindCount()>0 then 
UnLoadItem()
endif 
UO.Set('finddistance','20') 
end sub 

sub CheckLag() 
UO.DeleteJournal() 
UO.Click('backpack') 
Repeat 
wait(200) 
Until UO.InJournal('backpack') 
end sub 

sub FastLootCheck() 
UO.DeleteJournal() 
wait(500) 
if UO.InJournal("FastLoot") OR UO.InJournal("World save") then 
CheckLag() 
endif 
end sub 

sub Food() 
if k==100 then 
UO.DeleteJournal() 
repeat 
UO.UseType(foodT) 
wait(500) 
until UO.InJournal('simply too full') 
k=1 
else 
k=k+1 
endif 
end sub 

sub Walk(x,y,Target) 
VAR Step, dX, dY, Exit=0, dirW=0, result 
While Exit<>1 
if Target<>"" then 
cel=Target 
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() 
glX=dX 
glY=dY 
if dX==0 AND dY==0 then 
Exit=1 
endif 
endif 
if Exit==0 then 
if dX>0 AND dY>0 then 
dirW=9 ;number 2 
endif 
if dX>0 AND dY<0 then 
dirW=7 ;number 6 
endif 
if dX<0 AND dY>0 then 
dirW=3 ;number 4 
endif 
if dX<0 AND dY<0 then 
dirW=5 ;number 8 
endif 
if dX<>0 AND dY==0 then 
if dX>0 then 
dirW=8 ;number 3 
else 
dirW=4 ;number 7 
endif 
endif 
if dX==0 AND dY<>0 then 
if dY>0 then 
dirW=2 ;number 1 
else 
dirW=6 ;number 9 
endif 
endif 
result=Go(dirW) 
if result==0 then 
result=Go(dirW-2) 
if result==0 then 
result=Go(dirW+2) 
endif 
endif 
endif 
Wend 
endsub 

sub Go(dir) 
var xGo, yGo, check=1, dirStart=UO.GetDir() 
xGo=UO.GetX() 
yGo=UO.GetY() 
DIM key[12] 
key[0] = 34 ;number 3 
key[1] = 40 ;number 2 
key[2] = 35 ;number 1 
key[3] = 37 ;number 4 
key[4] = 36 ;number 7 
key[5] = 38 ;number 8 
key[6] = 33 ;number 9 
key[7] = 39 ;number 6 
key[8] = 34 ;number 3 
key[9] = 40 ;number 2 
key[10] = 35 ;number 1 
key[11] = 37 ;number 4 
DIM dirS[12] 
dirS[0] = 2 ;number 3 
dirS[1] = 3 ;number 2 
dirS[2] = 4 ;number 1 
dirS[3] = 5 ;number 4 
dirS[4] = 6 ;number 7 
dirS[5] = 7 ;number 8 
dirS[6] = 0 ;number 9 
dirS[7] = 1 ;number 6 
dirS[8] = 2 ;number 3 
dirS[9] = 3 ;number 2 
dirS[10] = 4 ;number 1 
dirS[11] = 5 ;number 4 

While UO.GetDir()<>dirS[dir] 
UO.Press(key[dir]) 
wait(walkwait) 
if UO.GetDir()==dirStart then 
CheckLag() 
endif 
if (cel<>"" AND UO.GetDistance(cel)<2) OR (glX==0 AND glY==0) then 
return 1 
endif 
Wend 

UO.Press(key[dir]) 
wait(walkwait) 
if xGo==UO.GetX() AND yGo==UO.GetY() then 
CheckLag() 
UO.Press(key[dir]) 
wait(walkwait) 
endif 
if xGo==UO.GetX() AND yGo==UO.GetY() then 
return 0 
else 
return 1 
endif 
end sub 

Posted: 2005-07-07 12:17:22
by Askaneli

Code: Select all

sub trash()
var f=0 
Dim Fish[7]
Fish[1]='0x09CC'
Fish[2]='0x09CD'
Fish[3]='0x09CE'
Fish[4]='0x09CF'
Fish[5]='0x0DD6'
Fish[6]='0x0DCA'
Fish[7]='0x14EB'
for f=1 to 5
uo.findtype(Fish[f],'-1','ground')
wait(100)
while uo.findcount()>0
uo.moveitem('finditem','-1','trash')
wait(1000)
uo.findtype(Fish[f],'-1','ground')
wait(100)
wend
next
end sub 


Posted: 2005-07-07 13:35:34
by Leo
Ещё одна проблема. Когда вылавливается карта, то чар не берёт её, а просто перекладывает всю рыбу к себе в бекпек.

Posted: 2005-07-07 18:21:18
by Leo
Чуть переделал.
Когда вылавливается карта, должен собрать всю рыбу, положить её в треш, потом взять карту и положить её в мешок. Карту он перекладывает, а вот рыбку кладёт в бекпек. Помогите. Попраьте.

Code: Select all

VAR Cont = '0x401260D2' # сейф, где будут карты               
VAR trash = '0x400E5E23'# треш кэн                            
VAR pole = '0x0DBF'     # тип удочки                          
VAR foodT = '0x097B'    # тип еды                             
VAR BagCount = '0x0E76' # тип мешков                          
VAR Item = '0x14EB'     # тип карт                            
var walkwait=500                                              
var QB                                                        
var inWalk=1, inFishing=0                                     
var time, k=0, oldX, oldY.                                    
var fizl=0, control=8, cel='', glX, glY, whGo=1.              

sub main() 
DIM xM[4] 
xM[1] = 2015 
xM[2] = 2015 
xM[3] = 2015 
DIM yM[4] 
yM[1] = 534 
yM[2] = 536
yM[3] = 538 
var x, y, z=UO.GetZ("self") 
DIM text[8] 
text[1] = 'Tattered treasure' 
text[2] = 'You pull out a' 
text[3] = 'You fish a while' 
text[4] = 'That is too far away' 
text[5] = 'Try fishing in water' 
text[6] = 'There are no fish here' 
text[7] = 'location' 
UO.Set('finddistance','20') 
if UO.GetX()<>1053 OR UO.GetY()<>3501 then 
endif 
While True 
if whGo<3 then 
whGo=whGo+1 
else 
whGo=1 
endif 
for x=-6 to 6 
for y=-6 to 6 
inFishing=0 
Repeat 
UO.DeleteJournal() 
ToHide() 
UO.WaitTargetTile("1341",STR(UO.GetX()+x),STR(UO.GetY()+Y),z) 
UO.UseType(pole) 
time=UO.Timer() 
Repeat 
wait(500) 
Until UO.InJournal(text[2]) OR UO.InJournal(text[3]) OR UO.InJournal(text[4]) OR UO.InJournal(text[5]) OR UO.InJournal(text[6]) OR UO.InJournal(text[7]) OR UO.Timer()>time+250 
if UO.InJournal(Text[2]) then 
fizl=0 
endif 
if UO.InJournal(text[3]) then 
fizl=fizl+1 
endif 
if fizl==control then 
wait(8000) 
fizl=0 
FastLootCheck() 
endif 
if NOT (UO.InJournal(text[1]) OR UO.InJournal(text[3])) then 
inFishing=1 
else 
if UO.InJournal(text[1]) then 
Find() 
trash()
endif 
endif 
Food() 
;UnLoadItem() 
Until inFishing==1 
next 
next 
if inWalk==1 then 
Walk(xM[whGo],yM[whGo],'') 
else 
inWalk=1 
endif 
endif 
Wend 
end sub

sub trash() 
var f
Dim Fish[6] 
Fish[1]='0x09CC' 
Fish[2]='0x09CD' 
Fish[3]='0x09CE' 
Fish[4]='0x09CF' 
Fish[5]='0x0DD6' 
Fish[6]='0x0DCA' 
for f=1 to 6 
uo.findtype(Fish[f],'-1','ground') 
wait(100) 
while uo.findcount()>0 
uo.moveitem('finditem','-1','trash') 
wait(1000) 
uo.findtype(Fish[f],'-1','ground') 
wait(100) 
wend 
next 
end sub 

sub UnLoadItem() 
VAR BagID 
VAR i=0 
VAR m=0 
Repeat 
UO.DeleteJournal() 
UO.FindType(BagCount,'-1',Cont) 
UO.Click('finditem') 
m = 0 
Repeat 
Wait(1000) 
Until UO.InJournal("a bag") 
If UO.InJournal("a bag") Then 
BagID=UO.JournalSerial(UO.InJournal("a bag")-1) 
UO.SetJournalLine(UO.InJournal("a bag")-1,"") 
UO.FindType('-1','-1',BagID) 
If UO.FindCount('finditem') < 250 then 
m = UO.FindCount('finditem') 
UO.SetReceivingContainer(BagID) 
UO.FindType(Item,'-1','me') 
UO.Grab('0','finditem') 
UO.ConColor('0x0021') 
UO.Set('quiet','0') 
UO.Print(UO.Print('In BagPack#'+Str(i+1)+' items '+Str(m)+'')) 
UO.Set('quiet','1') 
UO.ConColor('0x0035') 
Wait(1000) 
UO.UnSetReceivingContainer() 
Else 
i = i + 1 
UO.Ignore(BagID, 'on') 
EndIf 
EndIf 
If i == QB Then 
UO.IgnoreReset() 
i = 0 
EndIf 
UO.FindType(Item,'-1','me') 
Until UO.FindCount('finditem') < 1 
end sub

sub ToHide() 
while NOT UO.Hidden() 
UO.DeleteJournal() 
UO.Exec('warmode 0') 
UO.UseSkill('Stealth') 
wait(2000) 
time=UO.Timer() 
repeat 
wait(500) 
until UO.InJournal('You have hidden') OR UO.InJournal('seem to') OR UO.InJournal('preoccupied') OR time+200<UO.Timer() 
wend 
end sub 

sub Find() 
UO.Set('finddistance','2') 
var find = '0x14EB' ;tattered map 
UO.Set('finddistance','2') 
UO.Findtype(find,-1,1) 
if UO.FindCount()>0 then 
UO.grab ('1','finditem') 
endif 
UnLoadItem()
UO.Set('finddistance','20') 
end sub 

sub CheckLag() 
UO.DeleteJournal() 
UO.Click('backpack') 
Repeat 
wait(200) 
Until UO.InJournal('backpack') 
end sub 

sub FastLootCheck() 
UO.DeleteJournal() 
wait(500) 
if UO.InJournal("FastLoot") OR UO.InJournal("World save") then 
CheckLag() 
endif 
end sub 

sub Food() 
if k==100 then 
UO.DeleteJournal() 
repeat 
UO.UseType(foodT) 
wait(500) 
until UO.InJournal('simply too full') 
k=1 
else 
k=k+1 
endif 
end sub 

sub Walk(x,y,Target) 
VAR Step, dX, dY, Exit=0, dirW=0, result 
While Exit<>1 
if Target<>"" then 
cel=Target 
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() 
glX=dX 
glY=dY 
if dX==0 AND dY==0 then 
Exit=1 
endif 
endif 
if Exit==0 then 
if dX>0 AND dY>0 then 
dirW=9 ;number 2 
endif 
if dX>0 AND dY<0 then 
dirW=7 ;number 6 
endif 
if dX<0 AND dY>0 then 
dirW=3 ;number 4 
endif 
if dX<0 AND dY<0 then 
dirW=5 ;number 8 
endif 
if dX<>0 AND dY==0 then 
if dX>0 then 
dirW=8 ;number 3 
else 
dirW=4 ;number 7 
endif 
endif 
if dX==0 AND dY<>0 then 
if dY>0 then 
dirW=2 ;number 1 
else 
dirW=6 ;number 9 
endif 
endif 
result=Go(dirW) 
if result==0 then 
result=Go(dirW-2) 
if result==0 then 
result=Go(dirW+2) 
endif 
endif 
endif 
Wend 
endsub 

sub Go(dir) 
var xGo, yGo, check=1, dirStart=UO.GetDir() 
xGo=UO.GetX() 
yGo=UO.GetY() 
DIM key[12] 
key[0] = 34 ;number 3 
key[1] = 40 ;number 2 
key[2] = 35 ;number 1 
key[3] = 37 ;number 4 
key[4] = 36 ;number 7 
key[5] = 38 ;number 8 
key[6] = 33 ;number 9 
key[7] = 39 ;number 6 
key[8] = 34 ;number 3 
key[9] = 40 ;number 2 
key[10] = 35 ;number 1 
key[11] = 37 ;number 4 
DIM dirS[12] 
dirS[0] = 2 ;number 3 
dirS[1] = 3 ;number 2 
dirS[2] = 4 ;number 1 
dirS[3] = 5 ;number 4 
dirS[4] = 6 ;number 7 
dirS[5] = 7 ;number 8 
dirS[6] = 0 ;number 9 
dirS[7] = 1 ;number 6 
dirS[8] = 2 ;number 3 
dirS[9] = 3 ;number 2 
dirS[10] = 4 ;number 1 
dirS[11] = 5 ;number 4 

While UO.GetDir()<>dirS[dir] 
UO.Press(key[dir]) 
wait(walkwait) 
if UO.GetDir()==dirStart then 
CheckLag() 
endif 
if (cel<>"" AND UO.GetDistance(cel)<2) OR (glX==0 AND glY==0) then 
return 1 
endif 
Wend 

UO.Press(key[dir]) 
wait(walkwait) 
if xGo==UO.GetX() AND yGo==UO.GetY() then 
CheckLag() 
UO.Press(key[dir]) 
wait(walkwait) 
endif 
if xGo==UO.GetX() AND yGo==UO.GetY() then 
return 0 
else 
return 1 
endif 
end sub