Yoko

All sides of Injection
It is currently 2025-10-14 20:43:37

All times are UTC+02:00




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: 2008-02-02 01:28:45 
Offline

Joined: 2007-12-30 14:23:05
Posts: 48
Меня интересует правильность моего скрипта, помоему вроде все правильно, но подсчитывает не те инги, которые прописаны по цвету, во втором скрипте зачем то backpack считает несколько раз , просто возможно это из-зи переезда сервера Дрв, так как команды с рунбукой тоже перестали действовать

Code:
sub Count_trash_ing()
   var Box_for_trash_ing
   var i, p, name, cen, sum = 0
   
   DIM item[7]
   item[1] = 0x0750 ## - Rusty Ingot
   item[2] = 0x0590 ## - Old Copper Ingot
   item[3] = 0x060A ## - Dull Copper Ingot
   item[4] = 0x0488 ## - Bronze Ingot
   item[5] = 0x096B ## - Shadow Ingot
   item[6] = 0x0014 ## - Rose Ingot
   item[7] = 0x0193 ## - Agapite
   
   DIM price[7]
   price[1] = 1 ## - Rusty Ingot
   price[2] = 2 ## - Old Copper Ingot
   price[3] = 3 ## - Dull Copper Ingot
   price[4] = 4 ## - Bronze Ingot
   price[5] = 5 ## - Shadow Ingot
   price[6] = 6 ## - Rose Ingot
   price[7] = 7 ## - Agapite

   UO.UseObject('Box_for_trash_ing')
   CheckLag()
   uo.TextPrint('Trash Ore')
   uo.TextPrint(' --------- ')
   for i = 1 to 7
      for p = 1 to 7
         uo.FindType('0x1BEF', 'item[i]', 'Box_for_trash_ing')
         if uo.FindCount('finditem') > 0 then
            uo.Click('finditem')
            wait(300)
            name = uo.GetName('finditem')
            cen = uo.GetQuantity('finditem') * price[p]
            sum = sum + cen
            uo.TextPrint(name + ' ------ ' + str(cen) + 'k (' + str(price[p]) + 'k per piece)')
            uo.Ignore('finditem')
            uo.FindType('0x1BEF', 'item[i]', 'Box_for_trash_ing')
         End if
         wait(100)
      next
   next
   uo.TextPrint(' --------- ')
   uo.TextPrint('Total Amount: ' + str(sum) + 'k')
   uo.TextPrint(' =========================================== ')
   uo.IgnoreReset()
Endsub
###################################
sub Count_other_ing()
   var Box_for_trash_ing
   var i, p, name, cen, sum = 0
   
   DIM item[4]
   item[1] = 0x1BEF ## - Iron Ingot
   item[2] = 0x1BE3 ## - Copper Ingot
   item[3] = 0x1BF5 ## - Silver Ingot
   item[4] = 0x1BE9 ## - Gold Ingot
   
   DIM price[4]
   price[1] = 1 ## - Iron Ingot
   price[2] = 2 ## - Copper Ingot
   price[3] = 3 ## - Silver Ingot
   price[4] = 4 ## - Gold Ingot

   UO.UseObject('Box_for_trash_ing')
   wait(300)
   for i = 1 to 4
      for p = 1 to 4
         uo.FindType('item[i]', '0x0000', 'Box_for_trash_ing')
         if uo.FindCount('finditem') > 0 then
            uo.Click('finditem')
            wait(300)
            name = uo.GetName('finditem')
            cen = uo.GetQuantity('finditem') * price[p]
            sum = sum + cen
            uo.TextPrint(name + ' ------ ' + str(cen) + 'k (' + str(price[p]) + 'k per piece)')
            uo.Ignore('finditem')
            uo.FindType('item[i]', '0x0000', 'Box_for_trash_ing')
         End if
      next
   next
   uo.TextPrint(' --------- ')
   uo.TextPrint('Total Amount: ' + str(sum) + 'k')
   uo.TextPrint(' =========================================== ')
   uo.IgnoreReset()
Endsub      


Top
   
 Post subject:
PostPosted: 2008-02-02 02:50:15 
Offline

Joined: 2007-12-30 14:23:05
Posts: 48
И еще не могу понять почему скрипт не зацикливается, то есть берет всего один раз руду, хотя в ящике ее много
Code:
sub Smelt_trash_ore()
   var Box_for_trash_ore
   var i, Exit
   
   DIM item[4]
   item[1] = 0x19B9 ## - 4 ore
   item[2] = 0x19B8 ## - 3 ore
   item[3] = 0x19BA ## - 2 ore
   item[4] = 0x19B7 ## - 1 ore
   
   for i = 1 to 4
      uo.FindType(item[i], '-1', 'Box_for_trash_ore')
      if uo.FindCount('finditem') > 0 then
         uo.Grab('500', 'finditem')
         wait(300)         
         Checklag()
         while not uo.InJournal('You put') or not uo.InJournal('see the target')
            uo.UseObject('finditem')
            wait(100)
         wend
      End if
      Unload_trash_ore()   
   next
Endsub


Top
   
 Post subject:
PostPosted: 2008-02-02 09:45:38 
Offline
Expert!
User avatar

Joined: 2006-02-07 08:51:40
Posts: 1348
Location: г. Старый Оскол
Avel Mink wrote:
И еще не могу понять почему скрипт не зацикливается, то есть берет всего один раз руду, хотя в ящике ее много

Во первых ни в одном скрипте ты не указал ID сундуков, var Box_for_trash_ore и т.д. ?!?!? Инжа не телепат, она не знает что ты имеешь ввиду. :twisted:
И что ты хочешь? Надо прописать ID сундука в котором ищещь. По поводу третьего, вставь цикл repeat until, без него он не будет зацикливаться. Я же тебе кучу подобных скриптов писал, посмотри там. Просто тут столько грамматических ошибок, что если править, то проще написать занова.

Смотри сравнивай, ищи ошипки:
Code:
sub Count_trash_ing() 
   var i, p, name, cen, sum = 0
   
   DIM item[7]
   item[0] = '0x0750' ## - Rusty Ingot
   item[1] = '0x0590' ## - Old Copper Ingot
   item[2] = '0x060A' ## - Dull Copper Ingot
   item[3] = '0x0488' ## - Bronze Ingot
   item[4] = '0x096B' ## - Shadow Ingot
   item[5] = '0x0014' ## - Rose Ingot
   item[6] = '0x0193' ## - Agapite
   
   DIM price[7]
   price[0] = 1 ## - Rusty Ingot
   price[1] = 2 ## - Old Copper Ingot
   price[2] = 3 ## - Dull Copper Ingot
   price[3] = 4 ## - Bronze Ingot
   price[4] = 5 ## - Shadow Ingot
   price[5] = 6 ## - Rose Ingot
   price[6] = 7 ## - Agapite

   UO.AddObject('Box_for_trash_ing')
   repeat
      wait(100)
   until not UO.Targeting()

   UO.UseObject(Box_for_trash_ing)
   wait(1000)
   CheckLag()
   uo.TextPrint('Trash Ore')
   uo.TextPrint(' --------- ')
   for i = 0 to 6
      for p = 0 to 6
         uo.FindType('0x1BEF', item[i], Box_for_trash_ing)
         if uo.FindCount('finditem') > 0 then
            uo.Click('finditem')
            wait(300)
            name = uo.GetName('finditem')
            cen = uo.GetQuantity('finditem') * price[p]
            sum = sum + cen
            uo.TextPrint(name + ' ------ ' + str(cen) + 'k (' + str(price[p]) + 'k per piece)')
            uo.Ignore('finditem')
            uo.FindType('0x1BEF', item[i], Box_for_trash_ing)
         End if
         wait(100)
      next
   next
   uo.TextPrint(' --------- ')
   uo.TextPrint('Total Amount: ' + str(sum) + 'k')
   uo.TextPrint(' =========================================== ')
   uo.IgnoreReset()
Endsub

###################################

sub Count_other_ing()
   var i, p, name, cen, sum = 0
   
   DIM item[4]
   item[0] = '0x1BEF' ## - Iron Ingot
   item[1] = '0x1BE3' ## - Copper Ingot
   item[2] = '0x1BF5' ## - Silver Ingot
   item[3] = '0x1BE9' ## - Gold Ingot
   
   DIM price[4]
   price[0] = 1 ## - Iron Ingot
   price[1] = 2 ## - Copper Ingot
   price[2] = 3 ## - Silver Ingot
   price[3] = 4 ## - Gold Ingot

   UO.AddObject('Box_for_trash_ing')
   repeat
      wait(100)
   until not UO.Targeting()

   UO.UseObject(Box_for_trash_ing)
   wait(1000)

   for i = 0 to 3
      for p = 0 to 3
         uo.FindType(item[i], '-1', Box_for_trash_ing)
         if uo.FindCount('finditem') > 0 then
            uo.Click('finditem')
            wait(300)
            name = uo.GetName('finditem')
            cen = uo.GetQuantity('finditem') * price[p]
            sum = sum + cen
            uo.TextPrint(name + ' ------ ' + str(cen) + 'k (' + str(price[p]) + 'k per piece)')
            uo.Ignore('finditem')
            uo.FindType(item[i], '-1', Box_for_trash_ing)
         End if
      next
   next
   uo.TextPrint(' --------- ')
   uo.TextPrint('Total Amount: ' + str(sum) + 'k')
   uo.TextPrint(' =========================================== ')
   uo.IgnoreReset()
Endsub

#############################

sub Smelt_trash_ore()
   var i, Exit
   
   DIM item[4]
   item[0] = '0x19B9' ## - 4 ore
   item[1] = '0x19B8' ## - 3 ore
   item[2] = '0x19BA' ## - 2 ore
   item[3] = '0x19B7' ## - 1 ore

   UO.AddObject('Box_for_trash_ing')
   repeat
      wait(100)
   until not UO.Targeting()

   UO.UseObject(Box_for_trash_ing)
   wait(1000)
   
   for i = 0 to 3
      uo.FindType(item[i], '-1', Box_for_trash_ore)
      if uo.FindCount('finditem') > 0 then
         repeat
            uo.Grab('500', 'finditem')
            wait(300)         
            Checklag()
            while not uo.InJournal('You put') or not uo.InJournal('see the target')
               uo.UseObject('finditem')
               wait(100)
            wend
            uo.FindType(item[i], '-1', Box_for_trash_ore)
         until not UO.FindCount()
      End if
      Unload_trash_ore()   
   next
Endsub


Last edited by Kynep on 2008-02-02 21:47:59, edited 1 time in total.

Top
   
 Post subject:
PostPosted: 2008-02-02 20:35:41 
Offline

Joined: 2007-12-30 14:23:05
Posts: 48
Ну я же не настолько дурной, я все эти ящики прописал в Object, так проще, потому что они у меня используются во многих скриптах

Различия между нашими скриптами только в том что ты заключил цвета в ' . Все поправил, теперь работает.

По поводу репеат спасибо, поставил работает, но меня тогда интересует почему нижеприведенный скрипт работает в цикле без репеат ?


Code:
sub Unload_trash_ore()
   var Box_for_trash_ing
   var i
   
   DIM item[4]
   item[1] = 0x1BEF ## - Other Ingot
   item[2] = 0x1BE3 ## - Copper Ingot
   item[3] = 0x1BF5 ## - Silver Ingot
   item[4] = 0x1BE9 ## - Gold Ingot
   
   for i = 1 to 4
      uo.FindType(item[i], '-1')
      if uo.FindCount('finditem') > 0 then
            uo.MoveItem('finditem', '0', 'Box_for_trash_ing')
            wait(300)
            CheckLag()
      End if
   next
Endsub


И напоследок два вопроса, так ли важно заключать типЫ/Цвета/ID в ' (я не знаю как он называется) и в массивах начинать отсчет с 0, а не с 1 ?


Top
   
 Post subject:
PostPosted: 2008-02-02 21:46:16 
Offline
Expert!
User avatar

Joined: 2006-02-07 08:51:40
Posts: 1348
Location: г. Старый Оскол
Avel Mink wrote:
Ну я же не настолько дурной, я все эти ящики прописал в Object, так проще, потому что они у меня используются во многих скриптах

И напоследок два вопроса, так ли важно заключать типЫ/Цвета/ID в ' (я не знаю как он называется) и в массивах начинать отсчет с 0, а не с 1 ?


1) По поводу скрипта, потому что тут идет поиск по типам, 4 типа руды, заметь они все разные, если они есть то действие будет, пока не закончиться.
2) Да, это грамотность, в ' (апостроф) заключаются все текстовые значения. Цифровые записываются без '. Если ты объявил объекты или переменные ранее, то при использовании их в скрипте они пишутся ВСЕГДА без кавычек.
Еще раз повторю:
Code:
VAR text = 'текст, как то типы, ИД, и другие текстовые переменные'
VAR int = 123 # Числовые значения ВСЕГДА пишуться без '

3) Да, это ОБЯЗАТЕЛЬНО, в противном случае будет крашить.


Top
   
 Post subject:
PostPosted: 2008-02-03 13:14:13 
Offline
Expert!
User avatar

Joined: 2004-04-04 21:40:09
Posts: 1007
1)

Var Variable1 = '0x12345678'
UO.UseObject(Variable1)

2)

Var Variable1 = '0x12345678'
UO.AddObject('Object1', Variable1)
UO.UseObject('Object1')


Top
   
 Post subject:
PostPosted: 2008-02-03 14:45:47 
Offline
Expert!

Joined: 2004-04-03 17:36:29
Posts: 2544
Location: Saint-Petersburg
Ну зачем же вводить людей в заблуждение?

Kynep wrote:
2) Да, это грамотность, в ' (апостроф) заключаются все текстовые значения. Цифровые записываются без '. Если ты объявил объекты или переменные ранее, то при использовании их в скрипте они пишутся ВСЕГДА без кавычек.


Если конкретный объект объявлен на вкладке объектов, то в скрипте его имя используется именно в кавычках. Тут автор топика все делал абсолютно правильно.

Quote:
3) Да, это ОБЯЗАТЕЛЬНО, в противном случае будет крашить.


Правильнее фраза должна звучать так: "это совсем не обязательно, но иначе может крешить. Впрочем, крешить может в любом случае".

_________________
Ни один скрипт не работает? Пора обновить Инжект...
Все работает, но хочется большего? Пора переходить на стелс...


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

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 2 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