Yoko

All sides of Injection
It is currently 2026-08-05 07:28:56

All times are UTC+02:00




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 2011-12-05 04:01:26 
Offline

Joined: 2009-01-19 20:54:37
Posts: 5
Уважаемые,

Нужна помощь в написании скрипта для вора.
Суть: снупится вражий бэкпак, потом запускается скрипт, находит в бэкпаке контейнеры (backpack, sack, pouch итд) и открывает их все подряд даблкликом, включая контейнеры которые есть внутри этих контейнеров
вопросы:
1) как реализовать поиск объектов по типу в последнем открытом паке?
2) как реализовать поиск объектов в найденном в предыдущем пункте паке? проблема в том, что могут быть инклюдные паки пустые или полные, и тогда, по сути, при открытии пустого пака скрипт может тормознуться, т.к. в нём инклюдов нет, в этом случае хотелось бы чтобы он возвращался в предыдущий по списку не открытый пак
3) есть ли возможность отслеживать на программном уровне открыт пак или нет?

заранее спасибо за ответы и надеюсь на вашу помощь :)


Top
   
PostPosted: 2011-12-05 05:29:52 
Offline
User avatar

Joined: 2006-12-08 10:51:50
Posts: 718
Location: Москва
1 и 2 Пример рекурсии
Code:
sub LootGround()
  UO.Set('finddistance', '2')
  LootContainer('ground')
  UO.Set('finddistance', '12')
Endsub

sub LootWithoutCut()
  var i, id_Corpse, t_Corpse = '0x2006', t_Dagger = '0x0F51'
  UO.Set('finddistance', '2')
  UO.FindType(t_Corpse, -1, 'ground')
  If UO.FindCount() then
    id_Corpse = UO.GetSerial('finditem')
    LootContainer(id_Corpse)
    Wait(100)
   else
    UO.Print('Нет трупа')
  Endif
  UO.Set('finddistance', '12')
Endsub

sub LootWithCut()
  var i, id_Corpse, t_Corpse = '0x2006', t_Dagger = '0x0F51'
  UO.SetArm('Weapon')
  UO.Set('finddistance', '1')
  UO.FindType(t_Corpse, -1, 'ground')
  If UO.FindCount() then
    id_Corpse = UO.GetSerial('finditem')
    UO.WaitTargetObject(id_Corpse)
    UO.UseType(t_Dagger)
    Wait(100)
    UO.Arm('Weapon')
    LootContainer(id_Corpse)
   else
    UO.Print('Нет трупа')
  Endif
  UO.Set('finddistance', '12')
Endsub

Sub LootContainer(id)
  var id_ReagentsBag = '0x40004762', id_SpecialRegsBag = '0x4000BF80', id_OtherBag = '0x40004767', id_RecContainer, Pause = 1100, t_Scissors = '0x0F9E', i, j
  Dim t_Items[4]
    t_Items[0] = '0x1078 0x0EED 0x0F3F 0x1BFB ' ; Это кладём в пак, включая шкуры
    t_Items[1] = '0x0F88 0x0F7A 0x0F86 0x0F8C 0x0F8D 0x0F85 0x0F84 0x0F7B ' ; Это в мешок с регами
    t_Items[2] = '0x0FAB 0x0F0F 0x0F10 0x0F11 0x0F13 0x0F15 0x0F16 0x0F18 0x0F25 0x0F26 0x14EB 0x0E34 0x1BD1 ' ; Это в мешок для всякой всячины
    t_Items[3] = '0x0F87 0x0F90 0x0F82 0x0F81 0x0F8E 0x0F78 0x0F80 0x0F7E 0x0F91 ' ; Это в мешок для некрорегов и костей
    t_Items[4] = '0x09AB 0x0E7C 0x0E40 0x0E41 0x0E42 0x0E43 0x0E75 0x0E76 ' ; Это типы сундуков мешков паков и проч.
  UO.UseObject(id)
  Wait(500)
  For i = 0 to 3
    For j = 1 to GetWordAmount(t_Items[i], ' ')
      Repeat
        UO.FindType(GetWord(t_Items[i], j, ' '), -1, id)
        If UO.FindCount() then
          If i == 0 then
            id_RecContainer = UO.GetSerial('backpack')
          Endif
          If i == 1 then
            id_RecContainer = id_ReagentsBag
          Endif
          If i == 2 then
            id_RecContainer = id_OtherBag
          Endif
          If i == 3 then
            id_RecContainer = id_SpecialRegsBag
          Endif
          UO.MoveItem('finditem', -1, id_RecContainer)
          Wait(Pause)
          If i == 0 and j == 1 then
            UO.FindType(GetWord(t_Items[i], j, ' '), -1, 'backpack')
            If UO.FindCOunt() then
              UO.WaitTargetObject('finditem')
              UO.UseType(t_Scissors)
              Wait(100)
             else
              UO.Print('Странно... Надо увеличить задержку =)')
            Endif
          Endif
        Endif
      Until not UO.FindCount()
    Next
  Next
  For j = 1 to GetWordAmount(t_Items[4], ' ')
    Repeat
      UO.FindType(GetWord(t_Items[4], j, ' '), -1, id)
      If UO.FindCount() then
        LootContainer(UO.GetSerial('finditem'))
       else
        Wait(100)
      Endif
    Until not UO.FindCount()
  Next
  UO.Ignore(id)
Endsub


3)
Code:
Sub ContainerCheck(id)
  UO.UseObject(id)
  Wait(100)
  If UO.GetSerial('lastcontainer') == id then
    Return 1
  Endif
  Return 0
Endsub


Top
   
PostPosted: 2011-12-05 18:14:44 
Offline

Joined: 2009-01-19 20:54:37
Posts: 5
Спасибо, но не совсем понял как можно реализовать такой механизм:
открыл пак- нашёл в нём допустим 3 пака( а,б и в)- открыл пак а, он пустой- вернулся в главный пак-- открыл пак б-- в паке б есть 3 пака б1,б2 и б3---открыл б1, пустой-- вернулся в б, открыл б2-пустой--вернулся в б3-открыл б3-пустой---вернулся в главный, открыл в, в нём в1 и в2--- открыл в1, в нём в1.1 и в1.2 ну и т.д.

как задать плавующее значение переменной количества паков (заранее неизвестно сколько паков всего будет) и как возвращаться к предыдущим? задавать им id?


Top
   
PostPosted: 2011-12-05 20:23:35 
Offline
User avatar

Joined: 2009-05-28 09:58:28
Posts: 2802
Location: Иваново
сори оффтоп но пипец смелый и удачливый вор такой :wink:

_________________
Image
YokoInjection CodeSweeper
Ошибка "Unhandled exception in parser"
Стрелялка для олдов.


Top
   
PostPosted: 2011-12-06 06:42:26 
Offline
User avatar

Joined: 2006-12-08 10:51:50
Posts: 718
Location: Москва
Этот кусок ищет контейнеры по типу, если нашла, запускает сама себя на лут найденого контейнера, ищет контейнеры в нём и тд пока не закончатся контейнеры
Code:
  For j = 1 to GetWordAmount(t_Items[4], ' ')
    Repeat
      UO.FindType(GetWord(t_Items[4], j, ' '), -1, id)
      If UO.FindCount() then
        LootContainer(UO.GetSerial('finditem'))
       else
        Wait(100)
      Endif
    Until not UO.FindCount()
  Next
  UO.Ignore(id)


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

All times are UTC+02:00


Who is online

Users browsing this forum: No registered users and 13 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:  
cron
Powered by phpBB® Forum Software © phpBB Limited