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

Finditem and Find name

Ask for help
Post Reply
sauber
Neophyte
Neophyte
Posts: 18
Joined: 18.07.2018 21:01

Finditem and Find name

Post by sauber »

I'm trying to read through other's scripts and understand how to do this, but I'm failing :(

What I would like to achieve is to

- Find any item(Type)
- If Found, Look for its Name [Like would be for a Runebook or a Bulk Orders Book or a Bulk Order Deed]
- Assign it to a variable
- Drag and Drop something in it (found with the same criteria)


So far I've got.

Code: Select all

Program test;

var i: Integer;
const BodType =$2258;

Procedure FindBod;
Begin
   i := 0;
   if FindType(BodType, backpack) then
   begin     
      if pos('dagger', GetTooltip(finditem)) > 0 then
         begin  
         AddToSystemJournal('Found it!');  
         wait(250);
         end
       else   
          begin
          AddToSystemJournal('Not Found');
          wait(250); 
          end;
   end;
IgnoreReset;
End;

Begin
FindBod;
wait(250);
end.
maza
Neophyte
Neophyte
Posts: 14
Joined: 21.04.2014 16:43

Re: Finditem and Find name

Post by maza »

FindType($FFFF,backpack); //Find any item(Type)
FindType if found return FindItem // item id
GetClilic(); // Look for its Name [Like would be for a Runebook or a Bulk Orders Book or a Bulk Order Deed]
AddToSystemJournal(GetCliloc(FindItem)); example GetClilic
i := FindItem; // Assign it to a variable

get in backpack 2 Bulk order books, name one Bs other tailor and get some tailor and bs bods

Code: Select all

Program New;
const
BodType = $2258;        // Bod Type
BulkBookType = $2259;   // Bulk order book type
var
item : Cardinal;
TBook :Cardinal;        // ID bluk order book for tailor
BBook :Cardinal;        // ID bluk order book for bs
//*********************************//
procedure setupBooks;
var
info : String;
begin
  while FindType(BulkBookType,backpack) > 0 do
  begin
    info := GetCliloc(FindItem);
    if BMSearch(1,info,'Bs') > 0 then
    begin
      BBook:=FindItem;
      Ignore(FindItem);
    end
    else
    begin
      if BMSearch(1,info,'Tailor') >0 then
      TBook:=FindItem;
      Ignore(FindItem);
    end;
  end;
  IgnoreReset;
  AddToSystemJournal('Tailor book id :'+IntToStr(TBook));
  AddToSystemJournal('Bs book id :'+IntToStr(BBook));
  AddToSystemJournal('Book setup success');
end;

function checkFullBook(b:Cardinal):Boolean;
var
s : String;
begin
  s:=GetCliloc(b);
  if BMSearch (1,s,'Deeds in book: 500') > 0 then
  begin
    AddToSystemJournal('Book is full!');
    result:=True;
  end;
  result:=False;
end;
procedure BodToBook;
begin
  while FindTypeEx(BodType,$0483,backpack,false) > 0 do
  begin
    if checkFullBook(Tbook) then break;
    MoveItem(FindItem,FindQuantity,TBook,0,0,0);
    Wait(500);
  end;
  while FindTypeEx(BodType,$044E ,backpack,false) > 0 do
  begin
    if checkFullBook(Bbook) then break;
    MoveItem(FindItem,FindQuantity,BBook,0,0,0);
    Wait(500);
  end;
end;
//*********************************//

begin
  setupBooks;
  BodToBook;
end.
sauber
Neophyte
Neophyte
Posts: 18
Joined: 18.07.2018 21:01

Re: Finditem and Find name

Post by sauber »

WOW! you make it look so easy.

there is little documentation, it's very hard to understand the basics

I really like this
while FindTypeEx(BodType,$0483,backpack,false) > 0 do

and BMSearch!

How do you find this? $0483
maza
Neophyte
Neophyte
Posts: 14
Joined: 21.04.2014 16:43

Re: Finditem and Find name

Post by maza »

set prefix = and type in game =info its will open info window
Image
or in script

Code: Select all

Program New;
const
BodType =$2258;
var
s:string;
cl:Word; // Color
begin
  if FindType(BodType,backpack) > 0 then
  begin
  cl:=GetColor(FindItem);
  AddToSystemJournal('Color for UOS : 0x'+intToStr(cl));
  s:=IntToHex(cl,4); 
  AddToSystemJournal('Color for Stealth : $'+s);
  end;
end.
Post Reply