Yoko

All sides of Injection
It is currently 2025-10-24 23:31:32

All times are UTC+02:00




Post new topic  Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 2007-09-16 07:36:57 
Offline
Junior Expert
User avatar

Joined: 2004-06-24 22:08:56
Posts: 3220
Собственно вводная - есть стопка (допустим 65к бревён) - нужно по-быстрому перетащить всё за собой.

Т.к. стока за раз поднять не получается - нужно перекладывать по-частям, вобщем незнаю как сказать, попробывал реализовать:
Code:
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.
Skype: d119060


Top
   
 Post subject:
PostPosted: 2007-10-05 15:30:19 
Offline

Joined: 2006-11-25 17:44:44
Posts: 258
А чё он у тебя их за собой волокёт? Ты сделай чтоб по направлению движения вперед перекладывал


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

All times are UTC+02:00


Who is online

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