Yoko

All sides of Injection
It is currently 2025-12-23 21:04:32

All times are UTC+02:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: 2008-02-06 22:25:37 
Offline
User avatar

Joined: 2008-02-03 16:40:01
Posts: 6
За основу взял скрипт ВЕТЕРАНа на лумбер. Хотел доделать так что бы чар летал не по одной трассе а по 3м. Подправил. Вроде(как мне кажется все сделал верно)... но почему то скрипт работает не правильно. Чар реколиться на первую трассу но не рубит... и примерно каждые 20 секунд реколиться на то же место где уже стоит(по первой руне)
Сам скрипт:
Code:
###################################################################################################
var f=file("D:\Games\trees1.dat")
###
var P=1 ## переменная отвечающая за выбор номера трассы
###
var TryHiding=1 ## 1 - Перед тем как рубить дерево, будет пытаться уйти в хайд, 0 - не будет .
###
var TryRecall=1 ## 1 - После того как соберет LogsQty логов, будет пытаться реколиться домой,
### складывать логи в сундук и реколиться обратно , 0 - не будет.
###
var LogsQty=3100 ## - Количество логов, добыв которое надо реколиться домой.
###
var GetFromFile=1## 1 - Координаты деревьев будут считыватся из файла, 0 - собиратся из клиента
### (сначала соберите а потом считывайте из файла).
###
var AttackEnts=0 ## 1 - Включить рекол по руне(в паке) при атаке, 0 - отключить рекол.
###
var CastAtAttack=0 ## 1 - Включить каст - "Magic Arrow" на напавшего, 0 - отключить каст.
###
var EatingFood=1 ## 1 - Будем есть, 0 - нет.
###
var TypeFood='0x097B' ## - Тип еды которую будем кушать.(сейчас фиштейки)
###
var Reconnect=1 ## 1 - Включить реконнект на сервер если выкинет, 0 - отключить реконнект.
###
var RecallDrop=0 ## 1 - Включить рекол после побега от ента домой и выложить логи, 0 -выключить.
###
var RecallLumber=0 ## 1 - Включить рекол в лес после указания обьектов, 0 - выключить.
###
var Chest='0x41827ab9' ## - ID сундука куда будут выгружаться логи, где должны лежать реколы и еда.
###
var LumberSound=('C:\Warning.wav') ## - Звук которы будет пригран при атаке.(замените на свой)
###
var oldX,oldY,time ## - Для рекола.
###
###################################################################################################
###
### После настройки (переменных выше) :
### Идите в лес в котором вы хотите рубить.
### Запустите cкрипт Lumberjacking(), Инжект попросит вас указать Топор
### (появится прицел, прицелом на топор который вы с собой взяли),
### затем инжект попросит вас указать Рунбук(появится прицел, прицелом на него).
### После этого чар пойдет по координатам и будет вырубать деревья.
###########
### Код ###
###########
sub Lumberjacking()
var i=0,j=0,k=0,r=0,q=0,ii,jj
var TopX=324,TopY=65
dim TreeX[5000], TreeY[5000],TreeT[5000]
dim TreeTile[29]
var flag=0,treeCount=0,clicks=0,flag2=0
#BETEP™#
########################
### Графика деревьев ###
########################
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

uo.Exec("filterspeech on")
uo.Exec("filterspeech add 'Where do you want to use the Axe?'")

uo.Print('Choose Axe: ')
uo.Exec('addobject Axe')
while uo.Targeting()
wait(100)
wend


if AttackEnts==1 then
uo.exec('addobject runeD')
while uo.Targeting()
wait(100)
wend
uo.Exec('exec AttackEnts')
end if

if Reconnect==1 then
uo.Exec('exec Reconnect')
end if

if RecallLumber==1 then
uo.Exec('exec RecallToLumber')
wait(5000)
end if
######################################
### Загружаем координаты из файла(ов)#
######################################

if GetFromFile==1 then
uo.Print('Zagruzhaem trassu...')
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()
end if

######################################
### Собираем координаты из клиента ###
######################################
uo.Print('Choose PickAxe: ')
uo.Exec('addobject Pickaxe')
while uo.Targeting()
wait(100)
wend
uo.Print('Sobiraem koordinati dereviev...')
repeat
clicks=0
flag=0
uo.DeleteJournal()
#######################
### Кликаем на тайл ###
#######################
uo.UseObject('Pickaxe')
waitForTarget()
uo.DeleteJournal()
WaitForTryRock()
###############################
### Проверяем дерево ли это ###
###############################
flag=0
for k=0 to 28
if uo.LastTile(0)==TreeTile[k]+1 then
flag=2
end if
next
if flag==0 then
for k=0 to 28
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('Найдено дерево '+str(treeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2))+' '+str(treeCount))
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('Найдено дерево '+str(treeCount)+' : x='+str(uo.Lasttile(1))+' y='+str(uo.LastTile(2)))
end if
end if
until (Flag==3) or (treeCount==1000)
uo.Exec("filterspeech off")
uo.Print('Анализ закончен, координаты деревьев записаны в файл C:\trees3.dat')
SaveToFile(treeCount,TreeX,TreeY,TreeT)
end if
uo.Print('Derevo naideno: '+str(treeCount))
wait(1000)
######################################
### Ходим по собранным координатам ###
######################################
while 1==1
if treeCount>0 then
for i=1 to treeCount
if TryRecall==1 and uo.Count('ZLK')>=LogsQty then
ToRecall()
end if
uo.Print('Idem k derevu '+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 GetTree(Type,X,Y,Z)
var i
uo.Print('Nachinaem rubku dereva...')
for i=0 to 99999
if uo.Warmode()==1 then
return 0
end if
wait(200)
uo.DeleteJournal()
### CheckLag()
uo.WaitTargetTile(Type,X,Y,Z)
uo.UseObject('Axe')
if WaitForChange()==1 then
return 1
end if
next
return 0
end sub

Sub ToRecall()
RecallToHome()
DropLogs()
InfoLogs()
if EatingFood==1 then
EatingFood()
end if
RecallToLumber()
end sub

sub RecallToHome()
var i
uo.print('Recall to home...')
for i=1 to 10
uo.deletejournal()
uo.waittargetobject('0x41807d5a')             ###  рекол на руну домой
uo.cast('Recall')                             ###  каст рекола с книги
if WaitForRecall()==1 then
return 1
end if
next
return 0
end sub

sub RecallToLumber()
var i
uo.print('Recall to les...')
if P==1 then
for i=1 to 10
uo.deletejournal()
uo.waittargetobject('0x4181a267')        ###  рекол на руну в лес1
uo.cast('Recall')                        ###  каст рекола с книги
if waitForRecall()==1 then
return 1
end if
next
return 0
end if
#
if P==2 then
for i=1 to 10
uo.deletejournal()
uo.waittargetobject('0x41821257')        ###  рекол на руну в лес2
uo.cast('Recall')                        ###  каст рекола с книги
if waitForRecall()==1 then
return 1
end if
next
return 0
end if
#
if P==3 then
for i=1 to 10
uo.deletejournal()
uo.waittargetobject('0x41811da7')        ###  рекол на руну в лес3
uo.cast('Recall')                        ###  каст рекола с книги
if waitForRecall()==1 then
return 1
end if
next
return 0
end if
end sub


Sub ToHide()
while not uo.Hidden()
uo.Print('Pitaemsa uiti v hide')
uo.DeleteJournal()
uo.UseSkill('Stealth')
wait(3000)
wend
wait(100)
end sub

Sub WaitForRecall()
var Text1=uo.GetName()+": The spell fizzles."
var mess='',lastX=uo.getX(),lastY=uo.getY()
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=uo.GetName()+": You have hidden yourself well"
var Text2=uo.GetName()+": You can't seem to hide here."
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
wait(50)
next
return 0
end sub

Sub WaitForChange()
var Text1=uo.GetName()+':There are no logs left here to сhop.'
var Text2='There are no logs left here to chop'
var Text3="You can't reach this."
var Text4="That's too far away to chop."
var Text5="You can't do much in your current state."
var mess
for var i=0 to 50
mess=uo.Journal(0)
if uo.Journal(0)==Text2 or uo.Journal(0)==Text3 or uo.Journal(0)==Text4 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
return 0
end if
wait(50)
next
return 0
end sub

Sub WaitForTryRock()
var Text1="That is too far away."
var Text2="Try mining in rock."
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 see the target"
for var i=0 to 1
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 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 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 SaveToFile(treeCount,TreeX,TreeY,TreeT)
var f=file("D:\Games\lumber1.dat")
var s=0,i=0
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 DropLogs()
ToHide()
var Logs='0x1BDD'                          ### тип логов
while uo.count(Logs)
 uo.findtype(Logs, '-1' , '0x4001ea4e')
 uo.moveitem('finditem','0' , Chest)
 wait(550)
wend
uo.Print('Логи Выложены.')
#######################################################################
if P < 4 then                                  ###  эт что бы менялись
P=P+1                                          ###  пути для рубки
else                                           ###  деревьев
P=1                                        ###
uo.Print('путь был изменен!')                  ###
#######################################################################
#### загружаем 1ю трассу
if P==1 then
f=file("D:\Games\trees1.dat")
end if
#### загружаем 2ю трассу
if P==2 then
f=file("D:\Games\trees2.dat")
end if
#### загружаем 3ю трассу
if P==3 then
f=file("D:\Games\trees3.dat")
end if
end sub

sub InfoLogs()
uo.Print('У вас всего '+str(uo.Count('0x1BDD'))+' логов в сумке')
uo.Print('Из них '+str(uo.Count('0x1BDD','0x0000'))+' простых и ' +str(uo.Count('0x1BDD')-uo.Count('0x1BDD','0x0000'))+' цветных')
end sub


sub Open(Container)
uo.DeleteJournal()
uo.UseObject(Container)
repeat
wait(500)
until uo.InJournal('Contains')
end sub

Sub EatingFood()
ToEat()
DropFood()
end sub

Sub ToEat()
uo.SetReceivingContainer('backpack')
Open(Chest)
uo.FindType(TypeFood,'-1',Chest)
uo.Grab('20','finditem')
wait(500)
repeat
Checklag()
uo.UseType(TypeFood)
wait(1000)
until uo.InJournal('You are simply too full to eat any more!')           ### фраза када наелся
uo.UnsetReceivingContainer()
end sub

Sub DropFood()
if uo.Waiting() then
uo.CancelTarget()
end if
var f,Exit
dim Food[1]
Food[0]=TypeFood
uo.SetReceivingContainer(Chest)
wait(500)
for f=0 to 0
Exit=0
repeat
uo.FindType(Food[f])
if uo.GetQuantity('finditem')>0 then
uo.Grab('0','finditem')
wait(1500)
else
Exit=1
end if
until Exit==1
next
uo.UnSetReceivingContainer(Chest)
end sub

Sub AttackEnts()
uo.DeleteJournal()
var Enemy='0x00000000'
repeat
if uo.InJournal('is attacking you') or uo.InJournal('OOPS!!!') or uo.InJournal('Wis Quas') then
uo.Exec('terminate Lumberjacking')
Enemy=uo.JournalSerial(uo.InJournal('is attacking you')-1)
##uo.PlayWav(LumberSound)
if CastAtAttack==1 then
uo.Cast('Magic Arrow',Enemy)
end if
uo.DeleteJournal()
RecallAtAttack()
end if
wait(1000)
until false
end sub

sub RecallAtAttack()
var mX,mY
reccal:
uo.DeleteJournal()
if uo.Waiting() then
uo.CancelTarget()
end if
mX=uo.getX("self")
mY=uo.getY("self")
uo.DeleteJournal()
uo.waittargetobject('0x41807d5a')             ###  переделанный рекол на базу
uo.cast('Recall')
#uo.usetype('0x1F4C')                          ###  реколиться со скрола
#uo.usetype('0x1F4C')                          ###  инвизка (!) установить тип
uo.Print('Атака! Реколимся!')
wait(4000)
if not uo.getX("self")<>mX and not uo.getY("self")<>mY then
goto reccal
end if
if RecallDrop==1 then
RecallToHome()
DropLogs()
InfoLogs()
end if
Terminate()
end sub

Sub Reconnect()
var ReconnectTime,rFlag
ReconnectTime='0'
rFlag=1
repeat
while (uo.ObjAtLayer('Bpack')=='')
if rFlag then
ReconnectTime=MakeTime()
rFlag=0
end if
wait(20000)
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 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
end if
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
end if
next
ret=t+" @ "+d
return ret
end sub

Sub Terminate()
uo.Print('Работа скрипта приостановлена! все функции выключены!')
uo.DeleteJournal()
uo.Exec('terminate all')
wait(100)
uo.Exec('terminate all')
wait(100)
uo.Exec('terminate all')
wait(100)
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('backpack')
end sub


если бы ошибка была только в том как я сделал процедуру смена трасс то тогда, хотя бы по первой трассе, чар бы должен был рубить нормально.... а он вообще не рубит. Мне тут подсказывали что то про плавающие переменные... но я так и не понял в чем дело :?
подскажите где я ошибся и что подправить?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC+02:00


Who is online

Users browsing this forum: Bing [Bot] and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited