Page 1 of 1

Помогите со скриптом

Posted: 2013-02-20 21:24:45
by Lucky87
Добавил в него кое что смотреть ниже самого скрипта.

Code: Select all

VAR monst= '0x0004'
VAR k, j
sub main()
	uo.exec('terminate Reconnector')
	wait(3000)
	uo.exec('exec Reconnector')
	UO.AddObject("Runebook",'0x404E9CCA')
	while not uo.dead()
		UO.Set('finddistance','7')
		UO.FindType('0x0004', '-1', 'ground')
		if UO.FindCount() > 0 then
			UO.UseType('0x13FA','0x0000')
			UO.Warmode(1)
			UO.Attack('finditem')
			repeat
				uo.attack('lastattack')
				uo.attack('laststatus')
				if UO.LIFE<90 then
					poly()
				end if
				Walker(UO.GetX("finditem"),UO.GetY("finditem"),1) 
				wait(300) 
				UO.FindType(monst, '-1', 'ground') 
			until UO.FindCount() == 0
		else 
			wait(100) 
		end if
		Loot()
		bandage()
		poly()
		uo.findtype('0x0F78','-1','backpack')
		if uo.getquantity('finditem')>159 then
			sbros()
		end if
		wait(1000)
		hide()
	end if
wend
end sub
sub Loot()
var b
dim mobloot[2] 
mobloot[0]='0x0EED'       #  GP
mobloot[1]='0x0F78'       #  Batwings
mobloot[2]='0x0F0F'       #  Emerald
mobloot[3]='0x0F11'       #  Sapphire
mobloot[4]='0x0F12'       #   Sapphire 2
mobloot[5]='0x0F13'       # Ruby
mobloot[6]='0x0F14'       #  Ruby 2
mobloot[7]='0x0F15'       # Citrine
mobloot[8]='0x0F16'       #  Amethyst
mobloot[9]='0x0F17'       #  Amethyst2
mobloot[10]='0x0F18'      #  Tourmaline
mobloot[11]='0x0F19'      #  Sapphire 3
mobloot[12]='0x0F1A'      #  Ruby 3
mobloot[13]='0x0F1B'      #  Star Sapphire 2
mobloot[14]='0x0F1C'      #  Ruby 4
mobloot[15]='0x0F1D'      #  Ruby 5
mobloot[16]='0x0F1E'      #  Tourmaline 2
mobloot[17]='0x0F1F'      #  Sapphire 4
mobloot[18]='0x0F20'      #  Tourmaline 3
mobloot[19]='0x0F21'      #  Star Sapphire 3
mobloot[20]='0x0F22'      # Amethyst 3
mobloot[21]='0x0F23'      #  Citrine 2
mobloot[22]='0x0F24'      #  Citrine 3
mobloot[23]='0x0F25'      #  Piece of Amber
mobloot[24]='0x0F26'      #  Diamond
mobloot[25]='0x0F27'      #  Diamond 2
mobloot[26]='0x0F28'      #  Diamond 3
UO.UseObject('lastcorpse')
wait (500)
uo.waittargetobject('lastcorpse')
If NOT UO.ObjAtLayer('Rhand') Then 
uo.useobject(uo.ObjAtLayer('Lhand'))
else
uo.useobject(uo.ObjAtLayer('Rhand'))
end if               
wait(1000)
for b=0 To 1
uo.findtype(mobloot[b],'-1','lastcontainer') 
if uo.findcount() then    
uo.grab(0,'finditem')
wait (875)
endif
next
end sub
sub poly()
if UO.Life < 1 then
Ress()
endif
uo.cancelmenu()
uo.automenu('What do you want to polymorph int','Daemon')
if uo.str < 300 then
if UO.Life < 1 then
Ress()
endif
uo.warmode(0)
Walker(5854, 1427, 0)
wait(300)
uo.opendoor()
wait(300)
Walker(5856, 1427, 0)
wait(300)
repeat
uo.opendoor()
wait(300)
Walker(5856, 1427, 0)
wait(300)
Walker(5856, 1426, 0)
wait(300)
until UO.GetX() == 5856 and UO.GetY() == 1426 or uo.dead()
k = 1
while k==1
if uo.mana < 24 then
uo.findtype ('0x0F0E','0x09DF','my')
if uo.findcount()>0 then
uo.useobject ('finditem')
endif
endif
UO.DeleteJournal() 
uo.cast('Polymorph')
wait(10000)
if uo.injournal('spell fizzles') OR uo.injournal('You lack') then
uo.print('Try again!')
else
k=0
endif
wend
wait(500)
UO.Count('0x13FA','0x0000')
UO.UseType('0x13FA','0x0000')
uo.warmode(1)
uo.attack('lastattack')
Walker(5856, 1427, 0)
uo.opendoor()
wait(300)
Walker(5851, 1427, 0)
wait(300)
if UO.GetX() == 5851 then
uo.opendoor()
end if
repeat
if UO.Life < 1 then
Ress()
endif
uo.opendoor()
wait(300)
Walker(5851, 1427, 0)
wait(300)
until UO.GetX() == 5851 or uo.dead()
endif
end sub
sub poly1()
uo.cancelmenu()
uo.automenu('What do you want to polymorph int','Daemon')
if uo.str < 300 then
k = 1
while k==1
if uo.mana < 24 then
uo.findtype ('0x0F0E','0x09DF','my')
if uo.findcount()>0 then
uo.useobject ('finditem')
endif
endif
UO.DeleteJournal() 
uo.cast('Polymorph')
wait(10000)
if uo.injournal('spell fizzles') OR uo.injournal('You lack') then
uo.print('Try again!')
else
k=0
endif
wend
wait(500)
UO.Count('0x13FA','0x0000')
UO.UseType('0x13FA','0x0000')
endif
end sub
sub bandage()
uo.findtype('0x0E21','0x000','backpack')
if uo.findcount() and uo.life < uo.str then
if not uo.hidden() then 
uo.warmode (0) 
uo.useskill ('Hiding')
endif
uo.exec('bandageself')
wait(3300)
if uo.Count('0x0E21')<10 then
uo.Exec("waittargettype 0x1008")
uo.Exec("usetype 0x0E20")
wait(500)
end if
end if
UO.Count('0x13FA','0x0000')
UO.UseType('0x13FA','0x0000')
end sub
sub rhome()
repeat
if UO.Life < 1 then
Ress()
endif
CheckWorldSave()
uo.warmode (0)
uo.useskill ("Hiding")
uo.exec("recall Runebook 21")
wait(9000)
repeat
if UO.Life < 1 then
Ress()
endif
wait(100)
until UO.GetX() == 4093 or uo.injournal('fizzles') or uo.dead()
until UO.GetX() == 4093 or uo.dead()
wait(1000)
CheckWorldSave()
sbros()
end sub
sub sbros()
repeat
if UO.Life < 1 then
Ress()
endif
CheckWorldSave()
uo.warmode (0)
uo.useskill ("Hiding")
uo.exec("recall Runebook 21")
wait(9000)
repeat
if UO.Life < 1 then
Ress()
endif
wait(100)
until UO.GetX() == 4093 or uo.injournal('fizzles') or uo.dead()
until UO.GetX() == 4093 or uo.dead()
CheckWorldSave()
uo.useobject('0x4036EC62')
wait(500)
CheckWorldSave()
uo.useobject('backpack')
wait(500)
VAR a,Exit
VAR UnloadCont='0x4036EC62'
DIM Ore[2]
mobloot[0]='0x0EED'         # GP
mobloot[1]='0x0F78'         # Batwings
mobloot[2]='0x0F0F'         # Emerald
mobloot[3]='0x0F11'         # Sapphire
mobloot[4]='0x0F12'         # Sapphire 2
mobloot[5]='0x0F13'         # Ruby
mobloot[6]='0x0F14'         # Ruby 2
mobloot[7]='0x0F15'         # Citrine
mobloot[8]='0x0F16'         # Amethyst
mobloot[9]='0x0F17'         # Amethyst2
mobloot[10]='0x0F18'        #  Tourmaline
mobloot[11]='0x0F19'        #  Sapphire 3
mobloot[12]='0x0F1A'        #  Ruby 3
mobloot[13]='0x0F1B'        #  Star Sapphire 2
mobloot[14]='0x0F1C'        #  Ruby 4
mobloot[15]='0x0F1D'        #  Ruby 5
mobloot[16]='0x0F1E'        #  Tourmaline 2
mobloot[17]='0x0F1F'        #  Sapphire 4
mobloot[18]='0x0F20'        #  Tourmaline 3
mobloot[19]='0x0F21'        #  Star Sapphire 3
mobloot[20]='0x0F22'        # Amethyst 3
mobloot[21]='0x0F23'        #  Citrine 2
mobloot[22]='0x0F24'        #  Citrine 3
mobloot[23]='0x0F25'        #  Piece of Amber
mobloot[24]='0x0F26'        #  Diamond
mobloot[25]='0x0F27'        #  Diamond 2
mobloot[26]='0x0F28'        #  Diamond 3
UO.SetReceivingContainer(UnloadCont)
wait(500)
For a=0 to 1
Exit=0
repeat
UO.FindType(Ore[a])
if UO.GetQuantity('finditem')>0 then
UO.Grab('0','finditem')
wait(500)
Else
Exit=1
endif
until Exit==1
Next
UO.UnSetReceivingContainer()
wait(1000)
CheckWorldSave()
if uo.Count('0x13FA',0x0000,'my')<1 then
uo.findtype('0x13FA',0x0000,'0x4036EC62') ;Axe
if uo.findcount() then
uo.grab('1','finditem')
wait(1000)
end if
end if
CheckWorldSave()
uo.findtype('0x09BB',-1,'0x4036EC62') ;Food
if uo.findcount() then
uo.grab('1','finditem')
wait(1000)
uo.useobject('finditem')
end if
;CheckWorldSave()
;if uo.Count('0x0F0E','0x0631','backpack')<1 then
;uo.findtype('0x0F0E','0x0631','0x401611C2') ;Invis
;if uo.findcount() then
;uo.grab('3','finditem')
;wait(1000)
;end if
;end if
;CheckWorldSave()
;if uo.Count('0x0F0E','0x09DF','backpack')<1 then
;uo.findtype('0x0F0E','0x09DF','0x401611C2') ;Total
;if uo.findcount() then
;uo.grab('3','finditem')
;wait(1000)
;end if
;end if
CheckWorldSave()
if uo.Count('0x0F8D','0x000','backpack')<15 then
uo.findtype('0x0F8D','0x000','0x4036EC62') ;Spider Silk
if uo.findcount() then
uo.grab('20','finditem')
wait(1000)
end if
end if
CheckWorldSave()
if uo.Count('0x0F7B','0x000','backpack')<15 then
uo.findtype('0x0F7B','0x000','0x4036EC62') ;Blood Moss
if uo.findcount() then
uo.grab('20','finditem')
wait(1000)
end if
end if
CheckWorldSave()
if uo.Count('0x0F86','0x000','backpack')<15 then
uo.findtype('0x0F86','0x000','0x4036EC62') ;Mandrake Roots
if uo.findcount() then
uo.grab('20','finditem')
wait(1000)
end if
end if
CheckWorldSave()
if uo.Count('0x0E21','0x000','backpack')<30 then
uo.findtype('0x0E21','0x000','0x4036EC62') ;Bandage
if uo.findcount() then
uo.grab('50','finditem')
wait(1000)
end if
end if
CheckWorldSave()
uo.exec("recall Runebook 33")
wait(9000)
poly1()
bandage()
CheckWorldSave()
uo.exec('exec healandhide')
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
Walker(5786, 1420, 0)
Walker(5792, 1426, 0)
Walker(5792, 1491, 0)
Walker(5802, 1501, 0)
Walker(5824, 1501, 0)
Walker(5835, 1490, 0)
Walker(5835, 1484, 0)
Walker(5863, 1484, 0)
Walker(5863, 1417, 0)
Walker(5856, 1427, 0)
uo.exec('terminate healandhide')
uo.opendoor()
wait(300)
Walker(5851, 1427, 0)
wait(300)
if UO.GetX() == 5851 then
uo.opendoor()
end if
repeat
if UO.Life < 1 then
Ress()
endif
uo.opendoor()
wait(300)
Walker(5851, 1427, 0)
wait(300)
until UO.GetX() == 5851 or uo.dead()
end sub
sub sbros1()
uo.exec('terminate main')
wait(1000)
repeat
if UO.Life < 1 then
Ress()
endif
CheckWorldSave()
uo.warmode (0)
uo.useskill ("Hiding")
uo.exec("recall Runebook 21")
wait(9000)
repeat
if UO.Life < 1 then
Ress()
endif
wait(100)
until UO.GetX() == 4093 or uo.injournal('fizzles') or uo.dead()
until UO.GetX() == 4093 or uo.dead()
CheckWorldSave()
uo.useobject('0x4036EC62')
wait(500)
CheckWorldSave()
uo.useobject('backpack')
wait(500)
VAR a,Exit
VAR UnloadCont='0x4036EC62'
DIM Ore[2]
mobloot[0]='0x0EED'         # GP
mobloot[1]='0x0F78'         # Batwings
mobloot[2]='0x0F0F'         # Emerald
mobloot[3]='0x0F11'         # Sapphire
mobloot[4]='0x0F12'         # Sapphire 2
mobloot[5]='0x0F13'         # Ruby
mobloot[6]='0x0F14'         # Ruby 2
mobloot[7]='0x0F15'         # Citrine
mobloot[8]='0x0F16'         # Amethyst
mobloot[9]='0x0F17'         # Amethyst2
mobloot[10]='0x0F18'        #  Tourmaline
mobloot[11]='0x0F19'        #  Sapphire 3
mobloot[12]='0x0F1A'        #  Ruby 3
mobloot[13]='0x0F1B'        #  Star Sapphire 2
mobloot[14]='0x0F1C'        #  Ruby 4
mobloot[15]='0x0F1D'        #  Ruby 5
mobloot[16]='0x0F1E'        #  Tourmaline 2
mobloot[17]='0x0F1F'        #  Sapphire 4
mobloot[18]='0x0F20'        #  Tourmaline 3
mobloot[19]='0x0F21'        #  Star Sapphire 3
mobloot[20]='0x0F22'        # Amethyst 3
mobloot[21]='0x0F23'        #  Citrine 2
mobloot[22]='0x0F24'        #  Citrine 3
mobloot[23]='0x0F25'        #  Piece of Amber
mobloot[24]='0x0F26'        #  Diamond
mobloot[25]='0x0F27'        #  Diamond 2
mobloot[26]='0x0F28'        #  Diamond 3
UO.SetReceivingContainer(UnloadCont)
wait(500)
For a=0 to 1
Exit=0
repeat
UO.FindType(Ore[a])
if UO.GetQuantity('finditem')>0 then
UO.Grab('0','finditem')
wait(500)
Else
Exit=1
endif
until Exit==1
Next
UO.UnSetReceivingContainer()
wait(150000)
CheckWorldSave()
if uo.Count('0x13FA',0x0000,'my')<1 then
uo.findtype('0x13FA',0x0000,'0x4036EC62') ;Axe
if uo.findcount() then
uo.grab('1','finditem')
wait(1000)
end if
end if
CheckWorldSave()
uo.findtype('0x09BB',-1,'0x4036EC62') ;Food
if uo.findcount() then
uo.grab('1','finditem')
wait(1000)
uo.useobject('finditem')
end if
;CheckWorldSave()
;if uo.Count('0x0F0E','0x0631','backpack')<1 then
;uo.findtype('0x0F0E','0x0631','0x401611C2') ;Invis
;if uo.findcount() then
;uo.grab('3','finditem')
;wait(1000)
;end if
;end if
;CheckWorldSave()
;if uo.Count('0x0F0E','0x09DF','backpack')<1 then
;uo.findtype('0x0F0E','0x09DF','0x401611C2') ;Total
;if uo.findcount() then
;uo.grab('3','finditem')
;wait(1000)
;end if
;end if
CheckWorldSave()
if uo.Count('0x0F8D','0x000','backpack')<15 then
uo.findtype('0x0F8D','0x000','0x4036EC62') ;Spider Silk
if uo.findcount() then
uo.grab('20','finditem')
wait(1000)
end if
end if
CheckWorldSave()
if uo.Count('0x0F7B','0x000','backpack')<15 then
uo.findtype('0x0F7B','0x000','0x4036EC62') ;Blood Moss
if uo.findcount() then
uo.grab('20','finditem')
wait(1000)
end if
end if
CheckWorldSave()
if uo.Count('0x0F86','0x000','backpack')<15 then
uo.findtype('0x0F86','0x000','0x4036EC62') ;Mandrake Roots
if uo.findcount() then
uo.grab('20','finditem')
wait(1000)
end if
end if
CheckWorldSave()
if uo.Count('0x0E21','0x000','backpack')<30 then
uo.findtype('0x0E21','0x000','0x4036EC62') ;Bandage
if uo.findcount() then
uo.grab('50','finditem')
wait(1000)
end if
end if
CheckWorldSave()
uo.exec("recall Runebook 33")
wait(9000)
poly1()
bandage()
CheckWorldSave()
uo.exec('exec healandhide')
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
Walker(5786, 1420, 0)
Walker(5792, 1426, 0)
Walker(5792, 1491, 0)
Walker(5802, 1501, 0)
Walker(5824, 1501, 0)
Walker(5835, 1490, 0)
Walker(5835, 1484, 0)
Walker(5863, 1484, 0)
Walker(5863, 1417, 0)
Walker(5856, 1427, 0)
uo.exec('terminate healandhide')
uo.opendoor()
wait(300)
Walker(5851, 1427, 0)
wait(300)
if UO.GetX() == 5851 then
uo.opendoor()
end if
repeat
if UO.Life < 1 then
Ress()
endif
uo.opendoor()
wait(300)
Walker(5851, 1427, 0)
wait(300)
until UO.GetX() == 5851 or uo.dead()
uo.exec('exec main')
end sub
sub healandhide()
while not uo.dead()
uo.findtype('0x0E21','0x000','backpack')
if uo.findcount() and uo.life < uo.str then
if not uo.hidden() then 
uo.warmode (0) 
uo.useskill ('Hiding')
endif
uo.exec('bandageself')
wait(3300)
if uo.Count('0x0E21')<10 then
uo.Exec("waittargettype 0x1008")
uo.Exec("usetype 0x0E20")
wait(500)
endif
endif
wend
end sub
sub hide()
if not uo.hidden() then
uo.warmode(0)
uo.useskill('Hiding')
end if
end sub
sub manach()
if uo.mana < 24 then
uo.count ('0x0F0E','0x09DF')
if uo.findcount()>0 then
uo.useobject ('finditem')
endif
endif
end sub
sub Ress()
var OldX, OldY
while uo.dead()
OldX=uo.GetX()
OldY=uo.GetY()
uo.warmode (0)
uo.Exec('terminate main') 
wait(3000)
uo.TextOpen()
uo.TextPrint('- deadbatwings - @ '+MakeTime())
wait(3000)
repeat
Alert()
CheckWorldSave()
uo.lclick(980, 51)
wait(1000)
CheckWorldSave()
uo.lclick(264,306)
wait(1000)
CheckWorldSave()
uo.lclick(333,233)
wait(4000)
CheckWorldSave()
until UO.GetX() == 2706 and UO.GetY() == 2163  
Walker(2733, 2163, 0) 
Walker(2733, 2160, 0) 
wait(1000)
CheckWorldSave()
uo.findtype('0x0004',-1,'ground')
repeat
uo.useobject('finditem')
wait(5000)
until not uo.dead()
wait(10000)
CheckWorldSave()
uo.exec("recall Runebook 21")
wait(9000)
uo.useobject('0x4036EC62')
wait(500)
uo.useobject('backpack')
wait(500)
CheckWorldSave()
if uo.Count('0x13FA',0x0000,'my')<1 then
uo.findtype('0x13FA',0x0000,'0x4036EC62') ;Axe
if uo.findcount() then
uo.grab('1','finditem')
wait(1000)
end if
end if
CheckWorldSave()
uo.findtype('0x09BB',-1,'0x4036EC62') ;Food
if uo.findcount() then
uo.grab('1','finditem')
wait(1000)
uo.useobject('finditem')
end if
;CheckWorldSave()
;if uo.Count('0x0F0E','0x0631','backpack')<1 then
;uo.findtype('0x0F0E','0x0631','0x401611C2') ;Invis
;if uo.findcount() then
;uo.grab('3','finditem')
;wait(1000)
;end if
;end if
;CheckWorldSave()
;if uo.Count('0x0F0E','0x09DF','backpack')<1 then
;uo.findtype('0x0F0E','0x09DF','0x401611C2') ;Total
;if uo.findcount() then
;uo.grab('3','finditem')
;wait(1000)
;end if
;end if
CheckWorldSave()
if uo.Count('0x0F8D','0x000','backpack')<10 then
uo.findtype('0x0F8D','0x000','0x4036EC62') ;Spider Silk
if uo.findcount() then
uo.grab('15','finditem')
wait(1000)
end if
end if
CheckWorldSave()
if uo.Count('0x0F7B','0x000','backpack')<10 then
uo.findtype('0x0F7B','0x000','0x4036EC62') ;Blood Moss
if uo.findcount() then
uo.grab('15','finditem')
wait(1000)
end if
end if
CheckWorldSave()
if uo.Count('0x0F86','0x000','backpack')<10 then
uo.findtype('0x0F86','0x000','0x4036EC62') ;Mandrake Roots
if uo.findcount() then
uo.grab('15','finditem')
wait(1000)
end if
end if
CheckWorldSave()
if uo.Count('0x0E21','0x000','backpack')<15 then
uo.findtype('0x0E21','0x000','0x4036EC62') ;Bandage
if uo.findcount() then
uo.grab('30','finditem')
wait(10000)
end if
end if
CheckWorldSave()
uo.exec("recall Runebook 33")
wait(9000)
poly1()
bandage()
CheckWorldSave()
uo.exec('exec healandhide')
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
wait(400)
uo.press(36)
Walker(5786, 1420, 0)
Walker(5792, 1426, 0)
Walker(5792, 1491, 0)
Walker(5802, 1501, 0)
Walker(5824, 1501, 0)
Walker(5835, 1490, 0)
Walker(5835, 1484, 0)
Walker(5863, 1484, 0)
Walker(5863, 1417, 0)
Walker(5856, 1427, 0)
uo.exec('terminate healandhide')
uo.opendoor()
wait(300)
Walker(5851, 1427, 0)
wait(300)
if UO.GetX() == 5851 then
uo.opendoor()
end if
repeat
if UO.Life < 1 then
Ress()
endif
uo.opendoor()
wait(300)
Walker(5851, 1427, 0)
wait(300)
until UO.GetX() == 5851 or uo.dead()
uo.exec('exec main')
end sub
sub Alert()
uo.playwav("C:\UO\music\combat3")
wait(500)
uo.playwav("C:\UO\music\combat3")
wait(500)
uo.playwav("C:\UO\music\combat3")
wait(500)
uo.playwav("C:\UO\music\combat3")
wait(500)
uo.playwav("C:\UO\music\combat3")
wait(500)
end sub
sub Skvoz_chara()
If UO.GetGlobal('GMstepCheck')=='on' Then
UO.SetGlobal('GMstepCheck','off')
UO.Print("GM Step: Off")
UO.Morph('0')
Else
UO.SetGlobal('GMstepCheck','on')
UO.Print("GM Step: On")
UO.Morph('0x03DB');  0x03DB
End If
end sub
Sub CheckWorldSave()
if uo.injournal('World is saving') then
repeat
wait(500)
until uo.injournal('data saved')
endif
end sub
sub checkplayer()
var player 
uo.Set('finddistance','7') 
var i 
DIM people[2] 

people[0]='0x0190' ; Male
people[1]='0x0191' ; Female
uo.Ignore('self')    
for i = 0 to 1 
uo.FindType(people[i],'-1','ground') 
player = uo.GetSerial('finditem') 
wait(500) 
if uo.FindCount() then 
uo.msg('\w Karakyt:Fire Dungeon - Someone are coming!!!')
rhome() 
else 
end if 
next 
uo.IgnoreReset() 
end sub
sub Reconnector()
var ReconnectTime, RFlag
ReconnectTime = '0'
RFlag = 1
Repeat
Check()
While (uo.ObjAtLayer('Bpack') == '')
if RFlag Then
ReconnectTime = MakeTime()
RFlag = 0
endif
Wait(100000) # WorldSave Protection
uo.Say('')
Wait(5000)
uo.Say('')
Wait(5000)
uo.Say('')
Wait(5000)
uo.LDblClick(357,164)
uo.LClick(616,459)
Wait(5000)
Wend
Wait(3000)
if (RFlag == 0) and (ReconnectTime <> '0') Then
uo.TextOpen()
uo.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
uo.useobject('self')
wait(1000)
uo.useobject('backpack')
wait(1000)
RFlag = 1
ReconnectTime = '0'
wait(1000)
sbros1()
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 CheckLag()
UO.DeleteJournal()
UO.Click('backpack')
Repeat
Wait(100)
Until UO.InJournal("backpack")
end sub
sub Check()
if UO.Life < 1 then
Ress()
endif
if uo.injournal('FLY HOME FLY') then
sbros1()
end if
if uo.injournal('Your large battle axe is destroyed') then
sbros1()
end if
end sub
########################################## ХОДИЛКА 3 ########################## 
#var Prec=0 # Как близко следует подойти к цели (Precision) 
#var MaxTraceDistance=15 # Максимальная длина обхода. Желательно ставить с расчета возможных препятсвий. Если ставить очень #большие числа, кодилка может пойти в обход пол мира чтобы дойти к соседнему дереву. 
#var Speed=2 # Длина шага. Сколько шагов делать за раз. Выше 3 ставить смысла нет. Тоесть тупое умножение шагов. Для ламбера #идеально 3, для майнинга - 1. 
#var StepTimeOut=400 # Если уперлись в неопознанный обьект, сколько мсек ждать сдвига с места. Если по простому - таймаут #шага. Если поставить сильно маленькие, ходилка начнет трассировать пустые места. 
#UO.SetGlobal("Logging","1")  # - показывать отладочные сообщения. 
#UO.SetGlobal("BlindWalk","0") # - не использовать проверку тайлов, а использовать ходьбу наощупь. Для майнинга ОБЯЗАТЕЛЬНО #ВКЛЮЧИТЬ. 
#В функции IsPass, содержиться список проходимых тайлов. 

#Walker(X,Y,Prec) - идем к цели с координатами X,Y. Возвращает 1 в случае успешного достижения цели, и 0 - при невозможном обходе (путь не найден) 
#Tracer(StartDir,Direction) - трассировка 1 шага. Возвращает направление по которому получилось сдвинуться с места. StartDir #- направление последнего движения, Direction (-1 или +1) направление обхода. -1 - по часовой стрелке, +1 против часовой #стрелки. Направления скрипт использует личного формата: 
#1 - влево вниз 
#2 - вниз 
#3 - вправо вниз 
#4 - вправо 
#5 - вправо вверх 
#6 - вверх 
#7 - влево вверх 
#8 - влево 
#Tracer(StartDir,Direction) - идеально подходит для рыбалки вдоль берега так как она будет обходить берег бесконечно (1 #запуск функции = 1 шаг обхода). 
##################################################### 
# WW  W  WW   AA    LL     Kk KK  EE  EE  RRR       # 
# WW  W  WW  AA A   LL     Kk K   EEE     R  R      # 
# WW  W  WW  AA A   LL     KKK    EEEEE   R R       # 
# WW WW  WW  AAAA   LL     KKK    EEE     RRR       # 
#  WWW WWW  AA   A   LLLL  KK Kk  EE  EE  R  RR     # 
#################################################### 
var MaxTraceDistance=3 
var TraceLoopIncrease=3 #Увеличение MaxTraceDistance при исчерпании количества ходов 
var LimitTrace=50 #Сколько шагов в ОБЕ стороны от начальной точки обхода прекращают ходилку (выхода нет). 
var Speed=1 
var StepTimeOut=400 #Таймаут шага. Устанавливать не в размер пинга, а в размер шага + размер пинга. 
# Для ходьбы - 500+Ping 
# Для бега/ходьбы на лошади - 300+Ping 
# Бег на лошади - 150 + Ping 
var CheckCnt=2 #Количество слепых проверок. УВЕЛИЧИВАЕТ В СТОЛЬКО РАЗ ТАЙМАУТ. Использовать только на БЫСТРОМ но НЕСТАБИЛЬНОМ коннекте. При большом пинге будет УЖАС. 
var DynamicPause=300 #Минимальные паузы в циклах. Чем меньше число - тем меньше рывков и тем больше нагрузка процессора. 

Sub Walker(GoX,GoY,Prec) 
UO.SetGlobal("Logging","0") 
UO.SetGlobal("BlindWalk","0") 
var LastDir 
var MoveRes 
var TracerCnt 
UO.SetGlobal("GlobalGoX",str(GoX)) 
UO.SetGlobal("GlobalGoY",str(GoY)) 
k = 0
while not IsEnd(GoX,GoY,Prec) OR k < 2
TracerCnt = MaxTraceDistance 
repeat 
LogInfo('Just walking') 
LastDir=GoUntilHit(GoX,GoY,Prec) 
if IsEnd(GoX,GoY,Prec) then 
return 1 
end if 

if k == 2 then 
return 1 
end if 

LogInfo('Tracing') 
MoveRes = FullAroundTrace(LastDir,GoX,GoY,Prec,TracerCnt) 
if TracerCnt > LimitTrace then 
return 0 
endif 
TracerCnt = TracerCnt + TraceLoopIncrease 
k = k+1
until MoveRes == 1
wend 
return 1 
end sub 

Sub FullAroundTrace(StartDir,GoX,GoY,Prec,MaxTrace) 
var LineX=UO.GetX() 
var LineY=UO.GetY() 
var CurDir=StartDir 
var Direction=CountDirection(GoX,GoY,CurDir,Prec) 
var StartX,StartY 
var MovesDone=0 
repeat 
StartX=UO.GetX() 
StartY=UO.GetY() 
CurDir=Tracer(CurDir,Direction,Prec) 
if (CurDir==GetDir(GoX,GoY,Prec)) then 
return 1 
endif 
if MovesDone>0 and PrevMoveCross(GetDirToDir(UO.GetDir(),Prec),LineX,LineY,GoX,GoY,StartX,StartY,Prec) then 
return 1 
end if 
MovesDone=MovesDone+1 
CurDir=AddToDir(CurDir,-Direction,Prec) 
until MovesDone>MaxTrace 
return 0 
end sub 

Sub CountDirection(GoX,GoY,StartDir,Prec) 
var GoDir=GetDir(GoX,GoY,Prec) 
var MyX=UO.GetX() 
var MyY=UO.GetY() 
if GoDir<StartDir then 
return -1 
end if 
if GoDir>StartDir then 
return 1 
end if 
if Abs(MyX-GoX)>Abs(MyY-GoY) then 
if (GoDir==3 and GoY>MyY) OR (GoDir==7 and GoY<MyY) then 
return -1 
else 
return 1 
end if 
else 
if (GoDir==1 and GoX<MyX) or (GoDir==5 and GoX>MyX) then 
return -1 
else 
return 1 
end if 
end if 
end sub 

Sub PrevMoveCross(Dir,x1,y1,x2,y2,StartX,StartY,Prec) 
var x3,y3,x4,y4 
x3=StartX 
y3=StartY 
x4=StartX+(XFromDir(Dir)-StartX)*Speed 
y4=StartY+(YFromDir(Dir)-StartY)*Speed 
return LinesCrossing(x1,y1,x2,y2,x3,y3,x4,y4,Prec) 
end sub 

Sub LinesCrossing(x1,y1,x2,y2,x3,y3,x4,y4,Prec) 
if x1==x3 and y1==y3 then 
return false 
end if 
var z1=(x3-x1)*(y2-y1)-(y3-y1)*(x2-x1) 
var z2=(x4-x1)*(y2-y1)-(y4-y1)*(x2-x1) 
if z1*z2>0 then 
return false 
else 
LogInfo('Vector info:') 
LogInfo('x1= '+str(x1)) 
LogInfo('y1= '+str(y1)) 
LogInfo('x2= '+str(x2)) 
LogInfo('y2= '+str(y2)) 
LogInfo('x3= '+str(x3)) 
LogInfo('y3= '+str(y3)) 
LogInfo('x4= '+str(x4)) 
LogInfo('y4= '+str(y4)) 
return true 
end if 
end sub 

Sub IsDiap(X,X0,X1,Prec) 
if X<=X0+Prec and X>=X1-Prec OR X>=X0-Prec and X<=X1+Prec then 
return true 
end if 
return false 
end sub 

Sub GoUntilHit(GoX,GoY,Prec) 
var LastDir 
LastDir=GetDir(GoX,GoY,Prec) 
var CouldMove 
repeat 
LastDir=GetDir(GoX,GoY,Prec) 
if LastDir<>0 and not IsEnd(GoX,GoY,Prec) then 
CouldMove=TryDir(LastDir,Prec) 
end if 
until LastDir==0 or IsEnd(GoX,GoY,Prec) or not CouldMove 
return LastDir 
end sub 

Sub IsEnd(GoX,GoY,Prec) 
if Abs(UO.GetX()-GoX)<=Prec and Abs(UO.GetY()-GoY)<=Prec then 
LogInfo('END FOUND') 
return true 
else 
return false 
end if 
end sub 

Sub GetDir(GoX,GoY,Prec) 
var MyX=UO.GetX() 
var MyY=UO.GetY() 
var DiffX=Abs(UO.GetX()-GoX) 
var DiffY=Abs(UO.GetY()-GoY) 
var GoDir=0 
if (DiffX/(DiffY+0.1))>=2 then 
if (MyX>GoX) then 
GoDir=7 
else 
GoDir=3 
end if 
else 

if (DiffY/(DiffX+0.1))>=2 then 
if (MyY>GoY) then 
GoDir=5 
else 
GoDir=1 
end if 
else 

if (MyX>GoX) and (MyY>GoY) then 
GoDir=6 
else 
if (MyX>GoX) and (MyY<GoY) then 
GoDir=8 
else 
if (MyX<GoX) and (MyY>GoY) then 
GoDir=4 
else 
if (MyX<GoX) and (MyY<GoY) then 
GoDir=2 
end if 
end if 
end if 
end if 
end if 
end if 
return GoDir 
end sub 

Sub Tracer(StartDir,Direction,Prec) 
var CurDir=StartDir 
var Result 
repeat 
Result=TryDir(CurDir,Prec) 
if not Result then 
CurDir=AddToDir(CurDir,Direction,Prec) 
end if 
until Result 
return Result 
end sub 

Sub AddToDir(Dir,Cnt,Prec) 
var NewDir=Dir 
NewDir=NewDir+Cnt 
while NewDir>8 
NewDir=NewDir-8 
wend 
while NewDir<1 
NewDir=NewDir+8 
wend 
return NewDir 
end sub 

Sub TryDir(Dir,Prec) 
var BegX=UO.GetX() # Ia?aeuiia O 
var BegY=UO.GetY() # Ia?aeuiia Y 
var Counter=0 
var GoX=BegX 
var GoY=BegY 
GoX=XFromDir(Dir) 
GoY=YFromDir(Dir) 
if not IsPass(GoX,GoY) then 
LogInfo(str(GoX)+':'+str(GoY)+' is not passable') 
return false 
end if 
return TurnAndGoDir(Dir,Prec) 
end sub 

Sub XFromDir(Dir) 
if Dir==2 OR Dir==3 Or Dir==4 then 
return (UO.GetX()+1) 
end if 
if Dir==6 OR Dir==7 Or Dir==8 then 
return (UO.GetX()-1) 
end if 
return (UO.GetX()) 
end sub 

Sub YFromDir(Dir) 
if Dir==8 OR Dir==1 Or Dir==2 then 
return (UO.GetY()+1) 
end if 
if Dir==4 OR Dir==5 Or Dir==6 then 
return (UO.GetY()-1) 
end if 
return (UO.GetY()) 
end sub 

Sub TurnAndGoDir(Dir,Prec) 
var StartDir=GetDirToDir(UO.GetDir(),Prec) 
var StartX=UO.GetX() 
var StartY=UO.GetY() 
var EndDir 
var Counter=0 
var TestCounter=CheckCnt 
#Direction Test 
repeat 
Counter = 0 
LogInfo('Dir: '+str(StartDir)+' Counter: '+str(Counter))  
PressDir(Dir) 
repeat 
EndDir=GetDirToDir(UO.GetDir(),Prec) 
wait(DynamicPause) 
Counter=Counter+1 
until StartDir<>EndDir or StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=StepTimeOut/DynamicPause 
TestCounter = TestCounter - 1 
LogInfo('Dir: '+str(EndDir)+' Counter: '+str(Counter))  
until TestCounter <= 0 or Counter < StepTimeOut/DynamicPause 
if Counter>=StepTimeOut/DynamicPause  then 
LogInfo('Direction timeout reached') 
return 0 
end if 
#End direction Test 
if StartY<>UO.GetY() or StartX<>UO.GetX() then 
return Dir 
end if 

#Start Primary test 
TestCounter=CheckCnt 
repeat 
GoDir(Dir,Prec) 
Counter=0 
repeat 
wait(DynamicPause) 
Counter=Counter+1 
until StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=StepTimeOut/DynamicPause 
TestCounter = TestCounter - 1 
until TestCounter <= 0 or Counter < StepTimeOut/DynamicPause 
#End primary test 
if Counter>=StepTimeOut/DynamicPause then 
LogInfo('Step timeout reached') 
return 0 
else 
return Dir 
end if 
end sub 

Sub GetDirToDir(GotDir,Prec) 
var ChangedDir=-GotDir 
ChangedDir=AddToDir(ChangedDir,5,Prec) 
return ChangedDir 
end sub 

Sub DirToInj(Dir) 
dim Dirs[9] 
Dirs[1]=1 
Dirs[2]=2 
Dirs[3]=3 
Dirs[4]=6 
Dirs[5]=9 
Dirs[6]=8 
Dirs[7]=7 
Dirs[8]=4 

return (Dirs[Dir]) 
end sub 
Sub PressDir(Dir) 
dim Dirs[9] 
Dirs[1]=35 
Dirs[2]=40 
Dirs[3]=34 
Dirs[4]=39 
Dirs[5]=33 
Dirs[6]=38 
Dirs[7]=36 
Dirs[8]=37 

UO.Press(Dirs[Dir],1) 
end sub 
Sub GoDir(Dir,Prec) 
dim Dirs[9] 
Dirs[1]=35 
Dirs[2]=40 
Dirs[3]=34 
Dirs[4]=39 
Dirs[5]=33 
Dirs[6]=38 
Dirs[7]=36 
Dirs[8]=37 

var DistanceX=Abs(UO.GetX()-val(UO.GetGlobal("GlobalGoX"))) 
var DistanceY=Abs(UO.GetY()-val(UO.GetGlobal("GlobalGoY"))) 
var GoDistance 
if (DistanceX-Prec)<Speed then 
GoDistance=DistanceX-Prec 
else 
if (DistanceY-Prec)<Speed then 
GoDistance=DistanceY-Prec 
else 
GoDistance=Speed 
endif 
endif 

UO.Press(Dirs[Dir],GoDistance) 
end sub 

Sub IsPass(X,Y) 
if UO.GetGlobal("BlindWalk") then 
return true 
endif 

dim Types[60] 
Types[1]=3 
Types[2]=25 
Types[3]=51 
Types[4]=63 
Types[5]=113 
Types[6]=140 
Types[7]=172 
Types[8]=219 
Types[9]=232 
Types[10]=235 
Types[11]=239 
Types[12]=243 
Types[13]=248 
Types[14]=251 
Types[15]=264 
Types[16]=267 
Types[17]=282 
Types[18]=289 
Types[19]=321 
Types[20]=379 
Types[21]=420 
Types[22]=440 
Types[23]=476 
Types[24]=499 
Types[25]=513 
Types[26]=542 
Types[27]=578 
Types[28]=586 
Types[29]=622 
Types[30]=700 
Types[31]=804 
Types[32]=1740 
Types[33]=1758 
Types[34]=1770 
Types[35]=1779 
Types[36]=1779 
Types[37]=1881 
Types[38]=1886 
Types[39]=1801 
Types[40]=1805 
Types[41]=1813 
Types[42]=1820 
Types[43]=1831 
Types[44]=1833 
Types[45]=1843 
Types[46]=1850 
Types[47]=1873 
Types[48]=1876 
Types[49]=1885 
Types[50]=1888 
Types[51]=1946 
Types[52]=1969 
Types[53]=2500 
Types[54]=2539 

for var i=1 TO 53 STEP 2 
if UO.PrivateGetTile(X,Y,-1,Types[i],Types[i+1]) then 
return true 
end if 
next 
return false 
end sub 

Sub LogInfo(Line) 
if not UO.GetGlobal("Logging")=="0" then 
UO.TextOpen() 
UO.TextPrint(str(UO.GetX())+":"+str(UO.GetY())+" - "+Line); 
end if 
end sub 

Sub Abs(X) 
if X>0 then 
return X 
else 
return (-X) 
end if 
end sub 
########################################## КОНЕЦ ХОДИЛКИ 3 #############
Добавил в него

Code: Select all

mobloot[2]='0x0F0F'       #  Emerald
mobloot[3]='0x0F11'       #  Sapphire
mobloot[4]='0x0F12'       #   Sapphire 2
mobloot[5]='0x0F13'       # Ruby
mobloot[6]='0x0F14'       #  Ruby 2
mobloot[7]='0x0F15'       # Citrine
mobloot[8]='0x0F16'       #  Amethyst
mobloot[9]='0x0F17'       #  Amethyst2
mobloot[10]='0x0F18'       #  Tourmaline
mobloot[11]='0x0F19'       #  Sapphire 3
mobloot[12]='0x0F1A'       #  Ruby 3
mobloot[13]='0x0F1B'       #  Star Sapphire 2
mobloot[14]='0x0F1C'       #  Ruby 4
mobloot[15]='0x0F1D'       #  Ruby 5
mobloot[16]='0x0F1E'       #  Tourmaline 2
mobloot[17]='0x0F1F'       #  Sapphire 4
mobloot[18]='0x0F20'       #  Tourmaline 3
mobloot[19]='0x0F21'       #  Star Sapphire 3
mobloot[20]='0x0F22'       # Amethyst 3
mobloot[21]='0x0F23'       #  Citrine 2
mobloot[22]='0x0F24'       #  Citrine 3
mobloot[23]='0x0F25'       #  Piece of Amber
mobloot[24]='0x0F26'       #  Diamond
mobloot[25]='0x0F27'       #  Diamond 2
mobloot[26]='0x0F28'       #  Diamond 3
выбивает ошибку Unhandled exception in parser

Помогите буду оч благодарен =)

Re: Помогите со скриптом

Posted: 2013-02-20 23:09:54
by Mirage
Прямо в первой функции main и ошибка. Циклы приведи в порядок.

Re: Помогите со скриптом

Posted: 2013-02-20 23:12:05
by Lucky87
Mirage wrote:Прямо в первой функции main и ошибка. Циклы приведи в порядок.
я не особо разбираюсь , не могли бы вы помочь?

Re: Помогите со скриптом

Posted: 2013-02-21 06:53:13
by Mirage
задача скрипта какая?

Re: Помогите со скриптом

Posted: 2013-02-21 08:32:09
by Lucky87
Mirage wrote:задача скрипта какая?
Убивает гаргулей режит лутит , насобирал опредиленное кол-во летит домой скидует , реколится к данжу и идёт пешочком в кабину с гаргулями

Re: Помогите со скриптом

Posted: 2013-02-21 09:14:10
by Mirage
мда... Может быть не стоит не разбираясь в скриптах использовать самый сложный их тип - автоботов для охоты?

ЗЫ в ближайшее время постараюсь привести в порядок скрипт но если он до этого не работал - вам в ветку маркета придется обращаться.

Re: Помогите со скриптом

Posted: 2013-02-21 09:16:15
by Lucky87
Mirage wrote:мда... Может быть не стоит не разбираясь в скриптах использовать самый сложный их тип - автоботов для охоты?

ЗЫ в ближайшее время постараюсь привести в порядок скрипт но если он до этого не работал - вам в ветку маркета придется обращаться.
Скрипт обсолютно рабочий , он начал выбивать ошибку , когда я добавил в него что бы он с гаргулей лутил драг камни...

Re: Помогите со скриптом

Posted: 2013-02-21 09:27:43
by Mirage
Ну фиг знает рабочий или нет - в 2 местах в циклах точно ошибки были:

Code: Select all

VAR monst= '0x0004'
VAR k, j
sub main()
	uo.exec('terminate Reconnector')
	wait(3000)
	uo.exec('exec Reconnector')
	UO.AddObject("Runebook",'0x404E9CCA')
	while not uo.dead()
		UO.Set('finddistance','7')
		UO.FindType('0x0004', '-1', 'ground')
		if UO.FindCount() > 0 then
			UO.UseType('0x13FA','0x0000')
			UO.Warmode(1)
			UO.Attack('finditem')
			repeat
				uo.attack('lastattack')
				uo.attack('laststatus')
				if UO.LIFE<90 then
					poly()
				end if
				Walker(UO.GetX("finditem"),UO.GetY("finditem"),1) 
				wait(300) 
				UO.FindType(monst, '-1', 'ground') 
			until UO.FindCount() == 0
		else 
			wait(100) 
		end if
		Loot()
		bandage()
		poly()
		uo.findtype('0x0F78','-1','backpack')
		if uo.getquantity('finditem')>159 then
			sbros()
		end if
		wait(1000)
		hide()
	wend
end sub
sub Loot()
	var b
	dim mobloot[2] 
	mobloot[0]='0x0EED'       #  GP
	mobloot[1]='0x0F78'       #  Batwings
	mobloot[2]='0x0F0F'       #  Emerald
	mobloot[3]='0x0F11'       #  Sapphire
	mobloot[4]='0x0F12'       #   Sapphire 2
	mobloot[5]='0x0F13'       # Ruby
	mobloot[6]='0x0F14'       #  Ruby 2
	mobloot[7]='0x0F15'       # Citrine
	mobloot[8]='0x0F16'       #  Amethyst
	mobloot[9]='0x0F17'       #  Amethyst2
	mobloot[10]='0x0F18'      #  Tourmaline
	mobloot[11]='0x0F19'      #  Sapphire 3
	mobloot[12]='0x0F1A'      #  Ruby 3
	mobloot[13]='0x0F1B'      #  Star Sapphire 2
	mobloot[14]='0x0F1C'      #  Ruby 4
	mobloot[15]='0x0F1D'      #  Ruby 5
	mobloot[16]='0x0F1E'      #  Tourmaline 2
	mobloot[17]='0x0F1F'      #  Sapphire 4
	mobloot[18]='0x0F20'      #  Tourmaline 3
	mobloot[19]='0x0F21'      #  Star Sapphire 3
	mobloot[20]='0x0F22'      # Amethyst 3
	mobloot[21]='0x0F23'      #  Citrine 2
	mobloot[22]='0x0F24'      #  Citrine 3
	mobloot[23]='0x0F25'      #  Piece of Amber
	mobloot[24]='0x0F26'      #  Diamond
	mobloot[25]='0x0F27'      #  Diamond 2
	mobloot[26]='0x0F28'      #  Diamond 3
	UO.UseObject('lastcorpse')
	wait (500)
	uo.waittargetobject('lastcorpse')
	If NOT UO.ObjAtLayer('Rhand') Then 
		uo.useobject(uo.ObjAtLayer('Lhand'))
	else
		uo.useobject(uo.ObjAtLayer('Rhand'))
	end if               
	wait(1000)
	for b=0 To 1
		uo.findtype(mobloot[b],'-1','lastcontainer') 
		if uo.findcount() then    
			uo.grab(0,'finditem')
			wait (875)
		endif
	next
end sub
sub poly()
	if UO.Life < 1 then
		Ress()
	endif
	uo.cancelmenu()
	uo.automenu('What do you want to polymorph int','Daemon')
	if uo.str < 300 then
		if UO.Life < 1 then
			Ress()
		endif
		uo.warmode(0)
		Walker(5854, 1427, 0)
		wait(300)
		uo.opendoor()
		wait(300)
		Walker(5856, 1427, 0)
		wait(300)
		repeat
			uo.opendoor()
			wait(300)
			Walker(5856, 1427, 0)
			wait(300)
			Walker(5856, 1426, 0)
			wait(300)
		until UO.GetX() == 5856 and UO.GetY() == 1426 or uo.dead()
		k = 1
		while k==1
			if uo.mana < 24 then
				uo.findtype ('0x0F0E','0x09DF','my')
				if uo.findcount()>0 then
					uo.useobject ('finditem')
				endif
			endif
			UO.DeleteJournal() 
			uo.cast('Polymorph')
			wait(10000)
			if uo.injournal('spell fizzles') OR uo.injournal('You lack') then
				uo.print('Try again!')
			else
				k=0
			endif
		wend
		wait(500)
		UO.Count('0x13FA','0x0000')
		UO.UseType('0x13FA','0x0000')
		uo.warmode(1)
		uo.attack('lastattack')
		Walker(5856, 1427, 0)
		uo.opendoor()
		wait(300)
		Walker(5851, 1427, 0)
		wait(300)
		if UO.GetX() == 5851 then
			uo.opendoor()
		end if
		repeat
			if UO.Life < 1 then
				Ress()
			endif
			uo.opendoor()
			wait(300)
			Walker(5851, 1427, 0)
			wait(300)
		until UO.GetX() == 5851 or uo.dead()
	endif
end sub
sub poly1()
	uo.cancelmenu()
	uo.automenu('What do you want to polymorph int','Daemon')
	if uo.str < 300 then
		k = 1
		while k==1
			if uo.mana < 24 then
				uo.findtype ('0x0F0E','0x09DF','my')
				if uo.findcount()>0 then
					uo.useobject ('finditem')
				endif
			endif
			UO.DeleteJournal() 
			uo.cast('Polymorph')
			wait(10000)
			if uo.injournal('spell fizzles') OR uo.injournal('You lack') then
				uo.print('Try again!')
			else
				k=0
			endif
		wend
		wait(500)
		UO.Count('0x13FA','0x0000')
		UO.UseType('0x13FA','0x0000')
	endif
end sub
sub bandage()
	uo.findtype('0x0E21','0x000','backpack')
	if uo.findcount() and uo.life < uo.str then
		if not uo.hidden() then 
			uo.warmode (0) 
			uo.useskill ('Hiding')
		endif
		uo.exec('bandageself')
		wait(3300)
		if uo.Count('0x0E21')<10 then
			uo.Exec("waittargettype 0x1008")
			uo.Exec("usetype 0x0E20")
			wait(500)
		end if
	end if
	UO.Count('0x13FA','0x0000')
	UO.UseType('0x13FA','0x0000')
end sub
sub rhome()
	repeat
		if UO.Life < 1 then
			Ress()
		endif
		CheckWorldSave()
		uo.warmode (0)
		uo.useskill ("Hiding")
		uo.exec("recall Runebook 21")
		wait(9000)
		repeat
			if UO.Life < 1 then
				Ress()
			endif
			wait(100)
		until UO.GetX() == 4093 or uo.injournal('fizzles') or uo.dead()
	until UO.GetX() == 4093 or uo.dead()
	wait(1000)
	CheckWorldSave()
	sbros()
end sub
sub sbros()
	repeat
		if UO.Life < 1 then
			Ress()
		endif
		CheckWorldSave()
		uo.warmode (0)
		uo.useskill ("Hiding")
		uo.exec("recall Runebook 21")
		wait(9000)
		repeat
			if UO.Life < 1 then
				Ress()
			endif
			wait(100)
		until UO.GetX() == 4093 or uo.injournal('fizzles') or uo.dead()
	until UO.GetX() == 4093 or uo.dead()
	CheckWorldSave()
	uo.useobject('0x4036EC62')
	wait(500)
	CheckWorldSave()
	uo.useobject('backpack')
	wait(500)
	VAR a,Exit
	VAR UnloadCont='0x4036EC62'
	DIM Ore[2]
	mobloot[0]='0x0EED'         # GP
	mobloot[1]='0x0F78'         # Batwings
	mobloot[2]='0x0F0F'         # Emerald
	mobloot[3]='0x0F11'         # Sapphire
	mobloot[4]='0x0F12'         # Sapphire 2
	mobloot[5]='0x0F13'         # Ruby
	mobloot[6]='0x0F14'         # Ruby 2
	mobloot[7]='0x0F15'         # Citrine
	mobloot[8]='0x0F16'         # Amethyst
	mobloot[9]='0x0F17'         # Amethyst2
	mobloot[10]='0x0F18'        #  Tourmaline
	mobloot[11]='0x0F19'        #  Sapphire 3
	mobloot[12]='0x0F1A'        #  Ruby 3
	mobloot[13]='0x0F1B'        #  Star Sapphire 2
	mobloot[14]='0x0F1C'        #  Ruby 4
	mobloot[15]='0x0F1D'        #  Ruby 5
	mobloot[16]='0x0F1E'        #  Tourmaline 2
	mobloot[17]='0x0F1F'        #  Sapphire 4
	mobloot[18]='0x0F20'        #  Tourmaline 3
	mobloot[19]='0x0F21'        #  Star Sapphire 3
	mobloot[20]='0x0F22'        # Amethyst 3
	mobloot[21]='0x0F23'        #  Citrine 2
	mobloot[22]='0x0F24'        #  Citrine 3
	mobloot[23]='0x0F25'        #  Piece of Amber
	mobloot[24]='0x0F26'        #  Diamond
	mobloot[25]='0x0F27'        #  Diamond 2
	mobloot[26]='0x0F28'        #  Diamond 3
	UO.SetReceivingContainer(UnloadCont)
	wait(500)
	For a=0 to 1
		Exit=0
		repeat
			UO.FindType(Ore[a])
			if UO.GetQuantity('finditem')>0 then
				UO.Grab('0','finditem')
				wait(500)
			Else
				Exit=1
			endif
		until Exit==1
	Next
	UO.UnSetReceivingContainer()
	wait(1000)
	CheckWorldSave()
	if uo.Count('0x13FA',0x0000,'my')<1 then
		uo.findtype('0x13FA',0x0000,'0x4036EC62') ;Axe
		if uo.findcount() then
			uo.grab('1','finditem')
			wait(1000)
		end if
	end if
	CheckWorldSave()
	uo.findtype('0x09BB',-1,'0x4036EC62') ;Food
	if uo.findcount() then
		uo.grab('1','finditem')
		wait(1000)
		uo.useobject('finditem')
	end if
	;CheckWorldSave()
	;if uo.Count('0x0F0E','0x0631','backpack')<1 then
	;uo.findtype('0x0F0E','0x0631','0x401611C2') ;Invis
	;if uo.findcount() then
	;uo.grab('3','finditem')
	;wait(1000)
	;end if
	;end if
	;CheckWorldSave()
	;if uo.Count('0x0F0E','0x09DF','backpack')<1 then
	;uo.findtype('0x0F0E','0x09DF','0x401611C2') ;Total
	;if uo.findcount() then
	;uo.grab('3','finditem')
	;wait(1000)
	;end if
	;end if
	CheckWorldSave()
	if uo.Count('0x0F8D','0x000','backpack')<15 then
		uo.findtype('0x0F8D','0x000','0x4036EC62') ;Spider Silk
		if uo.findcount() then
			uo.grab('20','finditem')
			wait(1000)
		end if
	end if
	CheckWorldSave()
	if uo.Count('0x0F7B','0x000','backpack')<15 then
		uo.findtype('0x0F7B','0x000','0x4036EC62') ;Blood Moss
		if uo.findcount() then
			uo.grab('20','finditem')
			wait(1000)
		end if
	end if
	CheckWorldSave()
	if uo.Count('0x0F86','0x000','backpack')<15 then
		uo.findtype('0x0F86','0x000','0x4036EC62') ;Mandrake Roots
		if uo.findcount() then
			uo.grab('20','finditem')
			wait(1000)
		end if
	end if
	CheckWorldSave()
	if uo.Count('0x0E21','0x000','backpack')<30 then
		uo.findtype('0x0E21','0x000','0x4036EC62') ;Bandage
		if uo.findcount() then
			uo.grab('50','finditem')
			wait(1000)
		end if
	end if
	CheckWorldSave()
	uo.exec("recall Runebook 33")
	wait(9000)
	poly1()
	bandage()
	CheckWorldSave()
	uo.exec('exec healandhide')
	uo.press(36)
	wait(400)
	uo.press(36)
	wait(400)
	uo.press(36)
	wait(400)
	uo.press(36)
	wait(400)
	uo.press(36)
	wait(400)
	uo.press(36)
	wait(400)
	uo.press(36)
	Walker(5786, 1420, 0)
	Walker(5792, 1426, 0)
	Walker(5792, 1491, 0)
	Walker(5802, 1501, 0)
	Walker(5824, 1501, 0)
	Walker(5835, 1490, 0)
	Walker(5835, 1484, 0)
	Walker(5863, 1484, 0)
	Walker(5863, 1417, 0)
	Walker(5856, 1427, 0)
	uo.exec('terminate healandhide')
	uo.opendoor()
	wait(300)
	Walker(5851, 1427, 0)
	wait(300)
	if UO.GetX() == 5851 then
		uo.opendoor()
	end if
	repeat
		if UO.Life < 1 then
			Ress()
		endif
		uo.opendoor()
		wait(300)
		Walker(5851, 1427, 0)
		wait(300)
	until UO.GetX() == 5851 or uo.dead()
end sub
sub sbros1()
	uo.exec('terminate main')
	wait(1000)
	repeat
		if UO.Life < 1 then
			Ress()
		endif
		CheckWorldSave()
		uo.warmode (0)
		uo.useskill ("Hiding")
		uo.exec("recall Runebook 21")
		wait(9000)
		repeat
			if UO.Life < 1 then
				Ress()
			endif
			wait(100)
		until UO.GetX() == 4093 or uo.injournal('fizzles') or uo.dead()
	until UO.GetX() == 4093 or uo.dead()
	CheckWorldSave()
	uo.useobject('0x4036EC62')
	wait(500)
	CheckWorldSave()
	uo.useobject('backpack')
	wait(500)
	VAR a,Exit
	VAR UnloadCont='0x4036EC62'
	DIM Ore[2]
	mobloot[0]='0x0EED'         # GP
	mobloot[1]='0x0F78'         # Batwings
	mobloot[2]='0x0F0F'         # Emerald
	mobloot[3]='0x0F11'         # Sapphire
	mobloot[4]='0x0F12'         # Sapphire 2
	mobloot[5]='0x0F13'         # Ruby
	mobloot[6]='0x0F14'         # Ruby 2
	mobloot[7]='0x0F15'         # Citrine
	mobloot[8]='0x0F16'         # Amethyst
	mobloot[9]='0x0F17'         # Amethyst2
	mobloot[10]='0x0F18'        #  Tourmaline
	mobloot[11]='0x0F19'        #  Sapphire 3
	mobloot[12]='0x0F1A'        #  Ruby 3
	mobloot[13]='0x0F1B'        #  Star Sapphire 2
	mobloot[14]='0x0F1C'        #  Ruby 4
	mobloot[15]='0x0F1D'        #  Ruby 5
	mobloot[16]='0x0F1E'        #  Tourmaline 2
	mobloot[17]='0x0F1F'        #  Sapphire 4
	mobloot[18]='0x0F20'        #  Tourmaline 3
	mobloot[19]='0x0F21'        #  Star Sapphire 3
	mobloot[20]='0x0F22'        # Amethyst 3
	mobloot[21]='0x0F23'        #  Citrine 2
	mobloot[22]='0x0F24'        #  Citrine 3
	mobloot[23]='0x0F25'        #  Piece of Amber
	mobloot[24]='0x0F26'        #  Diamond
	mobloot[25]='0x0F27'        #  Diamond 2
	mobloot[26]='0x0F28'        #  Diamond 3
	UO.SetReceivingContainer(UnloadCont)
	wait(500)
	For a=0 to 1
		Exit=0
		repeat
			UO.FindType(Ore[a])
			if UO.GetQuantity('finditem')>0 then
				UO.Grab('0','finditem')
				wait(500)
			Else
				Exit=1
			endif
		until Exit==1
	Next
	UO.UnSetReceivingContainer()
	wait(150000)
	CheckWorldSave()
	if uo.Count('0x13FA',0x0000,'my')<1 then
		uo.findtype('0x13FA',0x0000,'0x4036EC62') ;Axe
		if uo.findcount() then
			uo.grab('1','finditem')
			wait(1000)
		end if
	end if
	CheckWorldSave()
	uo.findtype('0x09BB',-1,'0x4036EC62') ;Food
	if uo.findcount() then
		uo.grab('1','finditem')
		wait(1000)
		uo.useobject('finditem')
	end if
	;CheckWorldSave()
	;if uo.Count('0x0F0E','0x0631','backpack')<1 then
	;uo.findtype('0x0F0E','0x0631','0x401611C2') ;Invis
	;if uo.findcount() then
	;uo.grab('3','finditem')
	;wait(1000)
	;end if
	;end if
	;CheckWorldSave()
	;if uo.Count('0x0F0E','0x09DF','backpack')<1 then
	;uo.findtype('0x0F0E','0x09DF','0x401611C2') ;Total
	;if uo.findcount() then
	;uo.grab('3','finditem')
	;wait(1000)
	;end if
	;end if
	CheckWorldSave()
	if uo.Count('0x0F8D','0x000','backpack')<15 then
		uo.findtype('0x0F8D','0x000','0x4036EC62') ;Spider Silk
		if uo.findcount() then
			uo.grab('20','finditem')
			wait(1000)
		end if
	end if
	CheckWorldSave()
	if uo.Count('0x0F7B','0x000','backpack')<15 then
		uo.findtype('0x0F7B','0x000','0x4036EC62') ;Blood Moss
		if uo.findcount() then
			uo.grab('20','finditem')
			wait(1000)
		end if
	end if
	CheckWorldSave()
	if uo.Count('0x0F86','0x000','backpack')<15 then
		uo.findtype('0x0F86','0x000','0x4036EC62') ;Mandrake Roots
		if uo.findcount() then
			uo.grab('20','finditem')
			wait(1000)
		end if
	end if
	CheckWorldSave()
	if uo.Count('0x0E21','0x000','backpack')<30 then
		uo.findtype('0x0E21','0x000','0x4036EC62') ;Bandage
		if uo.findcount() then
			uo.grab('50','finditem')
			wait(1000)
		end if
	end if
	CheckWorldSave()
	uo.exec("recall Runebook 33")
	wait(9000)
	poly1()
	bandage()
	CheckWorldSave()
	uo.exec('exec healandhide')
	uo.press(36)
	wait(400)
	uo.press(36)
	wait(400)
	uo.press(36)
	wait(400)
	uo.press(36)
	wait(400)
	uo.press(36)
	wait(400)
	uo.press(36)
	wait(400)
	uo.press(36)
	Walker(5786, 1420, 0)
	Walker(5792, 1426, 0)
	Walker(5792, 1491, 0)
	Walker(5802, 1501, 0)
	Walker(5824, 1501, 0)
	Walker(5835, 1490, 0)
	Walker(5835, 1484, 0)
	Walker(5863, 1484, 0)
	Walker(5863, 1417, 0)
	Walker(5856, 1427, 0)
	uo.exec('terminate healandhide')
	uo.opendoor()
	wait(300)
	Walker(5851, 1427, 0)
	wait(300)
	if UO.GetX() == 5851 then
		uo.opendoor()
	end if
	repeat
		if UO.Life < 1 then
			Ress()
		endif
		uo.opendoor()
		wait(300)
		Walker(5851, 1427, 0)
		wait(300)
	until UO.GetX() == 5851 or uo.dead()
	uo.exec('exec main')
end sub
sub healandhide()
	while not uo.dead()
		uo.findtype('0x0E21','0x000','backpack')
		if uo.findcount() and uo.life < uo.str then
			if not uo.hidden() then 
				uo.warmode (0) 
				uo.useskill ('Hiding')
			endif
			uo.exec('bandageself')
			wait(3300)
			if uo.Count('0x0E21')<10 then
				uo.Exec("waittargettype 0x1008")
				uo.Exec("usetype 0x0E20")
				wait(500)
			endif
		endif
	wend
end sub
sub hide()
	if not uo.hidden() then
		uo.warmode(0)
		uo.useskill('Hiding')
	end if
end sub
sub manach()
	if uo.mana < 24 then
		uo.count ('0x0F0E','0x09DF')
		if uo.findcount()>0 then
			uo.useobject ('finditem')
		endif
	endif
end sub
sub Ress()
	var OldX, OldY
	while uo.dead()
		OldX=uo.GetX()
		OldY=uo.GetY()
		uo.warmode (0)
		uo.Exec('terminate main') 
		wait(3000)
		uo.TextOpen()
		uo.TextPrint('- deadbatwings - @ '+MakeTime())
		wait(3000)
		repeat
			Alert()
			CheckWorldSave()
			uo.lclick(980, 51)
			wait(1000)
			CheckWorldSave()
			uo.lclick(264,306)
			wait(1000)
			CheckWorldSave()
			uo.lclick(333,233)
			wait(4000)
			CheckWorldSave()
		until UO.GetX() == 2706 and UO.GetY() == 2163  
		Walker(2733, 2163, 0) 
		Walker(2733, 2160, 0) 
		wait(1000)
		CheckWorldSave()
		uo.findtype('0x0004',-1,'ground')
		repeat
			uo.useobject('finditem')
			wait(5000)
		until not uo.dead()
		wait(10000)
		CheckWorldSave()
		uo.exec("recall Runebook 21")
		wait(9000)
		uo.useobject('0x4036EC62')
		wait(500)
		uo.useobject('backpack')
		wait(500)
		CheckWorldSave()
		if uo.Count('0x13FA',0x0000,'my')<1 then
			uo.findtype('0x13FA',0x0000,'0x4036EC62') ;Axe
			if uo.findcount() then
				uo.grab('1','finditem')
				wait(1000)
			end if
		end if
		CheckWorldSave()
		uo.findtype('0x09BB',-1,'0x4036EC62') ;Food
		if uo.findcount() then
			uo.grab('1','finditem')
			wait(1000)
			uo.useobject('finditem')
		end if
		;CheckWorldSave()
		;if uo.Count('0x0F0E','0x0631','backpack')<1 then
		;uo.findtype('0x0F0E','0x0631','0x401611C2') ;Invis
		;if uo.findcount() then
		;uo.grab('3','finditem')
		;wait(1000)
		;end if
		;end if
		;CheckWorldSave()
		;if uo.Count('0x0F0E','0x09DF','backpack')<1 then
		;uo.findtype('0x0F0E','0x09DF','0x401611C2') ;Total
		;if uo.findcount() then
		;uo.grab('3','finditem')
		;wait(1000)
		;end if
		;end if
		CheckWorldSave()
		if uo.Count('0x0F8D','0x000','backpack')<10 then
			uo.findtype('0x0F8D','0x000','0x4036EC62') ;Spider Silk
			if uo.findcount() then
				uo.grab('15','finditem')
				wait(1000)
			end if
		end if
		CheckWorldSave()
		if uo.Count('0x0F7B','0x000','backpack')<10 then
			uo.findtype('0x0F7B','0x000','0x4036EC62') ;Blood Moss
			if uo.findcount() then
				uo.grab('15','finditem')
				wait(1000)
			end if
		end if
		CheckWorldSave()
		if uo.Count('0x0F86','0x000','backpack')<10 then
			uo.findtype('0x0F86','0x000','0x4036EC62') ;Mandrake Roots
			if uo.findcount() then
				uo.grab('15','finditem')
				wait(1000)
			end if
		end if
		CheckWorldSave()
		if uo.Count('0x0E21','0x000','backpack')<15 then
			uo.findtype('0x0E21','0x000','0x4036EC62') ;Bandage
			if uo.findcount() then
				uo.grab('30','finditem')
				wait(10000)
			end if
		end if
		CheckWorldSave()
		uo.exec("recall Runebook 33")
		wait(9000)
		poly1()
		bandage()
		CheckWorldSave()
		uo.exec('exec healandhide')
		uo.press(36)
		wait(400)
		uo.press(36)
		wait(400)
		uo.press(36)
		wait(400)
		uo.press(36)
		wait(400)
		uo.press(36)
		wait(400)
		uo.press(36)
		wait(400)
		uo.press(36)
		Walker(5786, 1420, 0)
		Walker(5792, 1426, 0)
		Walker(5792, 1491, 0)
		Walker(5802, 1501, 0)
		Walker(5824, 1501, 0)
		Walker(5835, 1490, 0)
		Walker(5835, 1484, 0)
		Walker(5863, 1484, 0)
		Walker(5863, 1417, 0)
		Walker(5856, 1427, 0)
		uo.exec('terminate healandhide')
		uo.opendoor()
		wait(300)
		Walker(5851, 1427, 0)
		wait(300)
		if UO.GetX() == 5851 then
			uo.opendoor()
		end if
		repeat
			if UO.Life < 1 then
				Ress()
			endif
			uo.opendoor()
			wait(300)
			Walker(5851, 1427, 0)
			wait(300)
		until UO.GetX() == 5851 or uo.dead()
		uo.exec('exec main')
	wend
end sub
sub Alert()
	uo.playwav("C:\UO\music\combat3")
	wait(500)
	uo.playwav("C:\UO\music\combat3")
	wait(500)
	uo.playwav("C:\UO\music\combat3")
	wait(500)
	uo.playwav("C:\UO\music\combat3")
	wait(500)
	uo.playwav("C:\UO\music\combat3")
	wait(500)
end sub
sub Skvoz_chara()
	If UO.GetGlobal('GMstepCheck')=='on' Then
		UO.SetGlobal('GMstepCheck','off')
		UO.Print("GM Step: Off")
		UO.Morph('0')
	Else
		UO.SetGlobal('GMstepCheck','on')
		UO.Print("GM Step: On")
		UO.Morph('0x03DB');  0x03DB
	End If
end sub
Sub CheckWorldSave()
	if uo.injournal('World is saving') then
		repeat
			wait(500)
		until uo.injournal('data saved')
	endif
end sub
sub checkplayer()
	var player 
	uo.Set('finddistance','7') 
	var i 
	DIM people[2] 
	people[0]='0x0190' ; Male
	people[1]='0x0191' ; Female
	uo.Ignore('self')    
	for i = 0 to 1 
		uo.FindType(people[i],'-1','ground') 
		player = uo.GetSerial('finditem') 
		wait(500) 
		if uo.FindCount() then 
			uo.msg('\w Karakyt:Fire Dungeon - Someone are coming!!!')
			rhome() 
		else 
		end if 
	next 
	uo.IgnoreReset() 
end sub
sub Reconnector()
	var ReconnectTime, RFlag
	ReconnectTime = '0'
	RFlag = 1
	Repeat
		Check()
		While (uo.ObjAtLayer('Bpack') == '')
			if RFlag Then
				ReconnectTime = MakeTime()
				RFlag = 0
			endif
			Wait(100000) # WorldSave Protection
			uo.Say('')
			Wait(5000)
			uo.Say('')
			Wait(5000)
			uo.Say('')
			Wait(5000)
			uo.LDblClick(357,164)
			uo.LClick(616,459)
			Wait(5000)
		Wend
		Wait(3000)
		if (RFlag == 0) and (ReconnectTime <> '0') Then
			uo.TextOpen()
			uo.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
			uo.useobject('self')
			wait(1000)
			uo.useobject('backpack')
			wait(1000)
			RFlag = 1
			ReconnectTime = '0'
			wait(1000)
			sbros1()
		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 CheckLag()
	UO.DeleteJournal()
	UO.Click('backpack')
	Repeat
		Wait(100)
	Until UO.InJournal("backpack")
end sub
sub Check()
	if UO.Life < 1 then
		Ress()
	endif
	if uo.injournal('FLY HOME FLY') then
		sbros1()
	end if
	if uo.injournal('Your large battle axe is destroyed') then
		sbros1()
	end if
end sub
########################################## ХОДИЛКА 3 ########################## 
#var Prec=0 # Как близко следует подойти к цели (Precision) 
#var MaxTraceDistance=15 # Максимальная длина обхода. Желательно ставить с расчета возможных препятсвий. Если ставить очень #большие числа, кодилка может пойти в обход пол мира чтобы дойти к соседнему дереву. 
#var Speed=2 # Длина шага. Сколько шагов делать за раз. Выше 3 ставить смысла нет. Тоесть тупое умножение шагов. Для ламбера #идеально 3, для майнинга - 1. 
#var StepTimeOut=400 # Если уперлись в неопознанный обьект, сколько мсек ждать сдвига с места. Если по простому - таймаут #шага. Если поставить сильно маленькие, ходилка начнет трассировать пустые места. 
#UO.SetGlobal("Logging","1")  # - показывать отладочные сообщения. 
#UO.SetGlobal("BlindWalk","0") # - не использовать проверку тайлов, а использовать ходьбу наощупь. Для майнинга ОБЯЗАТЕЛЬНО #ВКЛЮЧИТЬ. 
#В функции IsPass, содержиться список проходимых тайлов. 
#Walker(X,Y,Prec) - идем к цели с координатами X,Y. Возвращает 1 в случае успешного достижения цели, и 0 - при невозможном обходе (путь не найден) 
#Tracer(StartDir,Direction) - трассировка 1 шага. Возвращает направление по которому получилось сдвинуться с места. StartDir #- направление последнего движения, Direction (-1 или +1) направление обхода. -1 - по часовой стрелке, +1 против часовой #стрелки. Направления скрипт использует личного формата: 
#1 - влево вниз 
#2 - вниз 
#3 - вправо вниз 
#4 - вправо 
#5 - вправо вверх 
#6 - вверх 
#7 - влево вверх 
#8 - влево 
#Tracer(StartDir,Direction) - идеально подходит для рыбалки вдоль берега так как она будет обходить берег бесконечно (1 #запуск функции = 1 шаг обхода). 
##################################################### 
# WW  W  WW   AA    LL     Kk KK  EE  EE  RRR       # 
# WW  W  WW  AA A   LL     Kk K   EEE     R  R      # 
# WW  W  WW  AA A   LL     KKK    EEEEE   R R       # 
# WW WW  WW  AAAA   LL     KKK    EEE     RRR       # 
#  WWW WWW  AA   A   LLLL  KK Kk  EE  EE  R  RR     # 
#################################################### 
var MaxTraceDistance=3 
var TraceLoopIncrease=3 #Увеличение MaxTraceDistance при исчерпании количества ходов 
var LimitTrace=50 #Сколько шагов в ОБЕ стороны от начальной точки обхода прекращают ходилку (выхода нет). 
var Speed=1 
var StepTimeOut=400 #Таймаут шага. Устанавливать не в размер пинга, а в размер шага + размер пинга. 
# Для ходьбы - 500+Ping 
# Для бега/ходьбы на лошади - 300+Ping 
# Бег на лошади - 150 + Ping 
var CheckCnt=2 #Количество слепых проверок. УВЕЛИЧИВАЕТ В СТОЛЬКО РАЗ ТАЙМАУТ. Использовать только на БЫСТРОМ но НЕСТАБИЛЬНОМ коннекте. При большом пинге будет УЖАС. 
var DynamicPause=300 #Минимальные паузы в циклах. Чем меньше число - тем меньше рывков и тем больше нагрузка процессора. 
Sub Walker(GoX,GoY,Prec) 
	UO.SetGlobal("Logging","0") 
	UO.SetGlobal("BlindWalk","0") 
	var LastDir 
	var MoveRes 
	var TracerCnt 
	UO.SetGlobal("GlobalGoX",str(GoX)) 
	UO.SetGlobal("GlobalGoY",str(GoY)) 
	k = 0
	while not IsEnd(GoX,GoY,Prec) OR k < 2
		TracerCnt = MaxTraceDistance 
		repeat 
			LogInfo('Just walking') 
			LastDir=GoUntilHit(GoX,GoY,Prec) 
			if IsEnd(GoX,GoY,Prec) then 
				return 1 
			end if 
			if k == 2 then 
				return 1 
			end if 
			LogInfo('Tracing') 
			MoveRes = FullAroundTrace(LastDir,GoX,GoY,Prec,TracerCnt) 
			if TracerCnt > LimitTrace then 
				return 0 
			endif 
			TracerCnt = TracerCnt + TraceLoopIncrease 
			k = k+1
		until MoveRes == 1
	wend 
	return 1 
end sub 
Sub FullAroundTrace(StartDir,GoX,GoY,Prec,MaxTrace) 
	var LineX=UO.GetX() 
	var LineY=UO.GetY() 
	var CurDir=StartDir 
	var Direction=CountDirection(GoX,GoY,CurDir,Prec) 
	var StartX,StartY 
	var MovesDone=0 
	repeat 
		StartX=UO.GetX() 
		StartY=UO.GetY() 
		CurDir=Tracer(CurDir,Direction,Prec) 
		if (CurDir==GetDir(GoX,GoY,Prec)) then 
			return 1 
		endif 
		if MovesDone>0 and PrevMoveCross(GetDirToDir(UO.GetDir(),Prec),LineX,LineY,GoX,GoY,StartX,StartY,Prec) then 
			return 1 
		end if 
		MovesDone=MovesDone+1 
		CurDir=AddToDir(CurDir,-Direction,Prec) 
	until MovesDone>MaxTrace 
	return 0 
end sub 
Sub CountDirection(GoX,GoY,StartDir,Prec) 
	var GoDir=GetDir(GoX,GoY,Prec) 
	var MyX=UO.GetX() 
	var MyY=UO.GetY() 
	if GoDir<StartDir then 
		return -1 
	end if 
	if GoDir>StartDir then 
		return 1 
	end if 
	if Abs(MyX-GoX)>Abs(MyY-GoY) then 
		if (GoDir==3 and GoY>MyY) OR (GoDir==7 and GoY<MyY) then 
			return -1 
		else 
			return 1 
		end if 
	else 
		if (GoDir==1 and GoX<MyX) or (GoDir==5 and GoX>MyX) then 
			return -1 
		else 
			return 1 
		end if 
	end if 
end sub 
Sub PrevMoveCross(Dir,x1,y1,x2,y2,StartX,StartY,Prec) 
	var x3,y3,x4,y4 
	x3=StartX 
	y3=StartY 
	x4=StartX+(XFromDir(Dir)-StartX)*Speed 
	y4=StartY+(YFromDir(Dir)-StartY)*Speed 
	return LinesCrossing(x1,y1,x2,y2,x3,y3,x4,y4,Prec) 
end sub 
Sub LinesCrossing(x1,y1,x2,y2,x3,y3,x4,y4,Prec) 
	if x1==x3 and y1==y3 then 
		return false 
	end if 
	var z1=(x3-x1)*(y2-y1)-(y3-y1)*(x2-x1) 
	var z2=(x4-x1)*(y2-y1)-(y4-y1)*(x2-x1) 
	if z1*z2>0 then 
		return false 
	else 
		LogInfo('Vector info:') 
		LogInfo('x1= '+str(x1)) 
		LogInfo('y1= '+str(y1)) 
		LogInfo('x2= '+str(x2)) 
		LogInfo('y2= '+str(y2)) 
		LogInfo('x3= '+str(x3)) 
		LogInfo('y3= '+str(y3)) 
		LogInfo('x4= '+str(x4)) 
		LogInfo('y4= '+str(y4)) 
		return true 
	end if 
end sub 
Sub IsDiap(X,X0,X1,Prec) 
	if X<=X0+Prec and X>=X1-Prec OR X>=X0-Prec and X<=X1+Prec then 
		return true 
	end if 
	return false 
end sub 
Sub GoUntilHit(GoX,GoY,Prec) 
	var LastDir 
	LastDir=GetDir(GoX,GoY,Prec) 
	var CouldMove 
	repeat 
		LastDir=GetDir(GoX,GoY,Prec) 
		if LastDir<>0 and not IsEnd(GoX,GoY,Prec) then 
			CouldMove=TryDir(LastDir,Prec) 
		end if 
	until LastDir==0 or IsEnd(GoX,GoY,Prec) or not CouldMove 
	return LastDir 
end sub 
Sub IsEnd(GoX,GoY,Prec) 
	if Abs(UO.GetX()-GoX)<=Prec and Abs(UO.GetY()-GoY)<=Prec then 
		LogInfo('END FOUND') 
		return true 
	else 
		return false 
	end if 
end sub 
Sub GetDir(GoX,GoY,Prec) 
	var MyX=UO.GetX() 
	var MyY=UO.GetY() 
	var DiffX=Abs(UO.GetX()-GoX) 
	var DiffY=Abs(UO.GetY()-GoY) 
	var GoDir=0 
	if (DiffX/(DiffY+0.1))>=2 then 
		if (MyX>GoX) then 
			GoDir=7 
		else 
			GoDir=3 
		end if 
	else 
		if (DiffY/(DiffX+0.1))>=2 then 
			if (MyY>GoY) then 
				GoDir=5 
			else 
				GoDir=1 
			end if 
		else 
			if (MyX>GoX) and (MyY>GoY) then 
				GoDir=6 
			else 
				if (MyX>GoX) and (MyY<GoY) then 
					GoDir=8 
				else 
					if (MyX<GoX) and (MyY>GoY) then 
						GoDir=4 
					else 
						if (MyX<GoX) and (MyY<GoY) then 
							GoDir=2 
						end if 
					end if 
				end if 
			end if 
		end if 
	end if 
	return GoDir 
end sub 
Sub Tracer(StartDir,Direction,Prec) 
	var CurDir=StartDir 
	var Result 
	repeat 
		Result=TryDir(CurDir,Prec) 
		if not Result then 
			CurDir=AddToDir(CurDir,Direction,Prec) 
		end if 
	until Result 
	return Result 
end sub 
Sub AddToDir(Dir,Cnt,Prec) 
	var NewDir=Dir 
	NewDir=NewDir+Cnt 
	while NewDir>8 
		NewDir=NewDir-8 
	wend 
	while NewDir<1 
		NewDir=NewDir+8 
	wend 
	return NewDir 
end sub 
Sub TryDir(Dir,Prec) 
	var BegX=UO.GetX() # Ia?aeuiia O 
	var BegY=UO.GetY() # Ia?aeuiia Y 
	var Counter=0 
	var GoX=BegX 
	var GoY=BegY 
	GoX=XFromDir(Dir) 
	GoY=YFromDir(Dir) 
	if not IsPass(GoX,GoY) then 
		LogInfo(str(GoX)+':'+str(GoY)+' is not passable') 
		return false 
	end if 
	return TurnAndGoDir(Dir,Prec) 
end sub 
Sub XFromDir(Dir) 
	if Dir==2 OR Dir==3 Or Dir==4 then 
		return (UO.GetX()+1) 
	end if 
	if Dir==6 OR Dir==7 Or Dir==8 then 
		return (UO.GetX()-1) 
	end if 
	return (UO.GetX()) 
end sub 
Sub YFromDir(Dir) 
	if Dir==8 OR Dir==1 Or Dir==2 then 
		return (UO.GetY()+1) 
	end if 
	if Dir==4 OR Dir==5 Or Dir==6 then 
		return (UO.GetY()-1) 
	end if 
	return (UO.GetY()) 
end sub 
Sub TurnAndGoDir(Dir,Prec) 
	var StartDir=GetDirToDir(UO.GetDir(),Prec) 
	var StartX=UO.GetX() 
	var StartY=UO.GetY() 
	var EndDir 
	var Counter=0 
	var TestCounter=CheckCnt 
	#Direction Test 
	repeat 
		Counter = 0 
		LogInfo('Dir: '+str(StartDir)+' Counter: '+str(Counter))  
		PressDir(Dir) 
		repeat 
			EndDir=GetDirToDir(UO.GetDir(),Prec) 
			wait(DynamicPause) 
			Counter=Counter+1 
		until StartDir<>EndDir or StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=StepTimeOut/DynamicPause 
		TestCounter = TestCounter - 1 
		LogInfo('Dir: '+str(EndDir)+' Counter: '+str(Counter))  
	until TestCounter <= 0 or Counter < StepTimeOut/DynamicPause 
	if Counter>=StepTimeOut/DynamicPause  then 
		LogInfo('Direction timeout reached') 
		return 0 
	end if 
	#End direction Test 
	if StartY<>UO.GetY() or StartX<>UO.GetX() then 
		return Dir 
	end if 
	#Start Primary test 
	TestCounter=CheckCnt 
	repeat 
		GoDir(Dir,Prec) 
		Counter=0 
		repeat 
			wait(DynamicPause) 
			Counter=Counter+1 
		until StartY<>UO.GetY() or StartX<>UO.GetX() or Counter>=StepTimeOut/DynamicPause 
		TestCounter = TestCounter - 1 
	until TestCounter <= 0 or Counter < StepTimeOut/DynamicPause 
	#End primary test 
	if Counter>=StepTimeOut/DynamicPause then 
		LogInfo('Step timeout reached') 
		return 0 
	else 
		return Dir 
	end if 
end sub 
Sub GetDirToDir(GotDir,Prec) 
	var ChangedDir=-GotDir 
	ChangedDir=AddToDir(ChangedDir,5,Prec) 
	return ChangedDir 
end sub 
Sub DirToInj(Dir) 
	dim Dirs[9] 
	Dirs[1]=1 
	Dirs[2]=2 
	Dirs[3]=3 
	Dirs[4]=6 
	Dirs[5]=9 
	Dirs[6]=8 
	Dirs[7]=7 
	Dirs[8]=4 
	return (Dirs[Dir]) 
end sub 
Sub PressDir(Dir) 
	dim Dirs[9] 
	Dirs[1]=35 
	Dirs[2]=40 
	Dirs[3]=34 
	Dirs[4]=39 
	Dirs[5]=33 
	Dirs[6]=38 
	Dirs[7]=36 
	Dirs[8]=37 
	UO.Press(Dirs[Dir],1) 
end sub 
Sub GoDir(Dir,Prec) 
	dim Dirs[9] 
	Dirs[1]=35 
	Dirs[2]=40 
	Dirs[3]=34 
	Dirs[4]=39 
	Dirs[5]=33 
	Dirs[6]=38 
	Dirs[7]=36 
	Dirs[8]=37 
	var DistanceX=Abs(UO.GetX()-val(UO.GetGlobal("GlobalGoX"))) 
	var DistanceY=Abs(UO.GetY()-val(UO.GetGlobal("GlobalGoY"))) 
	var GoDistance 
	if (DistanceX-Prec)<Speed then 
		GoDistance=DistanceX-Prec 
	else 
		if (DistanceY-Prec)<Speed then 
			GoDistance=DistanceY-Prec 
		else 
			GoDistance=Speed 
		endif 
	endif 
	UO.Press(Dirs[Dir],GoDistance) 
end sub 
Sub IsPass(X,Y) 
	if UO.GetGlobal("BlindWalk") then 
		return true 
	endif 
	dim Types[60] 
	Types[1]=3 
	Types[2]=25 
	Types[3]=51 
	Types[4]=63 
	Types[5]=113 
	Types[6]=140 
	Types[7]=172 
	Types[8]=219 
	Types[9]=232 
	Types[10]=235 
	Types[11]=239 
	Types[12]=243 
	Types[13]=248 
	Types[14]=251 
	Types[15]=264 
	Types[16]=267 
	Types[17]=282 
	Types[18]=289 
	Types[19]=321 
	Types[20]=379 
	Types[21]=420 
	Types[22]=440 
	Types[23]=476 
	Types[24]=499 
	Types[25]=513 
	Types[26]=542 
	Types[27]=578 
	Types[28]=586 
	Types[29]=622 
	Types[30]=700 
	Types[31]=804 
	Types[32]=1740 
	Types[33]=1758 
	Types[34]=1770 
	Types[35]=1779 
	Types[36]=1779 
	Types[37]=1881 
	Types[38]=1886 
	Types[39]=1801 
	Types[40]=1805 
	Types[41]=1813 
	Types[42]=1820 
	Types[43]=1831 
	Types[44]=1833 
	Types[45]=1843 
	Types[46]=1850 
	Types[47]=1873 
	Types[48]=1876 
	Types[49]=1885 
	Types[50]=1888 
	Types[51]=1946 
	Types[52]=1969 
	Types[53]=2500 
	Types[54]=2539 
	for var i=1 TO 53 STEP 2 
		if UO.PrivateGetTile(X,Y,-1,Types[i],Types[i+1]) then 
			return true 
		end if 
	next 
	return false 
end sub 
Sub LogInfo(Line) 
	if not UO.GetGlobal("Logging")=="0" then 
		UO.TextOpen() 
		UO.TextPrint(str(UO.GetX())+":"+str(UO.GetY())+" - "+Line); 
	end if 
end sub 
Sub Abs(X) 
	if X>0 then 
		return X 
	else 
		return (-X) 
	end if 
end sub 
########################################## КОНЕЦ ХОДИЛКИ 3 #############
тесть.

Re: Помогите со скриптом

Posted: 2013-02-21 09:38:18
by Lucky87
Ошибка , убил гаргулю , отрыл труп и выбило ошибку, как и в прошлые разы

Re: Помогите со скриптом

Posted: 2013-02-21 17:48:37
by ZeroDX
массив объявляется под именем ore, а элементы уже под другим именем. +надо колво элесментов подправить и в цикле тоже

Re: Помогите со скриптом

Posted: 2013-03-15 09:17:57
by Lucky87
ZeroDX wrote:массив объявляется под именем ore, а элементы уже под другим именем. +надо колво элесментов подправить и в цикле тоже
а как это реализовать . ? можите помоч?

Re: Помогите со скриптом

Posted: 2013-03-24 22:54:43
by tylllkah
Lucky87 wrote:
ZeroDX wrote:массив объявляется под именем ore, а элементы уже под другим именем. +надо колво элесментов подправить и в цикле тоже
а как это реализовать . ? можите помоч?
пробуй

Code: Select all

VAR monst= '0x0004'
VAR k, j

sub main()
    uo.exec('terminate Reconnector')
    wait(3000)
    uo.exec('exec Reconnector')
    UO.AddObject("Runebook",'0x404E9CCA')
    while not uo.dead()
        UO.Set('finddistance','7')
        UO.FindType('0x0004', '-1', 'ground')
        if UO.FindCount() > 0 then
            UO.UseType('0x13FA','0x0000')
            UO.Warmode(1)
            UO.Attack('finditem')
            repeat
                uo.attack('lastattack')
                uo.attack('laststatus')
                if UO.LIFE<90 then
                    poly()
                end if
                Walker(UO.GetX("finditem"),UO.GetY("finditem"),1)
                wait(300)
                UO.FindType(monst, '-1', 'ground')
            until UO.FindCount() == 0
        else
            wait(100)
        end if
        Loot()
        bandage()
        poly()
        uo.findtype('0x0F78','-1','backpack')
        if uo.getquantity('finditem')>159 then
            sbros()
        end if
        wait(1000)
        hide()
    wend
end sub

sub Loot()
    var b
    dim mobloot[27]
    mobloot[0]='0x0EED'       #  GP
    mobloot[1]='0x0F78'       #  Batwings
    mobloot[2]='0x0F0F'       #  Emerald
    mobloot[3]='0x0F11'       #  Sapphire
    mobloot[4]='0x0F12'       #   Sapphire 2
    mobloot[5]='0x0F13'       # Ruby
    mobloot[6]='0x0F14'       #  Ruby 2
    mobloot[7]='0x0F15'       # Citrine
    mobloot[8]='0x0F16'       #  Amethyst
    mobloot[9]='0x0F17'       #  Amethyst2
    mobloot[10]='0x0F18'      #  Tourmaline
    mobloot[11]='0x0F19'      #  Sapphire 3
    mobloot[12]='0x0F1A'      #  Ruby 3
    mobloot[13]='0x0F1B'      #  Star Sapphire 2
    mobloot[14]='0x0F1C'      #  Ruby 4
    mobloot[15]='0x0F1D'      #  Ruby 5
    mobloot[16]='0x0F1E'      #  Tourmaline 2
    mobloot[17]='0x0F1F'      #  Sapphire 4
    mobloot[18]='0x0F20'      #  Tourmaline 3
    mobloot[19]='0x0F21'      #  Star Sapphire 3
    mobloot[20]='0x0F22'      # Amethyst 3
    mobloot[21]='0x0F23'      #  Citrine 2
    mobloot[22]='0x0F24'      #  Citrine 3
    mobloot[23]='0x0F25'      #  Piece of Amber
    mobloot[24]='0x0F26'      #  Diamond
    mobloot[25]='0x0F27'      #  Diamond 2
    mobloot[26]='0x0F28'      #  Diamond 3
    UO.UseObject('lastcorpse')
    wait (500)
    uo.waittargetobject('lastcorpse')
    If NOT UO.ObjAtLayer('Rhand') Then
        uo.useobject(uo.ObjAtLayer('Lhand'))
    else
        uo.useobject(uo.ObjAtLayer('Rhand'))
    end if
    wait(1000)
    for b=0 To 26
        uo.findtype(mobloot[b],'-1','lastcontainer')
        if uo.findcount() then
            uo.grab(0,'finditem')
            wait (875)
        endif
    next
end sub

sub poly()
    if UO.Life < 1 then
        Ress()
    endif
    uo.cancelmenu()
    uo.automenu('What do you want to polymorph int','Daemon')
    if uo.str < 300 then
        if UO.Life < 1 then
            Ress()
        endif
        uo.warmode(0)
        Walker(5854, 1427, 0)
        wait(300)
        uo.opendoor()
        wait(300)
        Walker(5856, 1427, 0)
        wait(300)
        repeat
            uo.opendoor()
            wait(300)
            Walker(5856, 1427, 0)
            wait(300)
            Walker(5856, 1426, 0)
            wait(300)
        until UO.GetX() == 5856 and UO.GetY() == 1426 or uo.dead()
        k = 1
        while k==1
            if uo.mana < 24 then
                uo.findtype ('0x0F0E','0x09DF','my')
                if uo.findcount()>0 then
                    uo.useobject ('finditem')
                endif
            endif
            UO.DeleteJournal()
            uo.cast('Polymorph')
            wait(10000)
            if uo.injournal('spell fizzles') OR uo.injournal('You lack') then
                uo.print('Try again!')
            else
                k=0
            endif
        wend
        wait(500)
        UO.Count('0x13FA','0x0000')
        UO.UseType('0x13FA','0x0000')
        uo.warmode(1)
        uo.attack('lastattack')
        Walker(5856, 1427, 0)
        uo.opendoor()
        wait(300)
        Walker(5851, 1427, 0)
        wait(300)
        if UO.GetX() == 5851 then
            uo.opendoor()
        end if
        repeat
            if UO.Life < 1 then
                Ress()
            endif
            uo.opendoor()
            wait(300)
            Walker(5851, 1427, 0)
            wait(300)
        until UO.GetX() == 5851 or uo.dead()
    endif
end sub

sub poly1()
    uo.cancelmenu()
    uo.automenu('What do you want to polymorph int','Daemon')
    if uo.str < 300 then
        k = 1
        while k==1
            if uo.mana < 24 then
                uo.findtype ('0x0F0E','0x09DF','my')
                if uo.findcount()>0 then
                    uo.useobject ('finditem')
                endif
            endif
            UO.DeleteJournal()
            uo.cast('Polymorph')
            wait(10000)
            if uo.injournal('spell fizzles') OR uo.injournal('You lack') then
                uo.print('Try again!')
            else
                k=0
            endif
        wend
        wait(500)
        UO.Count('0x13FA','0x0000')
        UO.UseType('0x13FA','0x0000')
    endif
end sub

sub bandage()
    uo.findtype('0x0E21','0x000','backpack')
    if uo.findcount() and uo.life < uo.str then
        if not uo.hidden() then
            uo.warmode (0)
            uo.useskill ('Hiding')
        endif
        uo.exec('bandageself')
        wait(3300)
        if uo.Count('0x0E21')<10 then
            uo.Exec("waittargettype 0x1008")
            uo.Exec("usetype 0x0E20")
            wait(500)
        end if
    end if
    UO.Count('0x13FA','0x0000')
    UO.UseType('0x13FA','0x0000')
end sub

sub rhome()
    repeat
        if UO.Life < 1 then
            Ress()
        endif
        CheckWorldSave()
        uo.warmode (0)
        uo.useskill ("Hiding")
        uo.exec("recall Runebook 21")
        wait(9000)
        repeat
            if UO.Life < 1 then
                Ress()
            endif
            wait(100)
        until UO.GetX() == 4093 or uo.injournal('fizzles') or uo.dead()
    until UO.GetX() == 4093 or uo.dead()
    wait(1000)
    CheckWorldSave()
    sbros()
end sub

sub sbros()
    repeat
        if UO.Life < 1 then
            Ress()
        endif
        CheckWorldSave()
        uo.warmode (0)
        uo.useskill ("Hiding")
        uo.exec("recall Runebook 21")
        wait(9000)
        repeat
            if UO.Life < 1 then
                Ress()
            endif
            wait(100)
        until UO.GetX() == 4093 or uo.injournal('fizzles') or uo.dead()
    until UO.GetX() == 4093 or uo.dead()
    CheckWorldSave()
    uo.useobject('0x4036EC62')
    wait(500)
    CheckWorldSave()
    uo.useobject('backpack')
    wait(500)
    VAR a,Exit
    VAR UnloadCont='0x4036EC62'
    DIM loot[27]
    loot[0]='0x0EED'         # GP
    loot[1]='0x0F78'         # Batwings
    loot[2]='0x0F0F'         # Emerald
    loot[3]='0x0F11'         # Sapphire
    loot[4]='0x0F12'         # Sapphire 2
    loot[5]='0x0F13'         # Ruby
    loot[6]='0x0F14'         # Ruby 2
    loot[7]='0x0F15'         # Citrine
    loot[8]='0x0F16'         # Amethyst
    loot[9]='0x0F17'         # Amethyst2
    loot[10]='0x0F18'        #  Tourmaline
    loot[11]='0x0F19'        #  Sapphire 3
    loot[12]='0x0F1A'        #  Ruby 3
    loot[13]='0x0F1B'        #  Star Sapphire 2
    loot[14]='0x0F1C'        #  Ruby 4
    loot[15]='0x0F1D'        #  Ruby 5
    loot[16]='0x0F1E'        #  Tourmaline 2
    loot[17]='0x0F1F'        #  Sapphire 4
    loot[18]='0x0F20'        #  Tourmaline 3
    loot[19]='0x0F21'        #  Star Sapphire 3
    loot[20]='0x0F22'        # Amethyst 3
    loot[21]='0x0F23'        #  Citrine 2
    loot[22]='0x0F24'        #  Citrine 3
    loot[23]='0x0F25'        #  Piece of Amber
    loot[24]='0x0F26'        #  Diamond
    loot[25]='0x0F27'        #  Diamond 2
    loot[26]='0x0F28'        #  Diamond 3
    UO.SetReceivingContainer(UnloadCont)
    wait(500)
    For a=0 to 26
        Exit=0
        repeat
            UO.FindType(loot[a])
            if UO.GetQuantity('finditem')>0 then
                UO.Grab('0','finditem')
                wait(500)
            Else
                Exit=1
            endif
        until Exit==1
    Next
    UO.UnSetReceivingContainer()
    wait(1000)
    CheckWorldSave()
    if uo.Count('0x13FA',0x0000,'my')<1 then
        uo.findtype('0x13FA',0x0000,'0x4036EC62') ;Axe
        if uo.findcount() then
            uo.grab('1','finditem')
            wait(1000)
        end if
    end if
    CheckWorldSave()
    uo.findtype('0x09BB',-1,'0x4036EC62') ;Food
    if uo.findcount() then
        uo.grab('1','finditem')
        wait(1000)
        uo.useobject('finditem')
    end if
    ;CheckWorldSave()
    ;if uo.Count('0x0F0E','0x0631','backpack')<1 then
    ;uo.findtype('0x0F0E','0x0631','0x401611C2') ;Invis
    ;if uo.findcount() then
    ;uo.grab('3','finditem')
    ;wait(1000)
    ;end if
    ;end if
    ;CheckWorldSave()
    ;if uo.Count('0x0F0E','0x09DF','backpack')<1 then
    ;uo.findtype('0x0F0E','0x09DF','0x401611C2') ;Total
    ;if uo.findcount() then
    ;uo.grab('3','finditem')
    ;wait(1000)
    ;end if
    ;end if
    CheckWorldSave()
    if uo.Count('0x0F8D','0x000','backpack')<15 then
        uo.findtype('0x0F8D','0x000','0x4036EC62') ;Spider Silk
        if uo.findcount() then
            uo.grab('20','finditem')
            wait(1000)
        end if
    end if
    CheckWorldSave()
    if uo.Count('0x0F7B','0x000','backpack')<15 then
        uo.findtype('0x0F7B','0x000','0x4036EC62') ;Blood Moss
        if uo.findcount() then
            uo.grab('20','finditem')
            wait(1000)
        end if
    end if
    CheckWorldSave()
    if uo.Count('0x0F86','0x000','backpack')<15 then
        uo.findtype('0x0F86','0x000','0x4036EC62') ;Mandrake Roots
        if uo.findcount() then
            uo.grab('20','finditem')
            wait(1000)
        end if
    end if
    CheckWorldSave()
    if uo.Count('0x0E21','0x000','backpack')<30 then
        uo.findtype('0x0E21','0x000','0x4036EC62') ;Bandage
        if uo.findcount() then
            uo.grab('50','finditem')
            wait(1000)
        end if
    end if
    CheckWorldSave()
    uo.exec("recall Runebook 33")
    wait(9000)
    poly1()
    bandage()
    CheckWorldSave()
    uo.exec('exec healandhide')
    uo.press(36)
    wait(400)
    uo.press(36)
    wait(400)
    uo.press(36)
    wait(400)
    uo.press(36)
    wait(400)
    uo.press(36)
    wait(400)
    uo.press(36)
    wait(400)
    uo.press(36)
    Walker(5786, 1420, 0)
    Walker(5792, 1426, 0)
    Walker(5792, 1491, 0)
    Walker(5802, 1501, 0)
    Walker(5824, 1501, 0)
    Walker(5835, 1490, 0)
    Walker(5835, 1484, 0)
    Walker(5863, 1484, 0)
    Walker(5863, 1417, 0)
    Walker(5856, 1427, 0)
    uo.exec('terminate healandhide')
    uo.opendoor()
    wait(300)
    Walker(5851, 1427, 0)
    wait(300)
    if UO.GetX() == 5851 then
        uo.opendoor()
    end if
    repeat
        if UO.Life < 1 then
            Ress()
        endif
        uo.opendoor()
        wait(300)
        Walker(5851, 1427, 0)
        wait(300)
    until UO.GetX() == 5851 or uo.dead()
end sub

sub sbros1()
    uo.exec('terminate main')
    wait(1000)
    repeat
        if UO.Life < 1 then
            Ress()
        endif
        CheckWorldSave()
        uo.warmode (0)
        uo.useskill ("Hiding")
        uo.exec("recall Runebook 21")
        wait(9000)
        repeat
            if UO.Life < 1 then
                Ress()
            endif
            wait(100)
        until UO.GetX() == 4093 or uo.injournal('fizzles') or uo.dead()
    until UO.GetX() == 4093 or uo.dead()
    CheckWorldSave()
    uo.useobject('0x4036EC62')
    wait(500)
    CheckWorldSave()
    uo.useobject('backpack')
    wait(500)
    VAR a,Exit
    VAR UnloadCont='0x4036EC62'
    DIM mobloot[27]
    mobloot[0]='0x0EED'         # GP
    mobloot[1]='0x0F78'         # Batwings
    mobloot[2]='0x0F0F'         # Emerald
    mobloot[3]='0x0F11'         # Sapphire
    mobloot[4]='0x0F12'         # Sapphire 2
    mobloot[5]='0x0F13'         # Ruby
    mobloot[6]='0x0F14'         # Ruby 2
    mobloot[7]='0x0F15'         # Citrine
    mobloot[8]='0x0F16'         # Amethyst
    mobloot[9]='0x0F17'         # Amethyst2
    mobloot[10]='0x0F18'        #  Tourmaline
    mobloot[11]='0x0F19'        #  Sapphire 3
    mobloot[12]='0x0F1A'        #  Ruby 3
    mobloot[13]='0x0F1B'        #  Star Sapphire 2
    mobloot[14]='0x0F1C'        #  Ruby 4
    mobloot[15]='0x0F1D'        #  Ruby 5
    mobloot[16]='0x0F1E'        #  Tourmaline 2
    mobloot[17]='0x0F1F'        #  Sapphire 4
    mobloot[18]='0x0F20'        #  Tourmaline 3
    mobloot[19]='0x0F21'        #  Star Sapphire 3
    mobloot[20]='0x0F22'        # Amethyst 3
    mobloot[21]='0x0F23'        #  Citrine 2
    mobloot[22]='0x0F24'        #  Citrine 3
    mobloot[23]='0x0F25'        #  Piece of Amber
    mobloot[24]='0x0F26'        #  Diamond
    mobloot[25]='0x0F27'        #  Diamond 2
    mobloot[26]='0x0F28'        #  Diamond 3
    UO.SetReceivingContainer(UnloadCont)
    wait(500)
    For a=0 to 26
        Exit=0
        repeat
            UO.FindType(mobloot[a])
            if UO.GetQuantity('finditem')>0 then
                UO.Grab('0','finditem')
                wait(500)
            Else
                Exit=1
            endif
        until Exit==1
    Next
    UO.UnSetReceivingContainer()
    wait(150000)
    CheckWorldSave()
    if uo.Count('0x13FA',0x0000,'my')<1 then
        uo.findtype('0x13FA',0x0000,'0x4036EC62') ;Axe
        if uo.findcount() then
            uo.grab('1','finditem')
            wait(1000)
        end if
    end if
    CheckWorldSave()
    uo.findtype('0x09BB',-1,'0x4036EC62') ;Food
    if uo.findcount() then
        uo.grab('1','finditem')
        wait(1000)
        uo.useobject('finditem')
    end if
    ;CheckWorldSave()
    ;if uo.Count('0x0F0E','0x0631','backpack')<1 then
    ;uo.findtype('0x0F0E','0x0631','0x401611C2') ;Invis
    ;if uo.findcount() then
    ;uo.grab('3','finditem')
    ;wait(1000)
    ;end if
    ;end if
    ;CheckWorldSave()
    ;if uo.Count('0x0F0E','0x09DF','backpack')<1 then
    ;uo.findtype('0x0F0E','0x09DF','0x401611C2') ;Total
    ;if uo.findcount() then
    ;uo.grab('3','finditem')
    ;wait(1000)
    ;end if
    ;end if
    CheckWorldSave()
    if uo.Count('0x0F8D','0x000','backpack')<15 then
        uo.findtype('0x0F8D','0x000','0x4036EC62') ;Spider Silk
        if uo.findcount() then
            uo.grab('20','finditem')
            wait(1000)
        end if
    end if
    CheckWorldSave()
    if uo.Count('0x0F7B','0x000','backpack')<15 then
        uo.findtype('0x0F7B','0x000','0x4036EC62') ;Blood Moss
        if uo.findcount() then
            uo.grab('20','finditem')
            wait(1000)
        end if
    end if
    CheckWorldSave()
    if uo.Count('0x0F86','0x000','backpack')<15 then
        uo.findtype('0x0F86','0x000','0x4036EC62') ;Mandrake Roots
        if uo.findcount() then
            uo.grab('20','finditem')
            wait(1000)
        end if
    end if
    CheckWorldSave()
    if uo.Count('0x0E21','0x000','backpack')<30 then
        uo.findtype('0x0E21','0x000','0x4036EC62') ;Bandage
        if uo.findcount() then
            uo.grab('50','finditem')
            wait(1000)
        end if
    end if
    CheckWorldSave()
    uo.exec("recall Runebook 33")
    wait(9000)
    poly1()
    bandage()
    CheckWorldSave()
    uo.exec('exec healandhide')
    uo.press(36)
    wait(400)
    uo.press(36)
    wait(400)
    uo.press(36)
    wait(400)
    uo.press(36)
    wait(400)
    uo.press(36)
    wait(400)
    uo.press(36)
    wait(400)
    uo.press(36)
    Walker(5786, 1420, 0)
    Walker(5792, 1426, 0)
    Walker(5792, 1491, 0)
    Walker(5802, 1501, 0)
    Walker(5824, 1501, 0)
    Walker(5835, 1490, 0)
    Walker(5835, 1484, 0)
    Walker(5863, 1484, 0)
    Walker(5863, 1417, 0)
    Walker(5856, 1427, 0)
    uo.exec('terminate healandhide')
    uo.opendoor()
    wait(300)
    Walker(5851, 1427, 0)
    wait(300)
    if UO.GetX() == 5851 then
        uo.opendoor()
    end if
    repeat
        if UO.Life < 1 then
            Ress()
        endif
        uo.opendoor()
        wait(300)
        Walker(5851, 1427, 0)
        wait(300)
    until UO.GetX() == 5851 or uo.dead()
    uo.exec('exec main')
end sub

sub healandhide()
    while not uo.dead()
        uo.findtype('0x0E21','0x000','backpack')
        if uo.findcount() and uo.life < uo.str then
            if not uo.hidden() then
                uo.warmode (0)
                uo.useskill ('Hiding')
            endif
            uo.exec('bandageself')
            wait(3300)
            if uo.Count('0x0E21')<10 then
                uo.Exec("waittargettype 0x1008")
                uo.Exec("usetype 0x0E20")
                wait(500)
            endif
        endif
    wend
end sub

sub hide()
    if not uo.hidden() then
        uo.warmode(0)
        uo.useskill('Hiding')
    end if
end sub

sub manach()
    if uo.mana < 24 then
        uo.count ('0x0F0E','0x09DF')
        if uo.findcount()>0 then
            uo.useobject ('finditem')
        endif
    endif
end sub

sub Ress()
    var OldX, OldY
    while uo.dead()
        OldX=uo.GetX()
        OldY=uo.GetY()
        uo.warmode (0)
        uo.Exec('terminate main')
        wait(3000)
        uo.TextOpen()
        uo.TextPrint('- deadbatwings - @ '+MakeTime())
        wait(3000)
        repeat
            Alert()
            CheckWorldSave()
            uo.lclick(980, 51)
            wait(1000)
            CheckWorldSave()
            uo.lclick(264,306)
            wait(1000)
            CheckWorldSave()
            uo.lclick(333,233)
            wait(4000)
            CheckWorldSave()
        until UO.GetX() == 2706 and UO.GetY() == 2163
        Walker(2733, 2163, 0)
        Walker(2733, 2160, 0)
        wait(1000)
        CheckWorldSave()
        uo.findtype('0x0004',-1,'ground')
        repeat
            uo.useobject('finditem')
            wait(5000)
        until not uo.dead()
        wait(10000)
        CheckWorldSave()
        uo.exec("recall Runebook 21")
        wait(9000)
        uo.useobject('0x4036EC62')
        wait(500)
        uo.useobject('backpack')
        wait(500)
        CheckWorldSave()
        if uo.Count('0x13FA',0x0000,'my')<1 then
            uo.findtype('0x13FA',0x0000,'0x4036EC62') ;Axe
            if uo.findcount() then
                uo.grab('1','finditem')
                wait(1000)
            end if
        end if
        CheckWorldSave()
        uo.findtype('0x09BB',-1,'0x4036EC62') ;Food
        if uo.findcount() then
            uo.grab('1','finditem')
            wait(1000)
            uo.useobject('finditem')
        end if
        ;CheckWorldSave()
        ;if uo.Count('0x0F0E','0x0631','backpack')<1 then
        ;uo.findtype('0x0F0E','0x0631','0x401611C2') ;Invis
        ;if uo.findcount() then
        ;uo.grab('3','finditem')
        ;wait(1000)
        ;end if
        ;end if
        ;CheckWorldSave()
        ;if uo.Count('0x0F0E','0x09DF','backpack')<1 then
        ;uo.findtype('0x0F0E','0x09DF','0x401611C2') ;Total
        ;if uo.findcount() then
        ;uo.grab('3','finditem')
        ;wait(1000)
        ;end if
        ;end if
        CheckWorldSave()
        if uo.Count('0x0F8D','0x000','backpack')<10 then
            uo.findtype('0x0F8D','0x000','0x4036EC62') ;Spider Silk
            if uo.findcount() then
                uo.grab('15','finditem')
                wait(1000)
            end if
        end if
        CheckWorldSave()
        if uo.Count('0x0F7B','0x000','backpack')<10 then
            uo.findtype('0x0F7B','0x000','0x4036EC62') ;Blood Moss
            if uo.findcount() then
                uo.grab('15','finditem')
                wait(1000)
            end if
        end if
        CheckWorldSave()
        if uo.Count('0x0F86','0x000','backpack')<10 then
            uo.findtype('0x0F86','0x000','0x4036EC62') ;Mandrake Roots
            if uo.findcount() then
                uo.grab('15','finditem')
                wait(1000)
            end if
        end if
        CheckWorldSave()
        if uo.Count('0x0E21','0x000','backpack')<15 then
            uo.findtype('0x0E21','0x000','0x4036EC62') ;Bandage
            if uo.findcount() then
                uo.grab('30','finditem')
                wait(10000)
            end if
        end if
        CheckWorldSave()
        uo.exec("recall Runebook 33")
        wait(9000)
        poly1()
        bandage()
        CheckWorldSave()
        uo.exec('exec healandhide')
        uo.press(36)
        wait(400)
        uo.press(36)
        wait(400)
        uo.press(36)
        wait(400)
        uo.press(36)
        wait(400)
        uo.press(36)
        wait(400)
        uo.press(36)
        wait(400)
        uo.press(36)
        Walker(5786, 1420, 0)
        Walker(5792, 1426, 0)
        Walker(5792, 1491, 0)
        Walker(5802, 1501, 0)
        Walker(5824, 1501, 0)
        Walker(5835, 1490, 0)
        Walker(5835, 1484, 0)
        Walker(5863, 1484, 0)
        Walker(5863, 1417, 0)
        Walker(5856, 1427, 0)
        uo.exec('terminate healandhide')
        uo.opendoor()
        wait(300)
        Walker(5851, 1427, 0)
        wait(300)
        if UO.GetX() == 5851 then
            uo.opendoor()
        end if
        repeat
            if UO.Life < 1 then
                Ress()
            endif
            uo.opendoor()
            wait(300)
            Walker(5851, 1427, 0)
            wait(300)
        until UO.GetX() == 5851 or uo.dead()
        uo.exec('exec main')
    wend
end sub

sub Alert()
    uo.playwav("C:\UO\music\combat3")
    wait(500)
    uo.playwav("C:\UO\music\combat3")
    wait(500)
    uo.playwav("C:\UO\music\combat3")
    wait(500)
    uo.playwav("C:\UO\music\combat3")
    wait(500)
    uo.playwav("C:\UO\music\combat3")
    wait(500)
end sub

sub Skvoz_chara()
    If UO.GetGlobal('GMstepCheck')=='on' Then
        UO.SetGlobal('GMstepCheck','off')
        UO.Print("GM Step: Off")
        UO.Morph('0')
    Else
        UO.SetGlobal('GMstepCheck','on')
        UO.Print("GM Step: On")
        UO.Morph('0x03DB');  0x03DB
    End If
end sub

Sub CheckWorldSave()
    if uo.injournal('World is saving') then
        repeat
            wait(500)
        until uo.injournal('data saved')
    endif
end sub

sub checkplayer()
    var player
    uo.Set('finddistance','7')
    var i
    DIM people[2]
    people[0]='0x0190' ; Male
    people[1]='0x0191' ; Female
    uo.Ignore('self')
    for i = 0 to 1
        uo.FindType(people[i],'-1','ground')
        player = uo.GetSerial('finditem')
        wait(500)
        if uo.FindCount() then
            uo.msg('\w Karakyt:Fire Dungeon - Someone are coming!!!')
            rhome()
        else
        end if
    next
    uo.IgnoreReset()
end sub

sub Reconnector()
    var ReconnectTime, RFlag
    ReconnectTime = '0'
    RFlag = 1
    Repeat
        Check()
        While (uo.ObjAtLayer('Bpack') == '')
            if RFlag Then
                ReconnectTime = MakeTime()
                RFlag = 0
            endif
            Wait(100000) # WorldSave Protection
            uo.Say('')
            Wait(5000)
            uo.Say('')
            Wait(5000)
            uo.Say('')
            Wait(5000)
            uo.LDblClick(357,164)
            uo.LClick(616,459)
            Wait(5000)
        Wend
        Wait(3000)
        if (RFlag == 0) and (ReconnectTime <> '0') Then
            uo.TextOpen()
            uo.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
            uo.useobject('self')
            wait(1000)
            uo.useobject('backpack')
            wait(1000)
            RFlag = 1
            ReconnectTime = '0'
            wait(1000)
            sbros1()
        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 CheckLag()
    UO.DeleteJournal()
    UO.Click('backpack')
    Repeat
        Wait(100)
    Until UO.InJournal("backpack")
end sub

sub Check()
    if UO.Life < 1 then
        Ress()
    endif
    if uo.injournal('FLY HOME FLY') then
        sbros1()
    end if
    if uo.injournal('Your large battle axe is destroyed') then
        sbros1()
    end if
end sub