Forum in READ ONLY mode! All questions and discussions on Discord official server, invite link: https://discord.gg/VxsGzJ7

Поиск по названию

тут можно задать вопрос по скриптингу
nefor2004
Neophyte
Neophyte
Posts: 16
Joined: 21.11.2014 11:53

Поиск по названию

Post by nefor2004 »

Хотелось бы узнать есть ли поиск по названию итема ? Скрипт для прокачки индификации. Т.е. все не идентифицированные итемы имеют приписку Magic. Какой командой можно найти эту приписку ?
Kobzar
Novice
Novice
Posts: 72
Joined: 28.02.2006 14:49
Contact:

Re: Поиск по названию

Post by Kobzar »

http://informatics.mccme.ru/mod/book/vi ... pterid=249
конкретно
Функция Pos
И это при том - что из паскаля я знаю только его название :)
Last edited by Kobzar on 20.12.2014 20:19, edited 1 time in total.
Кто понял жизнь - тот не спешит ...
nefor2004
Neophyte
Neophyte
Posts: 16
Joined: 21.11.2014 11:53

Re: Поиск по названию

Post by nefor2004 »

Kobzar
Novice
Novice
Posts: 72
Joined: 28.02.2006 14:49
Contact:

Re: Поиск по названию

Post by Kobzar »

да не за что :)
Кто понял жизнь - тот не спешит ...
nefor2004
Neophyte
Neophyte
Posts: 16
Joined: 21.11.2014 11:53

Re: Поиск по названию

Post by nefor2004 »

Kobzar wrote:http://informatics.mccme.ru/mod/book/vi ... pterid=249
конкретно
Функция Pos
И это при том - что из паскаля я знаю только его название :)
блин надо поконкретней :) Работу финкции понял, а в Ультиме как ее реализовать ? И вообще она работает в ультиме ? :shock:
Kobzar
Novice
Novice
Posts: 72
Joined: 28.02.2006 14:49
Contact:

Re: Поиск по названию

Post by Kobzar »

Вы сейчас спрашиваете - работает ил бензин в машине....
Вы используя какуюто функцию получаете список айтемов
Для каждого найденного обьекта - получите GetName к примеру
http://stealth.od.ua/Doc:RU/Manual/Reference/Object
и отсортируйте нужное по значению функией POS
Кто понял жизнь - тот не спешит ...
nefor2004
Neophyte
Neophyte
Posts: 16
Joined: 21.11.2014 11:53

Re: Поиск по названию

Post by nefor2004 »

Kobzar wrote:Вы сейчас спрашиваете - работает ил бензин в машине....
Вы используя какуюто функцию получаете список айтемов
Для каждого найденного обьекта - получите GetName к примеру
http://stealth.od.ua/Doc:RU/Manual/Reference/Object
и отсортируйте нужное по значению функией POS
все понял, тупанул, спс. Принялся за работу :)
Kobzar
Novice
Novice
Posts: 72
Joined: 28.02.2006 14:49
Contact:

Re: Поиск по названию

Post by Kobzar »

что правда на питоне ето делается проще и изящней :)

Code: Select all

some_data = ['good name', 'good day', 'good nigth']

for i in some_data:
    if 'name' in i:
        print i
Кто понял жизнь - тот не спешит ...
Roman
Neophyte
Neophyte
Posts: 37
Joined: 03.11.2014 21:48

Re: Поиск по названию

Post by Roman »

if bmsearch(1,gettooltip(ID предмета),'Magic') <> 0 then
drabadan
Expert
Expert
Posts: 730
Joined: 13.12.2012 17:35
Contact:

Re: Поиск по названию

Post by drabadan »

Roman wrote:if bmsearch(1,gettooltip(ID предмета),'Magic') <> 0 then
кину в тему скриптец небольшой которым палю юв или хартвуд руники, там есть процедура которая вычленяет значение искомого пропса. У меня там настроено под свингу если меньше 35 то выбросит в урну.

Авось кому пригодится!

З.Ы. кому надо будет чтоб работало, нужно будет вам еще инклюд попросить или поправьте калацалку по гампу!

Code: Select all

Program CraftRunic;

uses 
 Gumps;
 
const
 ItemType = $13B2;
 ToolType = $1022;
 TrashBarrel = $409B9B83;
 Prop = 'swing';
 TargetLevel = 35;
 RegChest = $41F1D297;

function GetItemProperty(Item : Cardinal; fProperty : String) : Integer;
var
 Sl : TStringList;
 i : Integer;
begin
 Result := -1;
 Sl := TStringList.Create;
 
 StrBreakApart(GetToolTip(Item), '|', Sl);
 
 if Sl.Count > 0 then
  for i := 0 to Sl.Count-1 do
   if BMSearch(1, AnsiLowerCase(Sl.Strings[i]), AnsiLowerCase(fProperty)) > 0 then
    Result := StrToInt(Copy(Sl.Strings[i], Pos('%', Sl.Strings[i])-3, 3)); 
  
 Sl.Free;
end;

function GetFoundItems(var Items: Array Of Cardinal): Integer;
var List: TStringList; i: Integer;
begin
  List := TStringList.Create;
  if GetFindedList(List) = False then Result := 0
  else begin
    SetLength(Items, List.Count);
    for i := 0 to Length(Items)-1 do Items[i] := StrToInt('$'+List.Strings[i]);
    Result := Length(Items);
  end;
  List.Free;
end; 

procedure CheckReg;
begin
 if GetQuantity(FindTypeEx($1BD7, $04A7, Backpack, False)) < 10 then
  if MoveItem(FindTypeEx($1BD7, $04A7, RegChest, False), (MaxWeight - Weight), Backpack, 0,0,0) then
   Wait(600)
  else
   Wait(100);  
end;

procedure CraftItem;
var
 Items, Tools : Array of Cardinal;
 i, k : Integer; 
begin
 FindType(ToolType, Backpack);
 //ClientPrint(IntToStr(FindCount));
 if GetFoundItems(Tools) > 0 then
  for k := 0 to High(Tools) do
    begin
     //ClientPrint('asdasdasd');
     if wait_for_gump($38920ABD, 2000) then
      begin 
       CheckReg;
       {Bow}if PushGumpButton(GetGumpsCount-1, '123', 220, 60, 2) then
        wait(100)    
       else
        wait(100);
       FindType(ItemType, Backpack);
        if GetFoundItems(Items) > 0 then
         for i := 0 to High(Items) do
          if GetItemProperty(Items[i], Prop) < TargetLevel then
           if MoveItem(Items[i], 0, TrashBarrel, 0,0,0) then
            Wait(600)
           else
            Wait(100);   
      end
     else
      UseObject(Tools[k]);
    end;  
end;

begin
 //ClientPrint(IntToStr(GetItemProperty($4067D2AA, 'swing')));
 while true do CraftItem;
end.
MeLFiS
Novice
Novice
Posts: 147
Joined: 02.02.2008 12:21

Re: Поиск по названию

Post by MeLFiS »

drabadan wrote:
Roman wrote:if bmsearch(1,gettooltip(ID предмета),'Magic') <> 0 then
кину в тему скриптец небольшой которым палю юв или хартвуд руники, там есть процедура которая вычленяет значение искомого пропса. У меня там настроено под свингу если меньше 35 то выбросит в урну.

Авось кому пригодится!

З.Ы. кому надо будет чтоб работало, нужно будет вам еще инклюд попросить или поправьте калацалку по гампу!

Code: Select all

Program CraftRunic;

uses 
 Gumps;
 
const
 ItemType = $13B2;
 ToolType = $1022;
 TrashBarrel = $409B9B83;
 Prop = 'swing';
 TargetLevel = 35;
 RegChest = $41F1D297;

function GetItemProperty(Item : Cardinal; fProperty : String) : Integer;
var
 Sl : TStringList;
 i : Integer;
begin
 Result := -1;
 Sl := TStringList.Create;
 
 StrBreakApart(GetToolTip(Item), '|', Sl);
 
 if Sl.Count > 0 then
  for i := 0 to Sl.Count-1 do
   if BMSearch(1, AnsiLowerCase(Sl.Strings[i]), AnsiLowerCase(fProperty)) > 0 then
    Result := StrToInt(Copy(Sl.Strings[i], Pos('%', Sl.Strings[i])-3, 3)); 
  
 Sl.Free;
end;

function GetFoundItems(var Items: Array Of Cardinal): Integer;
var List: TStringList; i: Integer;
begin
  List := TStringList.Create;
  if GetFindedList(List) = False then Result := 0
  else begin
    SetLength(Items, List.Count);
    for i := 0 to Length(Items)-1 do Items[i] := StrToInt('$'+List.Strings[i]);
    Result := Length(Items);
  end;
  List.Free;
end; 

procedure CheckReg;
begin
 if GetQuantity(FindTypeEx($1BD7, $04A7, Backpack, False)) < 10 then
  if MoveItem(FindTypeEx($1BD7, $04A7, RegChest, False), (MaxWeight - Weight), Backpack, 0,0,0) then
   Wait(600)
  else
   Wait(100);  
end;

procedure CraftItem;
var
 Items, Tools : Array of Cardinal;
 i, k : Integer; 
begin
 FindType(ToolType, Backpack);
 //ClientPrint(IntToStr(FindCount));
 if GetFoundItems(Tools) > 0 then
  for k := 0 to High(Tools) do
    begin
     //ClientPrint('asdasdasd');
     if wait_for_gump($38920ABD, 2000) then
      begin 
       CheckReg;
       {Bow}if PushGumpButton(GetGumpsCount-1, '123', 220, 60, 2) then
        wait(100)    
       else
        wait(100);
       FindType(ItemType, Backpack);
        if GetFoundItems(Items) > 0 then
         for i := 0 to High(Items) do
          if GetItemProperty(Items[i], Prop) < TargetLevel then
           if MoveItem(Items[i], 0, TrashBarrel, 0,0,0) then
            Wait(600)
           else
            Wait(100);   
      end
     else
      UseObject(Tools[k]);
    end;  
end;

begin
 //ClientPrint(IntToStr(GetItemProperty($4067D2AA, 'swing')));
 while true do CraftItem;
end.
Скинь полностью скриптик на руники, если не сложно с инклюдами.
drabadan
Expert
Expert
Posts: 730
Joined: 13.12.2012 17:35
Contact:

Re: Поиск по названию

Post by drabadan »

MeLFiS wrote:
drabadan wrote:
Roman wrote:if bmsearch(1,gettooltip(ID предмета),'Magic') <> 0 then
кину в тему скриптец небольшой которым палю юв или хартвуд руники, там есть процедура которая вычленяет значение искомого пропса. У меня там настроено под свингу если меньше 35 то выбросит в урну.

Авось кому пригодится!

З.Ы. кому надо будет чтоб работало, нужно будет вам еще инклюд попросить или поправьте калацалку по гампу!

Code: Select all

Program CraftRunic;

//uses 
 //Gumps;
 
const
 ItemType = $13B2;
 ToolType = $1022;
 TrashBarrel = $409B9B83;
 Prop = 'swing';
 TargetLevel = 35;
 RegChest = $41F1D297;

function PushGumpButton(GumpIndex : ShortInt; GumpText : String; X, Y, Return_Value : Integer) : Boolean;
var
 GI : TGumpInfo;
 TextFound, ButtonFound : Boolean;
 ButtonIndex, i : Integer;
begin
 GetGumpInfo(GumpIndex, GI);
 Wait(50); 
 {if Length(GI.XmfHTMLGumpColor) > 0 then
  for i := 0 to Length(GI.XmfHTMLGumpColor)-1 do
   begin
    //AddToSystemJournal(GetClilocById(GI.XmfHTMLGumpColor[i].Cliloc_Id));
    if GumpText = GetClilocById(GI.XmfHTMLGumpColor[i].Cliloc_Id) then
    begin
	 TextFound := True; 
	 Break;
	end;
  end;}
 TextFound := True; 
 if Length(GI.GumpButtons) > 0 then
  for i := 0 to Length(GI.GumpButtons)-1 do
  begin
   //AddToSystemJournal(IntToStr(GI.GumpButtons[i].Return_Value));
   if (X = GI.GumpButtons[i].X) and (Y = GI.GumpButtons[i].Y) and (Return_Value = GI.GumpButtons[i].Return_Value) then
    begin
	 ButtonIndex := i;
	 ButtonFound := True;
	 Break;
	end;
  end;
 
 if TextFound and ButtonFound then
  begin
   NumGumpButton(GumpIndex, GI.GumpButtons[ButtonIndex].return_value);
   //AddToSystemJournal('Pushed the button!');
   Result := True;
  end;
 {if not TextFound then
  AddToSystemJournal('Text not found!');
 if not ButtonFound then
  AddToSystemJournal('Button not found!');}
end;

function wait_for_gump(gump_id,wait_time_ms : integer) : boolean;
var 
 wait_cycle : integer;
begin
 if dead or not connected then exit;
  repeat
   if getgumpid(getgumpscount-1) = gump_id then
    begin     
     result := true;
     break;
    end;
   wait(50);
   CheckLag(60000);
   inc(wait_cycle);
  until wait_cycle >= (wait_time_ms/50);
end;

function GetItemProperty(Item : Cardinal; fProperty : String) : Integer;
var
 Sl : TStringList;
 i : Integer;
begin
 Result := -1;
 Sl := TStringList.Create;
 
 StrBreakApart(GetToolTip(Item), '|', Sl);
 
 if Sl.Count > 0 then
  for i := 0 to Sl.Count-1 do
   if BMSearch(1, AnsiLowerCase(Sl.Strings[i]), AnsiLowerCase(fProperty)) > 0 then
    Result := StrToInt(Copy(Sl.Strings[i], Pos('%', Sl.Strings[i])-3, 3)); 
  
 Sl.Free;
end;

function GetFoundItems(var Items: Array Of Cardinal): Integer;
var List: TStringList; i: Integer;
begin
  List := TStringList.Create;
  if GetFindedList(List) = False then Result := 0
  else begin
    SetLength(Items, List.Count);
    for i := 0 to Length(Items)-1 do Items[i] := StrToInt('$'+List.Strings[i]);
    Result := Length(Items);
  end;
  List.Free;
end; 

procedure CheckReg;
begin
 if GetQuantity(FindTypeEx($1BD7, $04A7, Backpack, False)) < 10 then
  if MoveItem(FindTypeEx($1BD7, $04A7, RegChest, False), (MaxWeight - Weight), Backpack, 0,0,0) then
   Wait(600)
  else
   Wait(100);  
end;

procedure CraftItem;
var
 Items, Tools : Array of Cardinal;
 i, k : Integer; 
begin
 FindType(ToolType, Backpack);
 //ClientPrint(IntToStr(FindCount));
 if GetFoundItems(Tools) > 0 then
  for k := 0 to High(Tools) do
    begin
     //ClientPrint('asdasdasd');
     if wait_for_gump($38920ABD, 2000) then
      begin 
       CheckReg;
       {Bow}if PushGumpButton(GetGumpsCount-1, '123', 220, 60, 2) then
        wait(100)    
       else
        wait(100);
       FindType(ItemType, Backpack);
        if GetFoundItems(Items) > 0 then
         for i := 0 to High(Items) do
          if GetItemProperty(Items[i], Prop) < TargetLevel then
           if MoveItem(Items[i], 0, TrashBarrel, 0,0,0) then
            Wait(600)
           else
            Wait(100);   
      end
     else
      UseObject(Tools[k]);
    end;  
end;

begin
 //ClientPrint(IntToStr(GetItemProperty($4067D2AA, 'swing')));
 while true do CraftItem;
end.
Скинь полностью скриптик на руники, если не сложно с инклюдами.
Должно работать!
Включаем скрипт юзаем тулзу и потом наслаждаемся.
MeLFiS
Novice
Novice
Posts: 147
Joined: 02.02.2008 12:21

Re: Поиск по названию

Post by MeLFiS »

А есть скрипт что бы еще бегал в дом и брал ресы ?
drabadan
Expert
Expert
Posts: 730
Joined: 13.12.2012 17:35
Contact:

Re: Поиск по названию

Post by drabadan »

MeLFiS wrote:А есть скрипт что бы еще бегал в дом и брал ресы ?
бегал в дом? О_о
MeLFiS
Novice
Novice
Posts: 147
Joined: 02.02.2008 12:21

Re: Поиск по названию

Post by MeLFiS »

drabadan wrote:
MeLFiS wrote:А есть скрипт что бы еще бегал в дом и брал ресы ?
бегал в дом? О_о
Ну выбегал из хартвуда и реколился в дом брал ресы и обратно или как это делаешь ??
Post Reply