PDA

View Full Version : How to Find Items Using DTMs!



Bionicle
09-22-2009, 06:53 AM
Eh~~! Welcome to my sixth tut, how to find items using DTMs!

Making a DTM

To help you understand this a bit more, this is going to be a 'hands-on' tut.
First, get a longbow and equip it. MAKE SURE YOUR SCREEN IS ON THE EQUIP TAB!~~:
http://img27.imageshack.us/img27/2843/srltut1.th.gif (http://img27.imageshack.us/i/srltut1.gif/) (click for bigger)

Look on your keyboard and find the button called 'Print Screen'. Somtimes it can be 'Prt Scr', as it is on mine. Hit it. Now open scar, go to tools, and press 'DTM Editor...'. Now go to Edit, and hit Paste Image, and the print screen you took should pop up.
Make the screen bigger until you can see this:
http://img180.imageshack.us/img180/8022/srltut2.gif (http://img180.imageshack.us/i/srltut2.gif/)

Now click on the brown part of the longbow. This is the main point of your DTM. If your not sure that you can click the exact pixel, then use the zoomed image in the top left corner. After you click there will be a flashing dot where you clicked.
Now click on four points along the outer edge of the bow. They have to be black, as every item in runescape has a black outline. You can use the zoomed image in the top left corner that shows the pixels if you need help again. These will NOT have flashing dots, as they are not the main points.
Now your bow should look like this, if it doesn't then you did something wrong, go back and try to find out what it is:
http://img198.imageshack.us/img198/648/srltut3.gif (http://img198.imageshack.us/i/srltut3.gif/)
Also in the top right corner, it should look like this:
http://img14.imageshack.us/img14/5972/srltut4.gif (http://img14.imageshack.us/i/srltut4.gif/)

Now, these numbers mean somthing. In each set, the first number is the x coordinate, the second is the y coordinate, and the third is the color. The color for the first set can differ, depending on what shade of brown you clicked. But the other four HAVE to be black; 65536.

Now, set the 'Parent' option to your first set, as it is your main point. Next, set your tolerance. 10-20 is usually good for me. Now press 'File' and hit 'DTM to Text'. You can close the DTM Editor window now.
This, or something like this if your shade of brown isn't the same as mine, should be in your debug box:

DTM := DTMFromString('78DA63F467666078C4C8800C3CF5B9C0344 8F' +
'43F10308660AA81C8C248201D0154F396801A3BA09A2B04D4 F800' +
'D5DCC2AF0600139A0A85');

How to Use DTM's in Your Script

Here is en example that we would use with the longbow:
program DTMExample;
{.include SRL/srl.scar}

function UnequipBow: Boolean;
var
Bow, x, y: Integer;

begin
Bow := DTMFromString('78DA63F467666078C4C8800C3CF5B9C0344 8F' + //remember to name your DTM
'43F10308660AA81C8C248201D0154F396801A3BA09A2B04D4 F800' +
'D5DCC2AF0600139A0A85');
if FindDTM(Bow, x, y, MIX1, MIY1, MIX2, MIY2) then //FindDTM finds the DTM :P and MI is Main Invitory, then X1, Y1, X2, Y2 are x/y coordinates.
begin
GameTab(tab_Equip); //changing the game tab to the equip screen
MMouse(x, y, 3, 3); //moving mouse to the DTM...
if IsUpText('ongbow') then //checking to see if it is the bow...
begin
Wait(100 + Random(50)); //this is here so the script has enough time to find the uptext
Mouse(x, y, 0, 0, true); //clicking the bow, thus unequipting the bow
GameTab(tab_inv); //changing the game tab to the invitory screen
Result := FindDTM(Bow, x, y, MIX1, MIY1, MIX2, MIY2);
if Result then
begin
WriteLn('Unequipting Boots Successful!!'); //just incase it doesn't work, these are here to tell me where it went wrong
Logout;
end else
begin
Writeln('Couldnt find bow equipt');
Logout;
end;
end else
begin
Writeln('Couldnt find uptext');
Logout;
end;
end else
begin
Writeln('Couldnt find bow in invitory');
Logout;
end;
FreeDTM(Bow); //make sure you ALWAYS free your DTMs, otherwise your script will have serious lag
end;

begin
ClearDebug;
SetupSRL;
ActivateClient;
if UnequipBow then
begin
Writeln('Successful, logging out.');
Writeln(':-)');
end else
begin
Writeln('Not successful, logging out.');
Logout;
end;
end.

Now if it is done right, this is what should come out in the Debug box:

SRL Compiled in 15 msec
Successful, logging out.
:-)
Successfully executed

Read through this example VERY carefully, and see if you can understand all of it. Now try to make your own simple script with a DTM!

Any questions, comments, or corrections please leave a comment below ;). If you liked my tut, use the blue checkmark at the top right hand corner :).

Raskolnikov
11-27-2009, 05:20 AM
Nice tutorial, pretty basic and straightforward. Rep++