Примеры готовых скриптов на Perl

Anything and all.

Moderators: Murderator+, Murderator

Post Reply
admir
Posts: 528
Joined: 2005-01-13 07:20:54

Примеры готовых скриптов на Perl

Post by admir »

Авто рубка. (Оском)
ПРавим ручками 2 строчки с сообщением и возможно ТИП топора

Code: Select all

sub lamber {
  while (true) {
   $x=uo::getx();
   $y=uo::gety();
   $z=uo::getz();
   #$item="0x0F43";#topor
   $item="0x0F51";#nog
   #@tree=(3293, 3296, 3286, 3288, 3290, 3299);
   @tree=(0x0c95,0x0c96,0x0cca,0x0ccb,0x0ccc,0x0ccd,0x0cd0,0x0cd3,0x0cd6,0x0cd8,0x0cd9,0x0cda,0x0cdb,0x0cdc,0x0cdd,0x0cde,0x0cdf,0x0ce0,0x0ce3,0x0ce6,0x0cf8,0x0cfb,0x0cfe,0x0d01,0x0d41,0x0d42,0x0d43,0x0d44,0x0d57,0x0d58,0x0d59,0x0d5a,0x0d5b,0x0d6e,0x0d6f,0x0d70,0x0d71,0x0d72,0x0d84,0x0d85,0x0d86);
   for($i=$x;$i<=$x+20;$i++){
      for($j=$y-20;$j<=$y+20;$j++){
         for ($m=0;$m<41;$m++){
    #foreach (@tree) {
            if (uo::privategettile($i, $j, 0, $tree[$m], $tree[$m])>0){
      uo::deletejournal();
               if (&pathfind($i-uo::getx(),$j-uo::gety())!=0){
        $checktime=uo::time();
        $xnow=uo::getx();
          $ynow=uo::gety();
        $check1=0;
                  while (((abs(uo::getx()-$i)>1) || (abs(uo::gety()-$j)>1)) && ($check1<2)){
           if (($checktime+1)<uo::time()){
         $checktime=uo::time();   
            if (($xnow==uo::getx()) && ($ynow==uo::gety())){
            &pathfind($i-uo::getx(),$j-uo::gety());
            $check1++;
            }
              $xnow=uo::getx();
                $ynow=uo::gety();
            }
                     &wait(100);
                  }
        uo::deletejournal();
        while ((uo::injournal("There is nothing|You can\'t|You stop|You cant|There is no wood")==0)&& ($check1<1)){
                    uo::waittargettile($tree[$m], $i, $j, $z);
                    uo::deletejournal();
                    uo::usetype($item);
          while (uo::injournal("not enough|You put|Подолбив|There is nothing|You can\'t|You stop|You cant|There is no wood")==0){
         &wait(100);
          }
                  }
               }   
            }
         }
      }
   }
  }
}


Какято древяя система антимакроса на оскоме

Code: Select all

sub decode{
my($pos, $line, $sx, $sy, $code, $currx, $curry, $sum);
$line=5;
@num=(6, 35, 45, -24, 34, -5, 26, 4, -6);
   while (length($code)<4){
      @words=split(/ /, uo::lastgump("command",$line), 4);
      #uo::print(@words);
      &wait(100);
      if ($pos>=17){
         if ($pos==17){
            $sum=($currx-$sx)*10+($curry-$sy);
            for($i=0; $i<9; $i++){
               if ($numsum==$num[$i]){
                  $code.=$i+1;
                  last;
               }
            }
         }
         if ($words[1]-$currx>5){
            $pos=0;
         }
      }
      if (!$pos){
         $sx=$words[1];
         $sy=$words[2];
         $pos=15;
         $line+=15;
      }
      $currx=$words[1];
      $curry=$words[2];
      $pos++;
      $line++;
   }
   uo::msg($code);
   return $code;
}


sub AAmacro{
   while (uo::dead()==0){
      if (uo::lastgump('text',0) == 'enter anti macro code:' and uo::lastgump('replyed') == 0) {
         uo::lclick(uo::lastgump('x')+75, uo::lastgump('y')+69);
         &wait(300);
         uo::say(&decode());
         &wait(300);
         uo::lclick(uo::lastgump('x')+77, uo::lastgump('y')+108);
       }
      &wait(1000);
   }
}

sub saydecode{
uo::msg(&decode());
}



Ловля РЫБЫ

Code: Select all

sub fishing{

my($mx, $my, $mz, $i, $j);

$mx = uo::getx('self');

$my = uo::gety('self');

$mz = uo::getz('self'); 

uo::deletejournal()  ;
while (1) {

for $i(-6..6){

for $j(-6..6){

 # while (!uo::hidden()){

 # uo::warmode("0");

 # uo::print("hiding...");

 # uo::useskill("Hiding");

#  &wait(4000);

#  }

uo::print("Now Fishing In: $i $j");

  while (!uo::injournal('no fish here') && !uo::injournal('far away')  && !uo::injournal('in water') && !uo::injournal('Try fishing') && !uo::injournal('You stop fishing')){

  uo::deletejournal();

  uo::waittargettile('1341',$mx+$i, $my+$j,$mz);

  uo::usetype("0x0DBF");

    while (!uo::injournal('You pull') && !uo::injournal('location') && !uo::injournal('no fish') && !uo::injournal('You fail') && !uo::injournal('far away') && !uo::injournal('in water') && !uo::injournal('Try fishing') && !uo::injournal('You put')&& !uo::injournal('You stop fishing')){ 

    &wait (100);

      if (uo::injournal('You pull')) {

      uo::findtype('0x09CC','0x0000','ground');

      uo::grab ('3','finditem');

      &wait (200);

      uo::findtype('0x09CD','0x0000','ground');

      uo::grab ('3','finditem');

      &wait (200);

      uo::findtype('0x09CE','0x0000','ground');

      uo::grab ('3','finditem');

      &wait (200);

      uo::findtype('0x09CF','0x0000','ground');

      uo::grab ('3','finditem');

      &wait (200);

      uo::findtype('0x0E2D','0x07A0','ground');

      uo::grab ('1','finditem');

      }

    }

 }

uo::deletejournal();

}

}
}

}


ПРодажа рыбы

Code: Select all

sub sellfish{
@fish=(0x09CE,0x09CC,0x09CD,0x09CF);
  foreach(@fish){
    uo::findtype($_,0);
      if (uo::findcount()) {
   uo::waittargettype($_);
   uo::msg("sell");
   uo::recall('0x00000001','1');
      }
      &wait(500);
  }
}


ЕЩе какая то рубка и копка

Code: Select all

sub mining {
  while (true) {
   $x=&uo("getx");
   $y=&uo("gety");
   $z=&uo("getz");
   @tree=(1339,1341,1342,1348,1349,1350,1351,1352,1353,1354,1355,1357,1358,1359,1363,1386,2272,2273,2275,2276,2277,2278,2279,2281,2282);
   for($i=$x-10;$i<=$x+10;$i++){
      for($j=$y-10;$j<=$y+10;$j++){
         for ($m=0;$m<25;$m++){
            if (&uo("privategettile", $i, $j, 0, $tree[$m], $tree[$m])>0){
      &uo("deletejournal");
      if (&pathfind($i, $j)!=0){
        $checktime=&uo("time");
        $xnow=&uo("getx");
          $ynow=&uo("gety");
        $check1=0;
                  while (((abs(&uo("getx")-$i)>1) || (abs(&uo("gety")-$j)>2)) && ($check1<2)){
           if (($checktime+1)<&uo("time")){
         $checktime=&uo("time");   
            if (($xnow==&uo("getx")) && ($ynow==&uo("gety"))){
            &pathfind($i, $j);
            $check1++;
            }
              $xnow=&uo("getx");
                $ynow=&uo("gety");
            }
                     &wait(100);
                  }
        &uo("deletejournal");
        while ((&uo("injournal", "You have no line|There is nothing|Can\'t|Try miming|You can\'t use")==0) && ($check1<1)){
          &uo("findtype","0x19B9",0);
          &uo("Drop",0,0,0,0,"finditem");
                    &uo("waittargettile", $tree[$m], $i, $j, $z);
                    &uo("deletejournal");
                    &uo("usetype", "0x0E85");
          while (&uo("injournal", "You have no line|You put|There is nothing|There are no|You loosen|Can\'t|Try miming|You can\'t use")==0){
         &wait(100);
          }
                  }
               }   
            }
         }
      }
   }
  }
}


Code: Select all

sub lamber2 {
  while (true) {
   $x=&uo("getx");
   $y=&uo("gety");
   $z=&uo("getz");
   @tree=(0x0c95,0x0c96,0x0cca,0x0ccb,0x0ccc,0x0ccd,0x0cd0,0x0cd3,0x0cd6,0x0cd8,0x0cd9,0x0cda,0x0cdb,0x0cdc,0x0cdd,0x0cde,0x0cdf,0x0ce0,0x0ce3,0x0ce6,0x0cf8,0x0cfb,0x0cfe,0x0d01,0x0d41,0x0d42,0x0d43,0x0d44,0x0d57,0x0d58,0x0d59,0x0d5a,0x0d5b,0x0d6e,0x0d6f,0x0d70,0x0d71,0x0d72,0x0d84,0x0d85,0x0d86);
   for($i=0;$i<=20;$i++){
      for($j=0;$j<=20;$j++){
   $tx=$x+$j;
   $ty=$y+$i;
         for ($m=0;$m<41;$m++){
            if (&uo("privategettile", $tx, $ty, 0, $tree[$m], $tree[$m])>0){
      &uo("deletejournal");
               if (&pathfind($tx, $ty)!=0){
        $checktime=&uo("time");
        $xnow=&uo("getx");
          $ynow=&uo("gety");
        $check1=0;
                  while (((abs(&uo("getx")-$tx)>1) || (abs(&uo("gety")-$ty)>1)) && ($check1<2)){
           if (($checktime+1)<&uo("time")){
         $checktime=&uo("time");   
            if (($xnow==&uo("getx")) && ($ynow==&uo("gety"))){
            &pathfind($tx, $ty);
            $check1++;
            }
              $xnow=&uo("getx");
                $ynow=&uo("gety");
            }
                     &wait(100);
                  }
        &uo("deletejournal");
        while ((&uo("injournal", "There are no|You can\'t")==0)&& ($check1<1)){
                    &uo("waittargettile", $tree[$m], $tx, $ty, $z);
                    &uo("deletejournal");
                    &uo("usetype", "0x0F47");
          while (&uo("injournal", "not enough|You put|Подолбив|There are no|You can\'t")==0){
         &wait(100);
          }
                  }
               }   
            }
         }
      }
   }
  }
}


Чеклаг

Code: Select all

sub del($msg){ 
   while (uo::injournal(@_)) {
      uo::setjournalline(uo::injournal(@_)-1,'');
   }
}

sub checklag{
   &del("backpack");
   uo::click("backpack");
   while (!uo::injournal("backpack")){
      &wait(30);
   }
}


ОЛДП БЕГГИНГ

Code: Select all

####################################
# Begging For Oldp.net Shard v1.0  #
####################################
# // AdmiR™ © // #
##################
#
# Настройки:
#
##  $runebook - ID Рунбуки .
##  $ven1 .. $ven16 - 16 точек рекола по рунбуке ,ID вендоров на каждой точке вписывать через пробел .
##  $num_bank = 1 - Номер руны где стоит банкир ( нумерация рун с 1 по 16 ) .
##  $num_mag = 2 - номер руны где стоит маг с регами .
###  Примечание : Если вы не хотите закупать реги , либо складывать деньги в банк , обнулите соответствующие переменные.
##  $box_in_bank - ID Сумочки в банке куда деньги складывать .
##
##  Запустить скрипт : exec begging


sub begging{

$runebook=("0x40043E83");# ID Рун буки
$ven1="0x00119472";
$ven2="0x0011CFE0";
$ven3="0x0011ADC0";
$ven4="0x001190E6";
$ven5="0x0010E533";
$ven6="0x0011738B 0x00118C0E";
$ven7="0x00112F0B";
$ven8="0x001149A6 0x0011741B";
$ven9="0x0011A2BC";
$ven10="0x0010F09C";
$ven11="0x001152B3";
$ven12="0x0011C9F9";
$ven13="0x001112E0 0x00117663";
$ven14="0x0011AEDE";
$ven15="0x00118A05";
$ven16="0x0011D1EA 0x0011A8C4";
$num_bank=1;
$num_mag=2;
$box_in_bank="0x40028F62";


@vendor=($ven1,$ven2,$ven3,$ven4,$ven5,$ven6,$ven7,,,,$ven8,$ven9,$ven10,$ven11,$ven12,$ven13,$ven14,$ven15,$ven16);

  while (uo::dead()==0) {
    for($i=0;$i<=15;$i++){
      uo::useskill('Meditation');
      &Recall($runebook,$i);
      @words=split(/ /,$vendor[$i]);
      foreach (@words) {
   uo::deletejournal();
   while ((uo::injournal("You put the gold|You receive")==0) && ((uo::journalserial(uo::injournal("Oh, I have no money now")-1)) ne $_ )) {
   @coord=findid($_);
     if ((abs($dx=$coord[0]-uo::getx()) > 2) || (abs($dy=$coord[1]-uo::gety()) > 2)) {

      &pathfind($dx,$dy);
      #smartmove($coord[0],$coord[1],$coord[2],2);
     }
     uo::waittargetobject($_);
     uo::useskill('Begging');
     &wait(2000);
     if ($i == $num_mag-1) {
       if (uo::count("0x0F7A") < 400){ uo::buy("bp"); uo::say("bye"); &wait(200); }
       if (uo::count("0x0F7B") < 400){ uo::buy("bm"); uo::say("bye"); &wait(200); }
       if (uo::count("0x0F86") < 400){ uo::buy("mr"); uo::say("bye"); &wait(200); }
     }
   }
      }
      if ($i == $num_bank-1) {
   uo::deletejournal();
   while (($bank eq '0xFFFFFFFF') || ($bank eq '0x00000000') ) {
     uo::msg('bank');
     &wait(100);
     $bank = uo::getserial(uo::containerof($box_in_bank));
   uo::print($bank);
   }
   while (uo::count(0x0EED)){
     uo::moveitem('_0x0EED',0,$box_in_bank);
     if (uo::injournal('You put the')) { uo::msg('bank'); uo::deletejournal(); }
     &wait(100);
   }
      }
    }
    &wait(100);
  }
}


sub Recall($$){

  @gumpreturn=(0x0014,0x0016,0x0018,0x001A,0x001C,0x001E,0x0020,0x0022,0x0024,0x0026,0x0028,0x002A,0x002C,0x002E,0x0030,0x0032);
uo::recall($_[0],$gumpreturn[$_[1]]);
&wait(10000);
uo::deletejournal();

}

#########################################################################
# Function Name : findid($)                   #
# This function find the item on ground and return its coord (x,y,z)    #
# Parameters: Id of Any item                  #
# Return - Massive(x,y,z) ; if not found ,return 0         #
# Example : @coord=findid("0x00012332");            #
# // AdmiR™ © //                      #
#########################################################################

sub findid($){
my($i,$j,@a);
for ($i=uo::getx()-20;$i<=uo::getx()+20;$i++){
  for ($j=uo::gety()-20;$j<=uo::gety()+20;$j++){
    @a=findidtile($i,$j,$_[0]);
    if ($a[0]>0){
   return $i,$j,$a[2];
    }
  }
}
return 0;
}

sub findidtile($$$){
  my($a);
   foreach $a (@{tile($_[0], $_[1])}){
      if (${$a}[1] == hex($_[2])) {

         return @{$a};
      }
   }
   return 0;
}
#########################################################################

sub smartmove($$$$){

   my($myx, $myy, $i, $div, @a);
   $myx=uo::getx();
   $myy=uo::gety();
   @a=@{trace($myx, $myy, uo::getz(), $_[0], $_[1], $_[2], 500, $_[3])};
   for ($i=scalar(@a)-1; $i>=0; $i--){
      $myx-=@a[$i]->[0];
      $myy-=@a[$i]->[1];
      $div=abs($myx)+abs($myy);
      if ($div){
         uo::addstep(((5+4*$myy)*abs($myy)+(5+2*$myx)*abs($myx))/($div));
      }
      while ((uo::getx()!=@a[$i]->[0]) or (uo::gety()!=@a[$i]->[1])){
         &wait(100);
      }
      $myx=uo::getx();
      $myy=uo::gety();
   }
   uo::print(scalar(@a));
   return scalar(@a);
   
}
все для альфы , [url=http://newvlad.nm.ru/prog]здесь[/url]
модернизация ремонт продажа игровых консолей
Sky: admirka1 Москва
Sirocco
Posts: 90
Joined: 2007-07-07 13:14:01

Re: Примеры готовых скриптов на Perl

Post by Sirocco »

Собиралка/дособиралка(если количества не хватает) предметов в рюкзак.
Работает по последнему открытому контейнеру. Перекладывает в рюкзак.

['0x0F7A',-1,100,'Black Pearl',137,124]
Тип предмета, Цвет предмета, Нужное кол-во, название, координата Х, координата Y (куда нужно положить)

Code: Select all

sub allsupply() {
   $container = 'lastcontainer';
   if (uo::getserial($container) eq uo::getserial('backpack')) {
      uo::print('No lastcontainer');
      return;
   }
   @reag = (
   ['0x0F7A',-1,100,'Black Pearl',137,124],['0x0F7B',-1,100,'Blood Moss',137,124],['0x0F86',-1,100,'Mandrake Root',137,124],['0x0F84',-1,100,'Garlic',137,124],['0x0F85',-1,100,'Ginseng',137,124],['0x0F88',-1,100,'Night Shade',137,124],['0x0F8C',-1,100,'Sulfurous Ash',137,124],['0x0F8D',-1,100,'Spiders Silk',137,124],['0x0E21',-1,150,'Bandage',96,65]
   ,['0x0F87',-1,0,'Eye of Newt',96,65],['0x0F80',-1,0,'Daemon Bones',96,65],['0x0F7E',-1,0,'Bones',96,65]
   );
   $array = scalar(@reag);
   for ($i;$i < $array;$i++) {
      &supply($reag[$i][0],$reag[$i][1],$reag[$i][2],$reag[$i][4],$reag[$i][5],$container);
   }
   uo::print('Supply successfully completed');
}

sub supply() {
   $item = $_[0];
   $color = $_[1];
   $check = $_[2];
   $x = $_[3];
   $y = $_[4];
   $container = $_[5];
   uo::findtype($item,$color,'backpack');
   $count = uo::getquantity('finditem');
   if ($count eq $check) {
   } else {
      if ($count < $check) {
         $supply = $check - $count;
         uo::findtype($item,$color,$container);
         if (uo::getquantity('finditem')) {
            uo::moveitem('finditem',$supply,'backpack',$x,$y,0);
            &wait(450);
         }
      } else {
         $supply = uo::getquantity('finditem') - $check;
         uo::moveitem('finditem',$supply,$container);
         &wait(450);
      }
   }
}


Раскладка в рюкзаке
Тип, цвет, координата Х, координата У, смещение от координаты

Code: Select all

sub allorganize() {
   &organize('0x0F7A',-1,137,124,0); #Black Pearl
   &organize('0x0F7B',-1,137,124,0); #Blood Moss
   &organize('0x0F86',-1,137,124,0); #Mandrake Root
   &organize('0x0F84',-1,137,124,0); #Garlic
   &organize('0x0F85',-1,137,124,0); #Ginseng
   &organize('0x0F88',-1,137,124,0); #Night Shade
   &organize('0x0F8C',-1,137,124,0); #Sulfurous Ash
   &organize('0x0F8D',-1,137,124,0); #Spiders Silk
   &organize('0x0E21',-1,83,65,0); #Bandage
   &organize('0x0E20',-1,99,65,0); #Bloody Bansage
   &organize('0x1F15',-1,61,65,0); #Flip Rune
   &organize('0x0F0B',0,25,82,3); #Refresh
   &organize('0x0F09','0x0388',30,97,3); #Mana
   &organize('0x0F0D',-1,77,83,3); #Explosion
   &organize('0x0F0C',-1,61,97,3); #Heal
   &organize('0x0F36',-1,44,118,-1); #Sheaf of Hay
   uo::print('Organize successfully completed');
}

sub organize() {
   $item = $_[0];
   $color = $_[1];
   $x = $_[2];
   $y = $_[3];
   $z = $_[4];
   uo::findtype($item,$color,'backpack');
   for ($i = 1;$i < uo::findcount() + 1;$i++) {
      uo::moveitem('finditem',-1,'backpack',$x,$y,0);
      $x = $x + $z;
      &wait(350);
      uo::findtype($item,$color,'backpack');
   }
}




Выбирает первое попавшееся оружие из массива и одевает его, не одевает, если оружие уже есть в руке.

Code: Select all

sub allweapon() {
   @weapon = ('0x13BA','0x13B9','0x143C','0x143D','0x13B5','0x13FE','0x13FE','0x13FF');
   foreach $i (@weapon) {
      if ((uo::getgraphic(uo::objatlayer('Rhand')) eq $i) or (uo::getgraphic(uo::objatlayer('Lhand')) eq $i)) {
         return;
      }
      uo::findtype($i,-1,'my');
      if (uo::getquantity('finditem')) {
         # uo::equipt("Rhand",$i);
         uo::useobject('finditem');
         return;
      }
   }
}







заклинание Лайтинг со скролла и с маны
остальные делают по аналогии.
цель - ластстатус

Code: Select all

sub scroll_lightning() {
   $target = 'laststatus';
   $sLightning = 0x1F4A ; # Тип Lighting скролов
   &castlast($sLightning,'Lightning',$target);
}

sub lightning() {
   $target = 'laststatus';
   &castmana(11,'Lightning',$target);
}

sub castlast() {
   $scroll = $_[0];
   $magic = $_[1];
   $target = $_[2];
   uo::findtype($scroll,-1,'my');
   if (uo::getquantity('finditem')) {
      uo::waittargetobject($target);
      uo::useobject('finditem');
      uo::print("#Scroll " . $magic . "#");
   } else {
      uo::cast($magic,$target);
      uo::print("#Spell " . $magic . "#");
   }
}

sub castmana() {
   $mana = $_[0];
   $magic = $_[1];
   $target = $_[2];
   if (uo::mana() < $mana) {
      uo::print("#Not enought mana " . $magic . " spell#");
   } else {
      uo::cast($magic,$target);
      uo::print("#Spell " . $magic . "#");
   }
}




Питье алхимии с проверками

Code: Select all

sub drinkrefresh() {
   $RefresType = 0x0F0B;
   $RefreshColor = 0x0000;
   if (uo::stamina() eq uo::dex()) {
      uo::print(" !!! -= Refresh already =- !!! ");
      return;
   }
   uo::findtype($RefresType,$RefreshColor,'my');
   if (uo::getquantity('finditem')) {
      uo::usetype($RefresType,$RefreshColor);
      uo::print("Drink Refresh!");
   } else {
      uo::print("Refresh is Out!");
   }
}
Post Reply