Yoko

All sides of Injection
It is currently 2025-10-28 01:22:28

All times are UTC+02:00




Post new topic  Reply to topic  [ 589 posts ]  Go to page Previous 114 15 16 17 1830 Next
Author Message
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-16 19:25:30 
Offline

Joined: 2011-06-11 19:54:23
Posts: 820
1403.16

Список изменений:
    - Добавлен параметр StartTime в функцию uo.WaitingForJournalText(StartTime,MaxDelay,Text,[Equals],[IgnoreCase],[SkillName/ObjectID])
    - Добавлены функции uo.GetFoundedText() и uo.GetFoundedTextID()
    uo.GetFoundedText() - служит для получения текстовой строки, в которой был найден искомый текст от всех поисковых функций журнала
    uo.GetFoundedTextID() - индекс искомого текста
    - Добавлена опция запуска инжекта /lowcpu или /lowcpu:<value> для включения снижения нагрузки на процессор. Не желательно ставить больше пяти /lowcpu:5
    - Исправлена дистанция поиска в uo.Findtype и uo.FindList
    - Поиск с использованием uo.FindList теперь производится по-порядку, как добавляли в лист типы
    - Поисковые функции при поиске объектов на земле теперь всегда возвращают самый ближайший к игроку объект (если такой был найден и исключая Nearest=1)
    - На вкладку скриптов добавлен чекбокс "Go to last line on load/show script", в включенном состоянии при открытии редактора скриптов каретка устанавливается на ту строку, где она была при закрытии редактора в последний раз
    - Исправлено несколько незначительных багов в Script.dll
    - Исправлен краш при вводе трех кавычек подряд в редакторе скриптов
    - Добавлены операторы continue; break; switch->case->end switch о них ниже
    - Исправлен (скорее всего) краш при удалении/обновлении предметов
    - В Script.dll добавлены функции:
    Pos(Source,SearchText) - поиск текста SearchText в строке Source, при удачном поиске возвращает позицию в строке, при неудаче 0
    GetWord(Source,WordIndex,[Separator]) - получение слова из строки Source под номером WordIndex разделенного пробелом (или Separator'ом, если он указан)
    GetWordCount(Source,[Separator]) - получение общего кол-ва слов, содержащихся в строке Source разделенных пробелом (или Separator'ом, если он указан)
    - Добавлена функция ReceiveObjectName(Serial,[MaxDelay]) для получения имени объекта. MaxDelay - время в мс за которое должно прийти имя от сервера (старндартно 1000). Актуально использовать взамен CheckLag()
    - Теперь опции препарсера досвечиваются синим цветом. Начал подсвечиваться endsub (слитный)

Оператор switch->case->end switch работает так же, как описано по ссылке, только без default: и не много другое объявление.
Code:
switch <Condition> / switch:<Condition>
case <Condition> /case:<Condition>
end switch / endswitch
Объявление любым из вышеперечисленных способов.
Пример использования:
Code:
Sub GetCodeByGraphic(Graphic)
   switch:Graphic
      case:'0x0190'
      case:'0x0191'
         uo.print('this is human!')
         return 1
      case:'0x2006'
         uo.print('this is corpse!')
         return 2
      case:'0x0414'
      case:'0x0146'
      case:'0x0394'
      case:'0x0681'
         uo.print('what is it?!?!?')
         return 3
   end switch
   return 0
end sub
Этот скрипт будет аналогичен следующему (собственно в него и конвертируется):
Code:
Sub GetCodeByGraphic(Graphic)
   if Graphic=='0x0190' or Graphic=='0x0191' then
      uo.print('this is human!')
      return 1
   else
      if Graphic=='0x2006' then
         uo.print('this is corpse!')
         return 2
      else
         if Graphic=='0x0414' or Graphic=='0x0146' or Graphic=='0x0394' or Graphic=='0x0681' then
            uo.print('what is it?!?!?')
            return 3
         endif
      endif
   endif
   return 0
end sub


Оператор break - немедленно выходит из цикла (или из блока switch), в котором объявлен с сохранением всех переменных (существенно для цикла for)
Оператор continue - прерывает выполнение текущей итерации цикла и переходит на следующую (если это предусмотрено в рамках цикла)

Пример (по сути бесполезен, но если запустить будет видно где срабатывают continue и break):
Code:
sub test_new_operators()
   var i,test1=5,test2=7,test3=23,test_bool=1,test4=1
   if test_bool then
      for i=test4 to test3
         switch i
            uo.print('switch i')
            case test1
               uo.print('case test1')
               while i>=test2-2 && i<=test3-3
                  i=i+1
                  if i==test3-6 then
                     uo.print('continue from while')
                     continue
                  endif
                  uo.print('i='+str(i))
                  wait(100)
                  if i==test3-5 then
                     i=test4+test2
                     uo.print('break from while')
                     break
                  endif
               wend
               uo.print('end of while')
            case test4+test2+1
               uo.print('test4+test2+1')
               repeat
                  i=i+1
                  if i==test4+10 then
                     uo.print('continue from until')
                     continue
                  endif
                  uo.print('i='+str(i))
                  wait(100)
                  if i==test4+14 then
                     uo.print('break from until')
                     break
                  endif
               until i>=test3-6
               uo.print('end of until')
         end switch
         if i==test3-4 then
            i=13
            break
         endif
      next
      uo.print('end of for with i='+str(i))
   endif
end sub

Вот во что превратится такой скрипт:
Code:
sub test_new_operators()
   var BreakPointerVariable_2=0,BreakPointerVariable_3=0,BreakPointerVariable_0=0
   var i,test1=5,test2=7,test3=23,test_bool=1,test4=1
   if test_bool then
      for i=test4 to test3
         uo.print('switch i')
         if i==test1 then
            uo.print('case test1')
            BreakPointerVariable_2=0
            while BreakPointerVariable_2==0 and (i>=test2-2 && i<=test3-3)
               i=i+1
               if i==test3-6 then
                  uo.print('continue from while')
                  goto loc_continue_2
               endif
               uo.print('i='+str(i))
               wait(100)
               if i==test3-5 then
                  i=test4+test2
                  uo.print('break from while')
                  BreakPointerVariable_2=1
                  goto loc_continue_2
               endif
               loc_continue_2:
            wend
            uo.print('end of while')
         else
            if i==test4+test2+1 then
               uo.print('test4+test2+1')
               repeat
                  BreakPointerVariable_3=0
                  i=i+1
                  if i==test4+10 then
                     uo.print('continue from until')
                     goto loc_continue_3
                  endif
                  uo.print('i='+str(i))
                  wait(100)
                  if i==test4+14 then
                     uo.print('break from until')
                     BreakPointerVariable_3=1
                     goto loc_continue_3
                  endif
                  loc_continue_3:
               until BreakPointerVariable_3==1 or (i>=test3-6)
               uo.print('end of until')
            endif
         endif
         if i==test3-4 then
            i=13
            BreakPointerVariable_0=i
            i=test3
            goto loc_continue_0
         endif
         BreakPointerVariable_0=i
         loc_continue_0:
      next
      i=BreakPointerVariable_0
      uo.print('end of for with i='+str(i))
   endif
end sub


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-16 21:32:55 
Offline
User avatar

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

if Graphic=='0x0414' or Graphic=='0x0146' or Graphic=='0x0394' or Graphic=='0x0681' then
типов в 20-30 не работала.

в case: сколько можно загнать строк?

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


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-16 21:44:13 
Offline

Joined: 2011-06-11 19:54:23
Posts: 820
Mirage wrote:
когда на старой версии делал сортировку металлических предметов такая конструкция

if Graphic=='0x0414' or Graphic=='0x0146' or Graphic=='0x0394' or Graphic=='0x0681' then
типов в 20-30 не работала.

в case: сколько можно загнать строк?

Если что-то не будет работать - фрагмент скрипта в личку, разберусь)

Всмысле сколько загнать строк?
Условие вычисляется таким образом:
Code:
switch SwitchCondition
case Case1Condition
case Case2Condition
case Case3Condition
end switch

SwitchCondition сохраняется в буффере при обработке скрипта (до его выполнения), попадая на case, если SwitchCondition сохранено то создается условие:
if SwitchCondition==Case1Condition then
Если case следуют один за другим (как в варианте выше) то условие конструируется такое:
if SwitchCondition==Case1Condition or SwitchCondition==Case2Condition or SwitchCondition==Case3Condition then
Но если между case есть пустые строки или какой-либо текст, то будут сконструированы несколько условий.
Кол-во строк с case неограничено, но если общая длина получившейся строки будет превышать 1024 символа (вроде бы столько) то скрипт может выдать ошибку.


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-16 23:26:47 
Offline
User avatar

Joined: 2012-12-22 19:14:29
Posts: 125
Code:
Sub searchTree()
   var i, x, y, t, stp, max_search = 50 ; ìàêñèìàëüíàÿ äèñòàíöèÿ äëÿ ãåíåðàöèè êîîðäèíàò.
   var cx = uo.getX()
   var cy = uo.getY()
   for i = 1 to max_search
      for x =-i to i
         stp = 1
         if not i == abs( x ) then
            stp = abs( i ) * 2
         endif
         for y = -i to i step stp
            if NOT uo.getGlobal( 't:' + str( x + cx ) + "," + str( y + cy ) ) == "empty" then
               t = IsTreeTile( x + cx, y + cy )
               if not t == false then
                  uo.setGlobal( "tree_x", str( x + cx ) )
                  uo.setGlobal( "tree_y", str( y + cy ) )
                  uo.setGlobal( "tree_t", str( t ) )
                  return false
               else
                  uo.setGlobal( 't:' + str( x + cx ) + "," + str( y + cy ), 'empty' )
               endif
            endif
         next
      next
   next
   uo.print( "Found no tree, exit." )
   uo.exec( "terminate autoLumber" )
   return false
endsub


В новой версии parser вылетает.


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-16 23:43:46 
Offline

Joined: 2011-05-23 00:33:30
Posts: 949
Ты хоть бы строку указал на какой парсер. Этот кусочек скрипта ничего не даст.

_________________
CodeSweeper


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-16 23:49:32 
Offline
User avatar

Joined: 2012-12-22 19:14:29
Posts: 125
Incorrect User wrote:
Ты хоть бы строку указал на какой парсер. Этот кусочек скрипта ничего не даст.


да если бы я знал просто вылетает "Unhandled exception in parser"
когда именно эту часть запускаю

Code:
#Lumbjacking с автопоиском деревий (c) Destruction, v1.0
var hatchet = "0x0F39"
Sub searchTree()
   var i, x, y, t, stp, max_search = 50 ; максимальная дистанция для генерации координат.
   var cx = uo.getX()
   var cy = uo.getY()
   for i = 1 to max_search
      for x =-i to i
         stp = 1
         if not i == abs( x ) then
            stp = abs( i ) * 2
         endif
         for y = -i to i step stp
            if NOT uo.getGlobal( 't:' + str( x + cx ) + "," + str( y + cy ) ) == "empty" then
               t = IsTreeTile( x + cx, y + cy )
               if not t == false then
                  uo.setGlobal( "tree_x", str( x + cx ) )
                  uo.setGlobal( "tree_y", str( y + cy ) )
                  uo.setGlobal( "tree_t", str( t ) )
                  return false
               else
                  uo.setGlobal( 't:' + str( x + cx ) + "," + str( y + cy ), 'empty' )
               endif
            endif
         next
      next
   next
   uo.print( "Found no tree, exit." )
   uo.exec( "terminate autoLumber" )
   return false
endsub

sub autoLumber()
   repeat
      searchTree()
      doMineTree()
   until UO.Dead()
endsub

Sub doMineTree()
   var x, y, t
   var end = "осталось|рубить|nothing here|reach this"
   var try = "You put|fail"
   repeat
      x = val( uo.getGlobal( "tree_x" ) )
      wait(250)
      y = val( uo.getGlobal( "tree_y" ) )
      wait(250)
      t = val( uo.getGlobal( "tree_t" ) )
      wait(250)
      uo.setGlobal( 't:' + str( x ) + "," + str( y ), "empty" )
      wait(250)
      Walker( x, y, 1 )
      wait(250)
      uo.exec( "exec searchTree" )
      wait(250)
      repeat
         if uo.waiting() then
            wait(250)   
            uo.canceltarget()
            wait(250)
         endif
         deljournal( try + "|" + end )
         wait(250)
         uo.waittargettile( str( t ), str( x ), str( y ), str( uo.getZ() ) )
         wait(250)
         uo.usetype( hatchet )
         wait(250)
         repeat
            wait(250)
         until uo.injournal( try + "|" + end )
         wait(250)
      until uo.injournal( end )
      wait(250)
      while uo.getGlobal( "tree_x" ) == str( x ) && uo.getGlobal( "tree_y" ) == str( y )
         wait(250)
      wend
   until false
endsub

Sub deljournal( msg )
   while uo.injournal( msg )
      uo.setjournalline( uo.injournal( msg ) -1, '' )
   wend
endsub

Sub IsTreeTile( x, y )
   var i, tree_count = 20
   DIM tree[ val( str( tree_count ) ) ]
   tree[0] = 6000
   tree[1] = 6001
   tree[2] = 6002
   tree[3] = 6003
   tree[4] = 6004
   tree[5] = 6005
   tree[6] = 6006
   tree[7] = 6007
   tree[8] = 6008
   tree[9] = 6009
   tree[10] = 6010
   tree[11] = 6011
   tree[12] = 6012
   tree[13] = 6013
   tree[14] = 6014
   tree[15] = 6015
   tree[16] = 6016
   tree[17] = 6017
   tree[18] = 6018
   tree[19] = 6019
   for i = 0 to tree_count -1
      if uo.privategettile( x, y, -1, tree[i], tree[i] ) then
         return tree[i]
      endif
   next
   return false
endsub


вот весь скрипт, он ещё иногда ругаеться на вот эту строку
Code:
uo.usetype( hatchet )


Я сделал
Code:
uo.usetype( 'hatchet' )

не помогло(


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-16 23:51:49 
Offline

Joined: 2011-05-23 00:33:30
Posts: 949
Задержки в циклы добавь и всё.

_________________
CodeSweeper


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-16 23:53:00 
Offline

Joined: 2011-05-23 00:33:30
Posts: 949
uo.usetype( 'hatchet' ) так не надо делать, а ругается потому что это глюки самого инжекта, лучше пиши uo.usetype("0x0F39") и ругаться не будет.

_________________
CodeSweeper


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-16 23:55:35 
Offline
User avatar

Joined: 2012-12-22 19:14:29
Posts: 125
Incorrect User wrote:
uo.usetype( 'hatchet' ) так не надо делать, а ругается потому что это глюки самого инжекта, лучше пиши uo.usetype("0x0F39") и ругаться не будет.

ясн, а где именно задержки ставить?


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-17 00:06:53 
Offline

Joined: 2011-05-23 00:33:30
Posts: 949
Скрипт запускается через autoLumber() если что. А парсер возможно не из за задержек, попробуй замени
Code:
uo.privategettile( x, y, -1, tree[i], tree[i] )
на
Code:
uo.privategettile( x, y, 1, tree[i], tree[i] )

_________________
CodeSweeper


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-17 00:11:46 
Offline
User avatar

Joined: 2012-12-22 19:14:29
Posts: 125
Incorrect User wrote:
Скрипт запускается через autoLumber() если что. А парсер возможно не из за задержек, попробуй замени
Code:
uo.privategettile( x, y, -1, tree[i], tree[i] )
на
Code:
uo.privategettile( x, y, 1, tree[i], tree[i] )

не помогло(


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-17 00:20:27 
Offline

Joined: 2011-05-23 00:33:30
Posts: 949
Code:
   for i = 0 to tree_count -1
      if uo.privategettile( x, y, -1, tree[i], tree[i] ) then
         return tree[i]
      endif
   next

Перед next поставь wait(100)

_________________
CodeSweeper


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-17 00:26:44 
Offline
User avatar

Joined: 2012-12-22 19:14:29
Posts: 125
Incorrect User wrote:
Code:
   for i = 0 to tree_count -1
      if uo.privategettile( x, y, -1, tree[i], tree[i] ) then
         return tree[i]
      endif
   next

Перед next поставь wait(100)


тоже не помогло(


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-17 00:35:01 
Offline

Joined: 2011-05-23 00:33:30
Posts: 949
Кстати скрипт то нужно переписать с нуля, уже есть больше возможностей. Еще это
Code:
                  uo.setGlobal( 't:' + str( x + cx ) + "," + str( y + cy ), 'empty' )
               endif
            endif
         next
      next
   next

замени на
Code:
                 uo.setGlobal( 't:' + str( x + cx ) + "," + str( y + cy ), 'empty' )
               endif
            endif
           wait(100)
         next
      next
   next

_________________
CodeSweeper


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-17 00:39:31 
Offline

Joined: 2011-05-23 00:33:30
Posts: 949
И замени
Code:
               t = IsTreeTile( x + cx, y + cy )
               if not t == false then

на
Code:
t = uo.IsTreeTile( x + cx, y + cy )
               if not t == "" then

_________________
CodeSweeper


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-17 00:42:57 
Offline
User avatar

Joined: 2012-12-22 19:14:29
Posts: 125
Incorrect User wrote:
Кстати скрипт то нужно переписать с нуля, уже есть больше возможностей. Еще это
Code:
                  uo.setGlobal( 't:' + str( x + cx ) + "," + str( y + cy ), 'empty' )
               endif
            endif
         next
      next
   next

замени на
Code:
                 uo.setGlobal( 't:' + str( x + cx ) + "," + str( y + cy ), 'empty' )
               endif
            endif
           wait(100)
         next
      next
   next


ну вообщем тоже не помогло это(((

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


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-17 00:45:01 
Offline

Joined: 2011-05-23 00:33:30
Posts: 949
Нашли, проблема не в скрипте, можешь оставить изначальный вариант. Пока откатись на предыдущую версию инжекта.

_________________
CodeSweeper


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-17 00:49:06 
Offline
User avatar

Joined: 2012-12-22 19:14:29
Posts: 125
Incorrect User wrote:
Нашли, проблема не в скрипте, можешь оставить изначальный вариант. Пока откатись на предыдущую версию инжекта.


хорошо жду обновлений тогда пока..


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-17 00:55:58 
Offline

Joined: 2011-06-11 19:54:23
Posts: 820
Перезалил ссылку.
Проблемма была в определении карты, пока что поставил загрузку только из map0.mul (и прочих подобных мулов)
К сл. релизу разберусь.


Top
   
 Post subject: Re: Injection 2014 !
PostPosted: 2014-03-17 03:04:25 
Offline
User avatar

Joined: 2012-12-22 19:14:29
Posts: 125
кстати будет поддерживать новый клиент 7.0.34.15?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 589 posts ]  Go to page Previous 114 15 16 17 1830 Next

All times are UTC+02:00


Who is online

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