Page 1 of 1

Скрипт на прокачку арчери

Posted: 2015-07-25 15:09:23
by kobol
Hi!

Тяп-ляп скрипт не прокачку арчери.
Перс стоит рядом с лучниками, отстреливает их, лечится, ходит подбирает стрелки и лутает лучников.
Плюсы в том, что
1. Можно качаться с одного компа )
2. Лутается больше стрелок, чем расходуется, поэтому стрелки накапливаются.

Минус- ну, довольно медленно

Code: Select all

#VAR monst=0x0003  #zombie
#VAR monst=0x00ea  #olen"
VAR monst=0x0191 #women
var washing="0x1008" # Tшя ъюЁvЄр
var bloody="0x0E20" # Tшя ъЁютртvї сшэЄют
VAR SerChar, ColChar, NamChar, DistChar, SerEnemy #=uo.getserial("finditem")
var dShoot0=17 # дистанция до оленя 

var distShoot=15 # дистанция до оленя 
var Text3="You can't reach this." 
var Text4="That is too far away." 
var Text5="You can't do much in your current state." 


# с определением злобности - чтобы синих не бил| особенно в ГЗ 

####################################################
sub att()
#***********
#(C) Cooper 
# updated by Kobol Dec 2012
#***********
#VAR monst="0x0190"  #dark elf
var myhp
var dist, enhlth, ex,ey, oldEH
var mfound
##########################################
UO.usetype("0x13B1")            ; тип лука 

UO.Set("quiet","0")

uo.print("attack zombie! <<<<<<<<<")

UO.Set("finddistance","18")
hiding()
go(869,1191,0)

hiding()

if UO.GetHP("self") < 140 then
	heal()
end if


while UO.GetHP("self") > 100
	uo.ignore("self") 
	UO.FindType(monst, "-1", "ground")
	wait(300)
	if UO.FindCount() > 0 then
SerEnemy =uo.getserial("finditem")
		dist=UO.GetDistance(SerEnemy)
		wait (100)
		ColChar = UO.GetNotoriety( "finditem" )
		wait (100)
		
		if ColChar> 2 then #если злобный
		uo.print("found="+str(UO.FindCount()))
		uo.print("zloba="+str(ColChar))
		
		uo.print("enemy distance="+str(dist))
		if dist>distShoot then
			uo.print("enemy  Too far")
			Chaser("finditem")
			wait (50)
			
		else
			UO.DeleteJournal()
			wait (100)
			uo.print("near!!")
			dist=UO.GetDistance("finditem")
			
			if dist <= distShoot then
				UO.Attack("finditem")
				
				repeat #<<<##################
				wait(250)
				enhlth=UO.GetHP("finditem")
				if  enhlth<  oldEH then

				uo.print("Enemy Health="+str(enhlth))
				endif

				if  enhlth > 0  then
					ex=UO.GetX("finditem")
					ey=UO.GetY("finditem")
				endif

				if UO.GetDistance("finditem") > distShoot-3 then
					uo.print("Far again 1")
					wait (50)
					
					Chaser1("finditem")
					enhlth=UO.GetHP("finditem")
					uo.print("Enemy Health 1a="+str(enhlth))
				#hiding()
				#heal()


					if enhlth > 0  then

						PickUpArrow()

						#go(869,1191,0)
						#hiding()
						#heal()
						wait (150)
					#enhlth = 0

					endif
				endif

                                oldEH=enhlth

				
				until UO.InJournal("Body of") or enhlth < 1  
				#<<<##################


				hiding()
				heal()

				distShoot=0
				enhlth=UO.GetHP("finditem")
				uo.print("Enemy Health 2="+str(enhlth))
				wait (100)
					PickUpArrow()
				if enhlth < 1  then
				go(ex,ey,0)
				Loot1()
				wait (100)
				distShoot=dShoot0
				endif
				
				uo.print("68: zombie killed" )
				PickUpArrow()
				uo.print(" try to loot gold and arrow====" )
				wait (100)
				
				#Chaser("finditem")
				
				uo.print("go to the base point" )
				distShoot=dShoot0
				
				#go(869,1191,0)
				hiding()
				heal()
				wait (50)
			else
				uo.print("Far again 2")
				wait (50)
			endif
		endif
	else
		uo.ignore("finditem") 
		
	endif # не злобный

	else
		PickUpArrow()
		hiding()
		
		#uo.useskill("Spirit Speak")
		go(869,1191,0)
		
	endif
		wait(3550)

wend

endsub

####################################################
sub PickUpArrow()
var dist, distOld
var mfound=0
distOld=distShoot
distShoot=1
var Text3="You can't reach this." 

UO.Print( "PickUpArrow distShoot="+str(distShoot) )   

UO.Set("quiet","0")

uo.print("Try PickUp Arrow! <<<<<<<<<")
UO.Set("finddistance","18")
UO.DeleteJournal()

#while UO.GetHP("self") > 50
uo.FindType("0x0F3F","0x0000", "ground") 
wait(50)
if UO.FindCount() > 0 then
	uo.print("found Arrows ="+str(UO.FindCount()))
	dist=UO.GetDistance("finditem")
	uo.print("distance="+str(dist))
	if dist>=distShoot then
		uo.print("too Far to pickup arrow --")
		Chaser("finditem")
	endif
	#else
			UO.DeleteJournal()
			wait (100)
			uo.print("near to arrow - pickup!")
			dist=UO.GetDistance("finditem")
			if dist <= distShoot then
				uo.grab("0","finditem") 
				wait(400) 
				UO.Print( "The arrow found and pickuped +++++++" )   
		if UO.InJournal(Text3) then
			UO.DeleteJournal()
			return
		endif

			else
				uo.print("Far again 2")
				wait (50)
			endif
	endif
else
	wait(50)
endif
	#wend
	distShoot=distOld
	uo.print("PickUp Arrow complete! +++++ <<<<<<<<<")
	
endsub
	
;-----------------------------------------------------------------
####################################################
sub Chaser(Target)
	VAR x, y
	x=UO.GetX(Target)
	y=UO.GetY(Target)

go(x,y,0)
	
endsub
	
	
;-----------------------------------------------------------------
####################################################
sub Chaser1(Target)
	UO.Print( "v dogon!! distShoot="+str(distShoot) )   
	
	VAR dx, dy
	var cdist
	cdist=uo.getdistance(target)
	UO.Print( "Chaser dist="+str(cdist) )   
	
	if cdist>50 then 
		return
	endif
	
	While 1
		If Target<>"" and uo.getdistance(target)>distShoot-25 and not uo.dead() Then
			dx=UO.GetX(Target)-UO.GetX()
			dy=UO.GetY(Target)-UO.GetY()
			If UO.GetDistance(Target)<=distShoot Then
				return
			Endif
		else
			Return
		Endif
		
		If dx<>0 AND dy<>0 Then
			If dx>0 AND dy>0 Then
				UO.Press(40) ; DownArrow
			Endif
			
			If dx>0 AND dy<0 Then
				UO.Press(39) ; RightArrow
			Endif
			
			If dx<0 AND dy>0 Then
				UO.Press(37) ; LeftArrow
			Endif
			
			If dx<0 AND dy<0 Then
				UO.Press(38) ; UpArrow
			Endif
		Endif
		
		If dx<>0 AND dy==0 Then
			If dx>0 Then
				UO.Press(34) ; PgDown
			Endif
			
			If dx<0 Then
				UO.Press(36) ; Home key
			Endif
		Endif
		
		If dx==0 AND dy<>0 Then
			If dy>0 Then
				UO.Press(35) ; End
			Endif
			
			If dy<0 Then
				UO.Press(33) ; PgUp
			Endif
		Endif
		#LootArrow()
		wait (400)
	Wend
endsub

####################################################
sub heal()
	
	var Bandana ='0x1515'    ##Тип того, что сшили лента '0x153B' 0x1515
	Var Scissors='0x0F9E' # Ножницы чтоб резать то что накроили из ткани
	var kolvo1
	
	If uo.getHP() < uo.getMaxHP()  then 
		
		UO.Set("finddistance","18")
		#uo.print("  heal =======" )
		
		uo.warmode(false) 
		wait (100)
		
		uo.setarm("current armor") 
		wait (100)
		
		uo.disarm() 
		wait (100)
		
		#hiding()
		wait (100)
		uo.print("HP=========================="+str(uo.getHP()) )
		
		# моем бинты
		UO.waittargettype("0x1008") 
		UO.usetype("0x0e20") 
		Wait(1000) 
		
		#UO.waittargettype("0x1515") 
		#UO.usetype("0x0f9e") 
		#Wait(1000) 
		
		
		repeat 
		uo.bandageself() 
		wait(4000) 
		until uo.getHP() == uo.getMaxHP() 
		
		uo.arm("current armor") 
		wait (800)
		
		#hiding()  
		
	end if
	
	
	UO.FindType('Bandana','0x0599','backpack')
	uo.print ('Bandana FindCount='+str(uo.FindCount()))
	kolvo1=uo.FindCount() #UO.GetQuantity('finditem')
	uo.print ('kolvo1='+ str(kolvo1))
	if kolvo1>3 then
		repeat
		UO.FindType('Bandana','0x0599','backpack')
	kolvo1=uo.FindCount() #UO.GetQuantity('finditem')
	uo.print ('2 kolvo1 ='+ str(kolvo1))

		uo.print ('Bandana FindCount='+str(uo.FindCount()))
	if kolvo1>3 then

		UO.WaitTargetType(Bandana)

		uo.deletejournal()
		uo.usetype(Scissors)
		repeat
		wait(150)
		until uo.InJournal('You put the') or UO.InJournal("found")
		wait (100)
	else
return
endif

		until not uo.FindCount() or UO.InJournal("found")
		
	endif
	
	
	
	
endsub
	
	
####################################################
Sub checklag()
	UO.DeleteJournal()
	UO.Click("backpack")
	repeat
	wait(100)
	until UO.InJournal("ackpack")
endsub
	
	
############################################################
Sub hiding2()
	wait(1200)
	var ms1="You have hidden"
	var ms2="You can"
	
	repeat
	uo.deletejournal()
	wait(300)
	
	uo.useskill("Hiding")
	repeat
	wait(600)
	until uo.injournal(ms1) or uo.injournal(ms2)
	until uo.injournal(ms1)
	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 all") 
		;UO.Exec("exec autoload") 
		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
	
	####################################################
	sub Lootall()
	var n, corpse   
	if (uo.getserial("backpack") <> uo.getserial("lastcontainer")) then
		uo.ignorereset()
		corpse=uo.getserial("lastcontainer")
		uo.findtype(-1,-1,corpse)
		while uo.findcount()
			
			
			n=uo.getserial("finditem")
			uo.moveitem("finditem",0,"backpack")
			uo.print(" item "+str(uo.findcount()))
			checklag()
			wait(600)
			uo.findtype(-1,-1,corpse)
			if uo.findcount() then
				if n==uo.getserial("finditem") then
					uo.ignore("finditem")
					uo.findtype(-1,-1,corpse)
				endif
			endif
		wend
	endif
	uo.print(" -= Done =- ")
	endsub
	
	
############################################################
Sub go(x,y,k)
	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"
	
	uo.print("GO   X="+str(x)+ " Y="+str(y))
	
	if x<300 or y < 300 then
		return
	endif
	if x>13000 or y > 13000 then
		return
	endif
	
	While Exit<>1
		#PickUpArrow()
		
		dx=x-UO.GetX()
		wait (100)
		dy=y-UO.GetY()
		wait (100)
		If dx==0 AND dy==0 Then
			Exit=1
		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()
			wait (100)
			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
					wait (100)
					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
					wait (100)
					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()
	wait (100)
	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
			wait (100)
			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
			wait (100)
			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()
wait (100)
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
		wait (100)
		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
		wait (100)
		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
		wait (100)
		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
		wait (100)
		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()
	wait (100)
	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
			wait (100)
			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
			wait (100)
			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
		wait (100)
		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
		wait (100)
		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
			wait (100)
			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
			wait (100)
			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
		wait (100)
		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
		wait (100)
		StepArrow(UO.GetX(),UO.GetY(),dir,ldir,rdir,key)
	Wend
Endif
Endif
Endif
Endif
Wend
if k==1 then
	kopka()
endif
end sub

############################################################
Sub StepEdit(x,y,dir,key)
VAR walkwait=100
VAR ErrLevel=0
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()
	If x==UO.GetX() AND y==UO.GetY() Then
		ErrLevel=1
	Endif
Endif
Return ErrLevel
endsub

############################################################
Sub StepArrow(x,y,dir,ldir,rdir,key)
VAR walkwait=100
VAR ErrLevel=0
If UO.GetDir()<>dir Then
	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
	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
			ErrLevel=1
		Endif
	Endif
Endif
Return ErrLevel
endsub

############################################################
Sub CheckLag()
UO.DeleteJournal()
UO.Click("backpack")
repeat
Wait(550)
until UO.InJournal("backpack")
endsub


####################################################
Sub Loot1()
uo.print("loot " )

uo.ignorereset()
var corpse
VAR i

#--------------------------

UO.Set("quiet","1")
uo.set("finddistance", "3")
UO.UseObject( "lastcorpse" )
wait(1000)
; Ищем золото в последнем трупе
UO.FindType( "0x0eed", "-1", "lastcorpse" )
wait (200)
; Пока количество найденного больше 0
if UO.FindCount() > 0 then
	; Забираем найденное в пак
	UO.MoveItem( "finditem" )
	wait( 800 )
endif
#uo.ignore("self") 

UO.FindType( "0x1515", "-1", "lastcorpse" )
wait (200)
; Пока количество найденного больше 0
if UO.FindCount() > 0 then
	; Забираем найденное в пак
	UO.MoveItem( "finditem" )
	wait( 800 )
endif

UO.FindType( "0x0F3F", "-1", "lastcorpse" )
wait (200)
; Пока количество найденного больше 0
if UO.FindCount() > 0 then
	; Забираем найденное в пак
	UO.MoveItem( "finditem" )
	wait( 800 )
endif


UO.Print( "The loot was finished" )   
UO.Set("quiet","0")

#hiding()  
uo.set("finddistance", "18")

endsub


####################################################
sub Lootall()
var n, corpse   
if (uo.getserial("backpack") <> uo.getserial("lastcontainer")) then
	uo.ignorereset()
	corpse=uo.getserial("lastcontainer")
	uo.findtype(-1,-1,corpse)
	while uo.findcount()
		n=uo.getserial("finditem")
		uo.moveitem("finditem",0,"backpack")
		uo.print(" item "+str(uo.findcount()))
		checklag()
		wait(600)
		uo.findtype(-1,-1,corpse)
		if uo.findcount() then
			if n==uo.getserial("finditem") then
				uo.ignore("finditem")
				uo.findtype(-1,-1,corpse)
			endif
		endif
	wend
endif
uo.print(" -= Done =- ")
endsub


############################################################
sub hiding()
if UO.Hidden() then
	return
end if
UO.Press(9)
wait(150)
var msh1="You have hidden"
var msh2="You can't"
repeat
uo.deletejournal()
uo.useskill('Hiding')
repeat
wait(100)
until uo.injournal(msh1) or uo.injournal(msh2)
until uo.injournal(msh1)
endsub

###################################################
sub Gheal_self()
control_Mana(16)
uo.findtype('0x1F49','0x0000','my') ;0x1F49 скролл 0x0F0E бутылка
if uo.findcount()>=1 then
	uo.waittargetself()
	uo.usetype('0x1F49')
else
	uo.cast('Greater Heal','self')
	#uo.concolor('0x09DA')
	uo.charprint('0x09dc',"GH NOT BY SCROLL!")
	#uo.concolor('0x09A4')
endif
end sub

####################################################
sub bandages()
var war_mode
If uo.getHP() < uo.getMaxHP()  then 
	uo.print('  лечимся =======' )
	if uo.warmode()  then
		war_mode=1
		uo.warmode(false) 
		wait (100)
		uo.press(9) ; Tab
	else
		war_mode=0
	end if
	hiding()
	uo.setarm('current armor') 
	wait (100)
	uo.disarm() 
	wait (100)
	uo.print('HP=========================='+str(uo.getHP()) )
	# моем бинты
	UO.waittargettype('0x1008') 
	UO.usetype('0x0e20') 
	Wait(1000) 
	repeat 
	uo.bandageself() 
	wait(4000) 
	until uo.getHP() >= uo.getMaxHP() -8
	uo.arm('current armor') 
	wait (800)
	uo.warmode(war_mode) 
end if
endsub