Yoko

All sides of Injection
It is currently 2025-12-18 01:44:10

All times are UTC+02:00




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: 2008-03-07 01:53:47 
Offline

Joined: 2007-04-26 23:35:15
Posts: 220
Ссегодня решился таки попробовать пересесть на пинжект :)
Решил я значит написать простенькую ходилку и не получилось.. криво ходит :roll:
Так как с перлом я знаком первый день, может чтото сделал не так?

Code:
sub use
{
  walk (2149,787);
}

sub walk($$)
{
  my($x1, $y1);
  $x1 = $_[1];
  $y2 = $_[2];
  while( (uo::getx()!=$x1) && (uo::gety()!=$y1) )
  {
    $x=uo::getx();
    $y=uo::gety();
    if ($x == $x1 && $y > $y1)
    {
      uo::press(35);
    }   
    if ($x == $x1 && $y < $y1)
    {
      uo::press(33);
    }
    if ($x < $x1 && $y == $y1)
    {
      uo::press(36);
    }
    if ($x < $x1 && $y > $y1)
    {
      uo::press(37);
    }
    if ($x < $x1 && $y < $y1)
    {
      uo::press(38);
    }
    if ($x > $x1 && $y == $y1)
    {
      uo::press(34); 
    }
    if ($x > $x1 && $y > $y1)
    {
      uo::press(40);
    }
    if ($x > $x1 && $y < $y1)
    {
      uo::press(39);
    }
      &wait(50);
  }
}


Top
   
 Post subject:
PostPosted: 2008-03-07 11:34:59 
Offline
Expert!
User avatar

Joined: 2005-05-04 14:05:19
Posts: 2580
Location: Москва
а в чем кривость хождения?


Top
   
 Post subject:
PostPosted: 2008-03-07 11:46:11 
Offline

Joined: 2007-04-26 23:35:15
Posts: 220
ввожу например координаты на 5 тайлов от себя, а идет вообще очень очень очень далеко хз куда, и даже если чудом пройдет по нужной координате все равно идет дальше дальше...


Top
   
 Post subject:
PostPosted: 2008-03-07 11:51:53 
Offline
Expert!
User avatar

Joined: 2005-05-04 14:05:19
Posts: 2580
Location: Москва
ну значит ты не правельно клавиши раставил:)
да и самый простой способ дебага это принтить твое условие...


Top
   
 Post subject:
PostPosted: 2008-03-07 12:01:03 
Offline

Joined: 2007-04-26 23:35:15
Posts: 220
поидее понял, проблема в куске
Code:
  my($x1, $y1); 
  $x1 = $_[1];
  $y2 = $_[2];

так он не видет координаты х
Code:
 my($x1, $y1); 
  $x1 = $_[0];
  $y2 = $_[1];

а так не виде у.
чего делать?


Top
   
 Post subject:
PostPosted: 2008-03-07 12:29:38 
Offline
Expert!
User avatar

Joined: 2005-05-04 14:05:19
Posts: 2580
Location: Москва
Code:
sub use 
{
  walk (2149,787);
}

sub walk($$)
{
  my($x1, $y1);
  $x1 = $_[1];
  $y1 = $_[2]; //!!!!
  while( (uo::getx()!=$x1) && (uo::gety()!=$y1) )
  {
    $x=uo::getx();
    $y=uo::gety();
    if ($x == $x1 && $y > $y1)
    {
      uo::press(35);
    }   
    if ($x == $x1 && $y < $y1)
    {
      uo::press(33);
    }
    if ($x < $x1 && $y == $y1)
    {
      uo::press(36);
    }
    if ($x < $x1 && $y > $y1)
    {
      uo::press(37);
    }
    if ($x < $x1 && $y < $y1)
    {
      uo::press(38);
    }
    if ($x > $x1 && $y == $y1)
    {
      uo::press(34); 
    }
    if ($x > $x1 && $y > $y1)
    {
      uo::press(40);
    }
    if ($x > $x1 && $y < $y1)
    {
      uo::press(39);
    }
      &wait(50);
  }
}

Никому больше таких ошибок не делать!

+ еще куча ошибок...


Top
   
 Post subject:
PostPosted: 2008-03-07 18:11:43 
Offline

Joined: 2007-04-26 23:35:15
Posts: 220
Да совместными усилиями сделали :D
спасибо Грину ;)


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 6 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