слепой журнал

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
omi4
Posts: 457
Joined: 2005-07-10 21:53:05

слепой журнал

Post by omi4 »

Попытка написания скрипта на добычу ресурсов, который юзает журнал, но пофиг на сами сообщения.
Для работы на рунке, а также сфере с измененными месагами.

Code: Select all

sub main()
; + EDIT ++++++++++++++++++
	var zona = 6;
; +++++++++++++++++++++++++
	var m, i, a, tr = 1, tX, tY
	for i=1 to zona
		if tr then
			m = - 6
		else
			m = 6
		endif
		for a=1 to zona
			tY = UO.GetX() + m
			GotoXY(tX,tY)
			if Lamber() then
				return 0
			endif
		next
		tX = UO.GetY() - 6
		if tr then
			tr = 0
		else
			tr = 1
		endif
	next
endsub

Sub Lamber()
	var X, Y, MaxRange = 3, LTimer
	for Y = -MaxRange to MaxRange
		for X = -MaxRange to MaxRange
			if Tree(UO.GetX()+X, UO.GetY()+Y) then
				repeat
					UO.Warmode(0)
					Util();
					LTimer = UO.Timer()
					UO.DeleteJournal()
					UO.WaitTargetTile(Tree(UO.GetX()+X, UO.GetY()+Y), UO.GetX()+X, UO.GetY()+Y, UO.GetZ())
					UO.UseObject("_0x0F43")
					repeat
						wait(100)
					until UO.InJournal("is attacking you") || UO.JournalSerial(UO.InJournal(" ") -1) == "0xFFFFFFFF" || UO.Dead()
					if UO.InJournal("is attacking you") || UO.Weight >= 40 + UO.STR * 3.5 || UO.Dead() then
						if UO.Dead() then
							;Resurrection()
						else
							UO.Cast('Recall', '^0x1F14')
						endif
						return 1
					endif
				until (UO.Timer() - LTimer) < 6 || UO.Dead()
			endif
		next
	next
	return 0
end sub

Sub Tree(X,Y)
	var i
	if UO.PrivateGetTile(X, Y, -1, 3274, 3302) then
		for i=3274 to 3302
			if UO.PrivateGetTile(X, Y, -1, i, i) then
				if i==3278 || i==3279 || i==3281 || i==3282 || i==3284 || i==3285 || i==3287 || i==3289 then
					return 0
				endif
				if i==3291 || i==3292 || i==3294 || i==3295 || i==3297 || i==3298 || i==3300 || i==3301 then
					return 0
				endif
				return i
			end if
		next
	end if
	return 0
end sub

Sub Util()
	while not UO.Hidden()
		UO.UseSkill('Stealth')
		repeat
			wait(100)
		until UO.JournalSerial(UO.InJournal(" ") -1) == "0xFFFFFFFF"
		UO.DeleteJournal()
	wend
endsub

Sub GotoXY(x,y) 
	var myX, myY, lastX = 0,lastY = 0, i, halt=0, z, r = 0
	for i = 1  to 60 
		MyX = UO.GetX(); 
		MyY = UO.GetY(); 
		Util(); 
		if LastX == MyX && LastY == MyY then 
			halt = halt + 1 
		else 
			halt=0 
		end if 
		if halt >= 10 then 
			if UO.GetDir() == 1 then 
				UO.Press(40,5) 
			end if 
			if UO.GetDir() == 3 then 
				UO.Press(37,5) 
			end if 
			if UO.GetDir() == 5 then 
				UO.Press(38,5) 
			end if 
			if UO.GetDir() == 7 then 
				UO.Press(39,5) 
			end if 
			halt=15 
		end if 
		if abs(x - myX) <= 1 && abs(y - myY) <= 1 then 
			return 1 
		end if 
		if x <= MyX then 
			if y <= MyY then 
				UO.Press(38,3) 
			end if 
			UO.Press(37,3) 
		else 
			if y <= MyY then 
				UO.Press(39,3) 
			end if 
			UO.Press(40,3) 
		end if 
		lastX = myX 
		lastY = myY 
		wait(200) 
	next 
	return 0 
end sub 

Sub abs(x) 
	if x > 0 then 
		return x 
	end if 
		return -x 
end sub 
Post Reply