PDA

View Full Version : FindItem - Generates DDTMs



mat_de_b
10-07-2007, 08:13 PM
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Item Routines --//
//-----------------------------------------------------------------//
// * function BankBox(i: Integer): TBox; // * by Boreas
// * function GetItemName(Slotx, Sloty: integer; Debug: Boolean): string; // * by mat_de_b
// * function CreateItemDTM(x1, y1, x2, y2: integer; var DDTM: integer; Debug: boolean): Boolean; // * by mat_de_b
// * procedure SaveDTM(Debug: boolean); // * by mat_de_b
// * function FindBankDTM(var x, y: integer; DDTM: integer; UpText2: string): boolean; // * by mat_de_b
// * procedure GenerateBankDTMs(Debug: boolean); // * by mat_de_b
// * function LoadItem(UpText2: string; var ItemDTM: integer): boolean; // * by mat_de_b
// * function FindItemInv(var x, y:integer; UpText2: String): boolean; // * by mat_de_b
// * function FindItemBank(var x, y:integer; UpText2: String): boolean; // * by mat_de_b

{************************************************* ******************************
function BankBox(i: Integer): TBox;
By: Boreas - simplified by mat_de_b
Description: Returns the Tbox of the given bankslot
************************************************** *****************************}

{************************************************* ******************************
function GetItemName(Slotx, Sloty: integer; Debug: Boolean): string;
By: mat_de_b
Description: Moves the mouse to a give slot and then returns the item name
- Debug writes the changes to the Uptext etc...
************************************************** *****************************}

{************************************************* ******************************
function CreateItemDTM(x1, y1, x2, y2: integer; var DDTM: integer; Debug: boolean): Boolean;
By: mat_de_b
Description: Takes a bitmap of the Box then finds all the 65536 pixels
then creates subpoints and a main point
- Debug displays in the debug window the finding of points
************************************************** *****************************}

{************************************************* ******************************
function FindBankDTM(var x, y: integer; DDTM: integer; UpText2: string): boolean;
By: mat_de_b
Description: Finds a DTM in a bank slot by going from slot to slot and
then checking the UpTest if the DTM is found
************************************************** *****************************}

{************************************************* ******************************
procedure GenerateBankDTMs(Debug: boolean);
By: mat_de_b
Description: Makes DTMs of the first 48 items in your bank
-Debug displays info along the way
************************************************** *****************************}

{************************************************* ******************************
function LoadItem(UpText2: string; var ItemDTM: integer): boolean;
By: mat_de_b
Description: Loads a Item DTM from a file and saves it to the ItemDTM integer
************************************************** *****************************}

{************************************************* ******************************
function FindItemInv(var x, y:integer; UpText2: String): boolean;
By: mat_de_b
Description: Finds an Item in your inventroy and returns the x and y
! The uptext is case sensative and should be as in game...
************************************************** *****************************}

{************************************************* ******************************
function FindItemBank(var x, y:integer; UpText2: String): boolean;
By: mat_de_b
Description: Finds an Item in your bank and returns the x and y
! The uptext is case sensative and should be as in game...
************************************************** *****************************}



There are the functions now for an explanation :D

This will generate DTMs for the first 48 slots of your bank and if succesful will save each one to thier own individual file, they can then be used to find items in your inventory and bank at a later date...

Current issues:
It creating working DTMs for all items...

Features :
Creats DTMs of all items
Excludes black pixles in the amount
Can be loaded and saved
Can find items in bank and Inventory

How to Install:
Extract the included .rar to includes/srl/srl/misc
Then if you want you can try out the ItemTest.scar in includes/srl/srl/misc/Item


How You can help:
Upload a .rar of any DTMs you have generated

Thanks to Boreas for the BankBox Code and to pwnaz0r for the original code for the DTM from client

Timer
10-07-2007, 08:25 PM
Sweet;)

pwnaz0r
10-08-2007, 01:59 AM
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Item Routines --//
//-----------------------------------------------------------------//
// * function BankBox(i: Integer): TBox; // * by Boreas
// * function GetItemName(Slotx, Sloty: integer; Debug: Boolean): string; // * by mat_de_b
// * function CreateItemDTM(x1, y1, x2, y2: integer; var DDTM: integer; Debug: boolean): Boolean; // * by mat_de_b
// * procedure SaveDTM(Debug: boolean); // * by mat_de_b
// * function FindBankDTM(var x, y: integer; DDTM: integer; UpText2: string): boolean; // * by mat_de_b
// * procedure GenerateBankDTMs(Debug: boolean); // * by mat_de_b
// * function LoadItem(UpText2: string; var ItemDTM: integer): boolean; // * by mat_de_b
// * function FindItemInv(var x, y:integer; UpText2: String): boolean; // * by mat_de_b
// * function FindItemBank(var x, y:integer; UpText2: String): boolean; // * by mat_de_b

{************************************************* ******************************
function BankBox(i: Integer): TBox;
By: Boreas - simplified by mat_de_b
Description: Returns the Tbox of the given bankslot
************************************************** *****************************}

{************************************************* ******************************
function GetItemName(Slotx, Sloty: integer; Debug: Boolean): string;
By: mat_de_b
Description: Moves the mouse to a give slot and then returns the item name
- Debug writes the changes to the Uptext etc...
************************************************** *****************************}

{************************************************* ******************************
function CreateItemDTM(x1, y1, x2, y2: integer; var DDTM: integer; Debug: boolean): Boolean;
By: mat_de_b
Description: Takes a bitmap of the Box then finds all the 65536 pixels
then creates subpoints and a main point
- Debug displays in the debug window the finding of points
************************************************** *****************************}

{************************************************* ******************************
function FindBankDTM(var x, y: integer; DDTM: integer; UpText2: string): boolean;
By: mat_de_b
Description: Finds a DTM in a bank slot by going from slot to slot and
then checking the UpTest if the DTM is found
************************************************** *****************************}

{************************************************* ******************************
procedure GenerateBankDTMs(Debug: boolean);
By: mat_de_b
Description: Makes DTMs of the first 48 items in your bank
-Debug displays info along the way
************************************************** *****************************}

{************************************************* ******************************
function LoadItem(UpText2: string; var ItemDTM: integer): boolean;
By: mat_de_b
Description: Loads a Item DTM from a file and saves it to the ItemDTM integer
************************************************** *****************************}

{************************************************* ******************************
function FindItemInv(var x, y:integer; UpText2: String): boolean;
By: mat_de_b
Description: Finds an Item in your inventroy and returns the x and y
! The uptext is case sensative and should be as in game...
************************************************** *****************************}

{************************************************* ******************************
function FindItemBank(var x, y:integer; UpText2: String): boolean;
By: mat_de_b
Description: Finds an Item in your bank and returns the x and y
! The uptext is case sensative and should be as in game...
************************************************** *****************************}



There are the functions now for an explanation :D

This will generate DTMs for the first 48 slots of your bank and if succesful will save each one to thier own individual file, they can then be used to find items in your inventory and bank at a later date...

Current issues:
It creating working DTMs for all items...

Features :
Creats DTMs of all items
Excludes black pixles in the amount
Can be loaded and saved
Can find items in bank and Inventory

How to Install:
Extract the included .rar to includes/srl/srl/misc
Then if you want you can try out the ItemTest.scar in includes/srl/srl/misc/Item


How You can help:
Upload a .rar of any DTMs you have generated

Thanks to Boreas for the BankBox Code and to pwnaz0r for the original code for the DTM from client

How recent was the bankfinding? as in, did you get this off Boreas's thread or did he send to you?

mat_de_b
10-08-2007, 06:31 AM
at most a month old, he posted it in my thread

Narcle
10-24-2007, 03:56 AM
function FindItemInv(var x, y:integer; UpText2: String): boolean;
By: mat_de_b
Description: Finds an Item in your inventroy and returns the x and y
! The uptext is case sensative and should be as in game...


EEK! I've been trying to get something like this to work. Damn you for making one! >.< oh well *Downloads file*

Edit: wait not what i want
But it gives me some ideas to try on mine.
Basically mine checks if item exits in [i] if it does moves mouse, if uptext is up will left/right click and choose option. Problem is, it won't detect the non-white uptext.

mat_de_b
10-24-2007, 11:47 AM
yeh it will? isUpText finds it?

Narcle
10-24-2007, 04:06 PM
I tried many times with that. It sometimes misses a letter or something. But I found a guaranteed way with rs_GetUpText.

function MouseInvText(istextup, option:string; leftclick: Boolean; inv1, inv2, waitfor, xtimes:integer): Boolean; //by Narcle
var
i,x,y, times:integer;
begin
gametab(4);
for i := inv1 to inv2 do
if (ExistsItem(i)) then
begin
MMouseItem(i);
GetMousePos(x, y);
wait(100+random(50));
if (pos(istextup, rs_GetUpText) > 0) then
begin
if (leftclick = true) then Mouse(x,y,5,5,true);
if (leftclick = false) then
begin
Mouse(x,y,5,5,false);
Chooseoption(option);
end;
result := true;
times := times + 1;
wait(waitfor+random(100));
if (times = xtimes) then exit;
end;
end else
result := false;
exit;
end;

ShowerThoughts
10-24-2007, 04:11 PM
Gj ;)

vasu
10-26-2007, 07:11 PM
Cool!:eek: