Таскание стопки за собой

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
Destruction
Junior Expert
Posts: 3221
Joined: 2004-06-24 22:08:56

Таскание стопки за собой

Post by Destruction »

Собственно вводная - есть стопка (допустим 65к бревён) - нужно по-быстрому перетащить всё за собой.

Т.к. стока за раз поднять не получается - нужно перекладывать по-частям, вобщем незнаю как сказать, попробывал реализовать:

Code: Select all

sub ItemFollower()
   var quantity = 5000 ; по скольку предметов за раз перекидывать
   uo.addObject( "moving item" )
   while uo.targeting()
      wait( 100 )
   wend
   var type = uo.getGraphic( "moving item" )
   var colr = uo.getColor( "moving item" )
   var x, y, z
   uo.ignorereset()
   repeat
      x = uo.getX( "moving item" )
      y = uo.getY( "moving item" )
      z = uo.getZ( "moving item" )
      while uo.getX() == x && uo.getY() == y
         wait( 100 )
      wend
      uo.set( 'finddistance', str( getMax( abs( uo.getX() - x ), abs( uo.getY() - y ) ) ) )
      uo.findtype( type, colr, "ground" )
      while uo.findcount()
         if uo.getX( 'finditem' ) == x && uo.getY( 'finditem' ) == y && uo.getZ( 'finditem' ) == z then
            uo.moveitem( 'finditem', str( quantity ), "ground" )
            while uo.getX( 'finditem' ) == x && uo.getY( 'finditem' ) == y && uo.getZ( 'finditem' ) == z
               wait( 100 )
            wend
         endif
         uo.ignore( 'finditem' )
         uo.findtype( type, colr, "ground" )
      wend
      uo.ignorereset()
      uo.set( 'finddistance', '0' )
      uo.findtype( type, colr, "ground" )
      if not uo.findcount() then
         uo.print( "Oops! Item stealed!" )
         return false
      endif
      uo.addObject( "moving item", uo.getSerial( "finditem" ) )
   until false
endsub

Sub getMax( x, y )
   if x > y then
      return x
   endif
   return y
endsub


Диагноз - слишком медленно, есть идеи ?
YokoInjection CodeSweeper
Function not found?
Possession of mathematics at the level of art - a gift that is only available for election.
Sorry for my clumsy English.
Telegram: @tatikom
grundick
Posts: 258
Joined: 2006-11-25 17:44:44

Post by grundick »

А чё он у тебя их за собой волокёт? Ты сделай чтоб по направлению движения вперед перекладывал
Post Reply