Author Topic: [Example] Procedures  (Read 7144 times)

0 Members and 1 Guest are viewing this topic.

Offline dxromTopic starter

  • Master of the milestones!
  • Elite
  • *
  • *
  • Posts: 1080
  • Activity:
    0%
  • Reputation Power: 15
  • dxrom is working their way up.dxrom is working their way up.dxrom is working their way up.
  • KEYBOARD COWBOY, GREAT SAMURAI OF THE INTERNET.
  • Respect: +277
  • Referrals: 1
    • View Profile
[Example] Procedures
« on: June 06, 2013, 03:45:32 PM »
+2
I had someone asking me the other day what the point of making procedure to perform a task like moving an item when stealth has functions like MoveItem readily available for such tasks. And further how someone would go about creating a procedure to handle such a task.

Here is an example of such a procedure, it even works.

Code: [Select]
procedure GetItem(Item:Cardinal; Source:Cardinal; Amount:Integer);
begin
  UseObject(Source);
  wait(1200);
  MoveItem(FindType(Item,Source),Amount,BackPack,0,0,0);
  wait(1000);
end;

Now to answer the question of why someone would have this sort of function is purely for the sake of sanity and I suppose also to look neat.

Alternate and less efficient methods of moving items within your code would consist of the typing the same code every time you wanted to move something.

Code: [Select]
  MoveItem(FindType(Item,Source),1,BackPack,0,0,0);
  wait(1000);

Now what's easier and cleaner looking, that pasted over and over for every single thing you want to move, or this?

Code: [Select]
GetItem($0EFA,EmptyBooksContainer,1);

To help anyone who is newer to this procedural concept I'll break down what makes it work.

When you pass information to a procedure it must pass the correct information in the correct order, which is set via the procedure's properties.

Quote
procedure GetItem(Item:Cardinal; Source:Cardinal; Amount:Integer);

GetItem($0EFA,EmptyBooksContainer,1);

Now let's break down where these properties are utilized within the procedure.

Quote
begin
  UseObject(Source);
  wait(1200);
  MoveItem(FindType(Item,Source),Amount,BackPack,0,0,0);
  wait(1000);
end;

Instead of writing a wall of text attempting to point your attention towards where things happen, I have grouped them with the help of the bold, italic and underlined text modifiers.

For a further understanding of the functions within this procedure you can follow these links.

http://stealth.od.ua/Doc:Api/UseObject
http://stealth.od.ua/Doc:Api/FindType
http://stealth.od.ua/Doc:Api/MoveItem

I hope this helps anyone who is learning.



 ​_██​_
(ಠ​_ృ)
I do say, ol' Chap! Come play EVE Online! Why here is a 21 Day Free Trial!

Tags: