Подправьте пожалуйста скрипт на ламбер
Posted: 2009-02-11 07:34:58
помогите пожалуйста, вначале того как начинаю рубить почему то стопорит хидинг.... видимо в скрипте чтото с хидингом, профессионалы посмотрите пожалуйста. Заранее благодарен
Code: Select all
sub Lumberjacking()
var i=0,j=0,k=0,r=0,q=0,ii,jj,f
var TopX=324,TopY=65
dim TreeX[5000],TreeY[5000],TreeT[5000]
dim TreeTile[33]
var flag=0,TreeCount=0,clicks=0,flag2=0
########################
### Ãðàôèêà äåðåâüåâ ###
########################
TreeTile[0]=3277
TreeTile[1]=3280
TreeTile[2]=3283
TreeTile[3]=3286
TreeTile[4]=3289
TreeTile[5]=3291
TreeTile[6]=3294
TreeTile[7]=3296
TreeTile[8]=3299
TreeTile[9]=3302
TreeTile[10]=3393
TreeTile[11]=3394
TreeTile[12]=3395
TreeTile[13]=3396
TreeTile[14]=3415
TreeTile[15]=3416
TreeTile[16]=3417
TreeTile[17]=3418
TreeTile[18]=3419
TreeTile[19]=3438
TreeTile[20]=3439
TreeTile[21]=3440
TreeTile[22]=3441
TreeTile[23]=3442
TreeTile[24]=3460
TreeTile[25]=3461
TreeTile[26]=3462
TreeTile[27]=3290
TreeTile[28]=3288
TreeTile[29]=3275
TreeTile[30]=3293
TreeTile[31]=3476
TreeTile[32]=3480
if AddObject==1 then
uo.FilterSpeech('on')
uo.FilterSpeech('add', 'Where do you want to use the pickaxe?')
uo.Print('Âûáåðè Òîïîð: ')
uo.Exec('addtype Axe')
while uo.Targeting()
wait(100)
wend
if TryRecall==1 then
uo.Print('Rune to Home')
uo.Exec('addobject Home')
while uo.Targeting()
wait(100)
wend
uo.Print('Rune to Les')
uo.Exec('addobject Les')
while uo.Targeting()
wait(100)
wend
end if
if ControlOfDanger==1 then
uo.Print('Âûáåðè Ðóíó: ')
uo.Exec('addobject Rune')
while uo.Targeting()
wait(100)
wend
end if
end if
if ControlOfDanger==1 then
uo.Exec('exec ControlOfDanger')
end if
if Reconnect==1 then
uo.Exec('exec Reconnect')
end if
#####################################
### Çàãðóæàåì êîîðäèíàòû èç ôàéëà ###
#####################################
if GetFromFile==1 then
uo.Print('Checking data...')
f=file(FileName)
f.Open()
TreeCount=safe call f.ReadNumber()
for i=1 to TreeCount
TreeT[i]=safe call f.ReadNumber()
TreeX[i]=safe call f.ReadNumber()
TreeY[i]=safe call f.ReadNumber()
next
f.Close()
else
######################################
### Ñîáèðàåì êîîðäèíàòû èç êëèåíòà ###
######################################
if AddObject==1 then
uo.Print('Âûáåðè Êèðêó: ')
uo.Exec('addobject Pickaxe')
while uo.Targeting()
wait(100)
wend
end if
uo.Print('Ñîáèðàåì êîîðäèíàòû äåðåâüåâ â îêðóãå...')
repeat
clicks=0
flag=0
uo.DeleteJournal()
#######################
### Êëèêàåì íà òàéë ###
#######################
uo.UseObject('Pickaxe')
waitForTarget()
uo.DeleteJournal()
WaitForTryRock()
###############################
### Ïðîâåðÿåì äåðåâî ëè ýòî ###
###############################
flag=0
for k=0 to 33
if uo.LastTile(0)==TreeTile[k]+1 then
flag=2
end if
next
if flag==0 then
for k=0 to 33
if uo.LastTile(0)==TreeTile[k] then
flag=1
end if
next
end if
if uo.Lasttile(1)==uo.GetX() and uo.Lasttile(2)==uo.GetY() then
flag=3
end if
#########################
### Êëèêíóëè íà ñòâîë ###
#########################
if flag==1 then
flag2=0
if TreeCount>0 then
for ii=1 to TreeCount
if TreeX[ii]==uo.LastTile(1) and TreeY[ii]==uo.LastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
TreeCount=TreeCount+1
TreeX[TreeCount]=uo.LastTile(1)
TreeY[TreeCount]=uo.LastTile(2)
TreeT[TreeCount]=uo.LastTile(0)
uo.Print('Finded tree number '+str(TreeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2)))
end if
end if
##########################
### Êëèêíóëè ïî ëèñòâå ###
##########################
if flag==2 then
flag2=0
if TreeCount>0 then
for ii=1 to TreeCount
if TreeX[ii]==uo.LastTile(1) and TreeY[ii]==uo.LastTile(2) then
flag2=1
end if
next
end if
if flag2==0 then
TreeCount=TreeCount+1
TreeX[TreeCount]=uo.LastTile(1)
TreeY[TreeCount]=uo.LastTile(2)
TreeT[TreeCount]=uo.LastTile(0)-1
uo.Print('Finded tree number '+str(TreeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2)))
end if
end if
until (flag==3) or (TreeCount==5000)
uo.FilterSpeech('off')
uo.Print('Analizing finished. All data has been written into the ' + FileName)
SaveToFile(TreeCount,TreeX,TreeY,TreeT)
end if
uo.Print('Tree finded: '+str(TreeCount))
wait(5000)
######################################
### Õîäèì ïî ñîáðàííûì êîîðäèíàòàì ###
######################################
while 1==1
if TreeCount>0 then
for i=1 to TreeCount
if TryRecall==1 and uo.Count('ZLK')>=LogsQty or uo.Weight>=uo.STR*4+20 then
ToRecall()
end if
uo.Print('Going to tree number '+str(i)+': x='+str(TreeX[i])+' y='+str(TreeY[i]))
InfoLogs()
flag=GotoXY(TreeX[i],TreeY[i])
if flag==1 then
if TryHiding==1 then
ToHide()
end if
GetTree(str(TreeT[i]),str(TreeX[i]),str(TreeY[i]),str(uo.GetZ()))
end if
next
end if
wend
end sub
sub SaveToFile(TreeCount,TreeX,TreeY,TreeT)
var s=0,i=0,f
f=file(FileName)
f.Open()
f.Create()
s=safe call f.Writeln(TreeCount)
for i=1 to TreeCount
s=safe call f.Writeln(str(TreeT[i])+' '+str(TreeX[i])+' '+str(TreeY[i]))
next
f.Close()
end sub
sub GetTree(Type,X,Y,Z)
var i
uo.Print('Hadgime mash-ta...')
for i=0 to QuantityImpact
if uo.Warmode()==1 then
return 0
end if
wait(200)
uo.DeleteJournal()
uo.WaitTargetTile(Type,X,Y,Z)
uo.Usetype('Axe')
if WaitForChange()==1 then
return 1
end if
next
return 0
end sub
sub WaitForRecall()
var Text1=uo.GetName()+': The spell fizzles.'
var LastX=uo.GetX()
var LastY=uo.GetY()
var mess=''
for var i=0 to 200
mess=uo.Journal(0)
if uo.Journal(0)==Text1 then
return 0
end if
if uo.GetX()<>LastX or uo.GetY()<>LastY then
return 1
end if
wait(50)
next
return 0
end sub
sub WaitForHide()
var Text1="You have hidden"
var Text2="You can't seem to hide"
var Text3="You have been"
var mess
for var i=0 to 200
mess=uo.Journal(0)
if uo.Journal(0)==Text1 then
return 1
end if
if uo.Journal(0)==Text2 then
return 0
end if
if uo.Journal(0)==Text3 then
return 1
end if
wait(50)
next
return 0
end sub
sub WaitForChange()
var Text1='You hack at the tree for a while, but fail to produce any useable wood'
var Text2='There is nothing here to chop.'
var Text3="You can't reach this."
var Text4='That is too far away.'
var Text5="You can't do much in your current state."
var Text6='It appears immune to your blow'
var mess
for var i=0 to 200
mess=uo.Journal(0)
if uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 or uo.Journal(0)==Text6 then
return 1
end if
if uo.Journal(0)==Text1 then
return 0
end if
if mess[0]=='Y' and mess[1]=='o' and mess[2]=='u' and mess[4]=='p' and mess[5]=='u' and mess[6]=='t' then
if DropLog==1 then
UO.Exec('exec CheckLog')
end if
return 0
end if
wait(50)
next
return 0
end sub
sub WaitForTryRock()
var Text1='That is too far away.'
var Text2='Try mining elsewhere.'
var Text3='There is no ore here to mine.'
var Text4='You have no line of sight to that location'
var Text5="You can't use the %s where it is."
var Text6='It appears immune to your blow.'
for var i=0 to 50
if uo.Journal(0)==Text1 or uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 or uo.Journal(0)==Text5 or uo.Journal(0)==Text6 then
return 1
end if
wait(200)
next
return 0
end sub
sub WaitForTarget()
for var i=0 to 50
if uo.Targeting()==1 then
return 1
end if
wait(200)
next
return 0
end sub
sub WaitForChangeXY(myX,myY,LastX,LastY)
for var i=1 to 50
if LastX<>myX or LastY<>myY then
return 1
end if
wait(200)
next
return 0
end sub
sub MovingItems(tItem,cItem,qItem,FromBackPack)
var idResivCont,idSendCont
Open(Chest)
uo.UseObject('backpack')
if FromBackPack==1 then
idResivCont=uo.GetSerial('backpack')
idSendCont=Chest
else
idSendCont=uo.GetSerial('backpack')
idResivCont=Chest
end if
CheckLag()
uo.Findtype(tItem,cItem,idSendCont)
while uo.GetQuantity('finditem')>0
uo.MoveItem('finditem',str(qItem),idResivCont)
wait(1000)
CheckLag()
if qItem>0 then
return
end if
uo.FindType(tItem,cItem,idSendCont)
wend
end sub
sub InfoTrees(sNum,fStr,lStr,Sort)
var n=VAL(Right(sNum,1))
if n==0 then
if Sort==0 then
uo.Print(fStr+'à'+lStr)
else
uo.Print(fStr+lStr)
end if
return
end if
if n<5 then
uo.Print(fStr+'à'+lStr)
return
end if
if Sort==0 then
uo.Print(fStr+'åâ'+lStr)
else
uo.Print(fStr+'îâ'+lStr)
end if
end sub
sub Open(Container)
uo.DeleteJournal()
uo.UseObject(Container)
repeat
wait(500)
until uo.InJournal('Contains')
end sub
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()
if LastX==myX and LastY==myY then
halt=halt+1
else
halt=0
end if
if halt>=10 then
if uo.GetDir()==1 then
for z=0 to 8
uo.Press(40)
next
end if
if uo.GetDir()==3 then
for z=0 to 8
uo.Press(37)
next
end if
if uo.GetDir()==5 then
for z=0 to 8
uo.Press(38)
next
end if
if uo.GetDir()==7 then
for z=0 to 8
uo.Press(39)
next
end if
halt=15
end if
if Numb(x-myX)<=1 and Numb(y-myY)<=2 then
return 1
end if
if x<=myX then
if y<=myY then
for z=0 to 3
uo.Press(38)
next
else
for z=0 to 3
uo.Press(37)
next
end if
else
if y<=myY then
for z=0 to 3
uo.Press(39)
next
else
for z=0 to 3
uo.Press(40)
next
end if
end if
LastX=myX
LastY=myY
wait(200)
next
return 0
end sub
sub Numb(num)
if num>=0 then
return num
else
return num*(-1)
end if
end sub
sub InfoLogs()
uo.Print('You have '+str(uo.Count('0x1BDD'))+' logs in the bag')
uo.Print('From them '+str(uo.Count('0x1BDD','0x0000'))+' simple and ' +str(uo.Count('0x1BDD')-uo.Count('0x1BDD','0x0000'))+' colored')
end sub
sub ToHide()
while not UO.Hidden()
UO.Exec('warmode 0')
UO.UseSkill('Stealth')
repeat
UO.DeleteJournal()
wait(50)
If UO.InJournal('You stop') Then
wait(4000)
End If
until UO.InJournal('You have hidden') OR UO.InJournal('seem to') OR UO.InJournal('preoccupied')
wend
end sub
sub ToRecall()
uo.Exec('terminate ControlOfDanger')
RecallToHome()
DropLogs()
InfoLogs()
if EatingFood==1 then
EatingFood()
end if
wait(3000)
RecallToLumber()
if ControlOfDanger==1 then
uo.Exec('exec ControlOfDanger')
end if
end sub
sub RecallToHome()
uo.Print('Home Jump.')
UO.WaitTargetObject('Home')
uo.cast('Recall')
WaitForRecall()
end sub
sub RecallToLumber()
uo.Print('Forest Jump.')
UO.WaitTargetObject('Les')
uo.cast('Recall')
WaitForRecall()
end sub
sub DropLogs()
var Time,Space
Time=Time()
Space=' '
uo.TextOpen()
uo.TextPrint("Unloading Logs - " +Space +Time)
ToHide()
VAR a
VAR LastTimer
uo.say("Bank")
wait(1000)
CheckLag()
For a=1 to 1
While UO.Count(Log[a])>0
UO.FindType(Log[a],-1,-1)
UO.MoveItem('finditem',0,Chest)
wait(1000)
Wend
next
if UO.Mana < 30 then
while UO.Mana<UO.Int
LastTimer=UO.Timer()
UO.UseSkill('Meditation')
repeat
wait(100)
until UO.InJournal("You are") OR UO.InJournal("You lose") OR UO.Timer()>LastTimer+200
UO.DeleteJournal()
wait(200)
wend
endif
end sub
sub EatingFood()
var Time,Space
Time=Time()
Space=' '
uo.TextOpen()
uo.TextPrint('Êóøàåì - ' +Space +Time)
MovingItems(TypeFood,'-1',20,1)
repeat
CheckLag()
if uo.Count(TypeFood)<=0 then
uo.Exec('terminate EatingFood')
end if
uo.UseType(TypeFood)
while not uo.InJournal('full') and not uo.InJournal('stuffed') and not uo.InJournal('hungry') and not uo.InJournal('satiated') and not uo.Dead()
wait(100)
wend
until uo.InJournal('too full') or uo.Dead()
while uo.Count(TypeFood)>0
MovingItems(TypeFood,'-1',-1,0)
wend
end sub
sub ControlOfDanger()
var Time,danger,Space
Time=Time()
Space=' '
while 1
uo.DeleteJournal()
while not uo.InJournal(':')
wait(100)
wend
danger=uo.GetNotoriety(uo.JournalSerial(0))
if uo.InJournal('attacking you') then
uo.GetStatus('uo.JournalSerial(0)')
uo.SetGlobal('name',uo.GetName(uo.JournalSerial(0)))
uo.TextOpen()
uo.TextPrint('You has been attacked - '+uo.GetName(uo.JournalSerial(0)) +Space +Time)
uo.Exec('exec RecallRune')
end if
end if
if SeenDanger==1 then
if Danger==6 and UO.JournalSerial(0) <> UO.GetSerial() then
uo.GetStatus('uo.JournalSerial(0)')
uo.SetGlobal('name',uo.GetName(uo.JournalSerial(0)))
uo.TextOpen()
uo.TextPrint('PK approaching near - '+uo.GetName(uo.JournalSerial(0)) +Space +Time)
uo.Exec('exec RecallRune')
end if
if Danger==4 and UO.JournalSerial(0) <> UO.GetSerial() then
uo.GetStatus('uo.JournalSerial(0)')
uo.SetGlobal('name',uo.GetName(uo.JournalSerial(0)))
uo.TextOpen()
uo.TextPrint('Kriminal approaching near - '+uo.GetName(uo.JournalSerial(0)) +Space +Time)
uo.Exec('exec RecallRune')
end if
if RecallFromAll==1 then
if Danger==1 and UO.JournalSerial(0) <> UO.GetSerial() then
uo.GetStatus('uo.JournalSerial(0)')
uo.SetGlobal('name',uo.GetName(uo.JournalSerial(0)))
uo.TextOpen()
uo.TextPrint('Enemy approaching near - '+uo.GetName(uo.JournalSerial(0)) +Space +Time)
uo.Exec('exec RecallRune')
end if
end if
end if
wend
end sub
sub RecallRune()
Terminate()
uo.PlayWav(DisturbingSound)
uo.UseType('0x0F0E','0x0631')
wait(100)
uo.WaitTargetObject('Rune')
uo.Exec('warmode 0')
uo.Cast('Recall')
WaitForRecall()
repeat
uo.DeleteJournal()
uo.WaitTargetObject('Rune')
wait(100)
uo.Cast('Mark')
if uo.InJournal('mana for this spell') then
ManaUp('Bottle')
wait(100)
end if
wait(13000)
until not uo.InJournal('spell fizzles')
if uo.Life<uo.STR then
LifeUp('Bottle')
wait(100)
end if
if CycleScript==1 then
uo.Exec('exec DangerWait')
end if
if CycleScript==0 then
uo.Exec('exec ExitUO')
end if
end sub
sub DisturbingSound(amount)
var i
for i=1 to amount
uo.PlayWav(DisturbingSound)
wait(1500)
next
end sub
sub DangerWait()
wait(DangerousTime)
ToRecall()
uo.Exec('exec Lumberjacking')
end sub
sub ExitUO()
wait(3000)
uo.CloseUO()
end sub
sub LifeUp(Mode)
if Mode=='Healing' then
while uo.Life<uo.STR
uo.Exec('bandageself')
wait(4000)
wend
end if
if Mode=='Bottle' then
if uo.Life<uo.STR then
uo.UseType('0x0F0E','0x09BB')
wait(100)
end if
end if
end sub
sub ManaUp(Mode)
if Mode=='Meditation' then
while uo.Mana<uo.INT
uo.Exec('useskill Meditation')
wait(4000)
wend
end if
if Mode=='Bottle' then
if uo.Mana<uo.INT then
uo.UseType('0x0F0E','0x09DF')
wait(100)
end if
end if
end sub
sub Reconnect()
var ReconnectTime,rflag
ReconnectTime='0'
rflag=1
repeat
while (uo.ObjAtLayer('Bpack')=='')
if rflag then
ReconnectTime=Time()
rflag=0
end if
wait(30000)
uo.Say('') #
wait(3000)
uo.Say('') #
wait(3000)
uo.Say('') #
wait(3000)
uo.Ldblclick(357,164)
uo.Lclick(616,459)
wait(3000)
wend
wait(3000)
if (rflag==0) and (ReconnectTime<>'0') then
uo.TextOpen()
uo.TextPrint('Disconnected & Reconnected @ '+ReconnectTime)
rflag=1
ReconnectTime='0'
end if
until false
end sub
sub Time()
var Date,nTime,uTime,i
uTime=str(uo.Time())
nTime=''
for i=0 to Len(uTime)
nTime=uTime[Len(uTime)-i]+nTime
if (i==2) or (i==4) then
nTime=':'+nTime
end if
next
uTime=str(uo.Date())
Date=''
for i=0 to Len(uTime)
Date=uTime[Len(uTime)-i]+Date
if (i==2) or (i==4) then
Date='.'+Date
end if
next
uTime=nTime+' @ '+Date
return uTime
end sub
sub Terminate()
uo.Exec('terminate Lumberjacking')
uo.Exec('terminate ControlOfDanger')
uo.Exec('terminate Reconnect')
end sub
sub CheckLag()
if uo.Waiting()>0 then
uo.Exec('canceltarget')
end if
uo.DeleteJournal()
uo.Click('backpack')
repeat
wait(50)
until uo.InJournal('a Backpack')
end sub
sub CheckLog()
dim Orss[1]
Orss[1]='0x0000' ;Log
UO.FindType('0x1BDD',Orss[1])
UO.Drophere('finditem')
wait(1500)
end sub