Using my system I have been able to identify most object in the inventory. This is what I have so far.
Use the normal client, not SMART if you want to test it yourself. also, use low level noob, since mouse moves very detectable!
What does the testscript do?Stand inside a bank, fill your inventory with anything, doesn't matter what. As long as you can 'Wield', 'Use', 'Eat', 'Drink', or 'Wear' it. (Close bank before starting script)
Start the script. The mouse will move very detecable over all invspots. (use low level noob) It will grab the names and the dimensions of all objects in the inventory. Note that the level of UpText succes depends on the background. solid background = better succes.
Now, while the script is still running, empty your inventory in the bank. Note that the debug is now empty.
Next place any item that the script has logged in any spot of the inventory, one or many doesn't matter. See that the script tracks your objects, the number of objects and the spot it is in.
Few problems left:- Raw vs Cooked Meat. I still need some kind of inside-TPA color picker. Problems also with other objects with same TPA + TPABounds. Succes is now 95%. Not good enough!
- Amount. Stacked items vary in outline because of overlap with the outline color. Can be solved, but I haven't build this yet. Coins will prolly get their own handling.
- solid objectnames. I will need a system that can see that 'B^ z@ icka ' is actually a bronze pickaxe.
Potential of this system.
Of course, I only check 28 items now, for the Ratz script thats about all I can find on the ground, but this system can keep track of anything you have in your inventory. If an unknown TPA + TPABound + color pops up in the inv, I analyse it, and use in the script if needed. Theoretically, this sytem will work regardless of jagex updating bitmaps. And thats was exactly what I was looking for.
Also, the system allows me to do the following:
with 'sling' do
and run the script until I pick up the rare goblin-drop 'sling'. Now that I have identified this sling, I can use it to train my range.
program test;
//{$i SRL/SRL/misc/SMART.scar}
{$i srl/srl.scar}
type
InvItem = record
w, h, z : Integer; // width, height, outline TPA count
n : string; // uptext name
c : longint; // color count
end;
var
InvBase: Array[1..28] of InvItem; // database of 28 different items
MyNamedInv:array[1..28] of string; // names of items current in inventory
const
SMART_world = 10;
InvOutline = 131072;
FawkiDebug = True;
procedure DeclarePlayers;
begin
HowManyPlayers:= 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := '';
Pass := '';
Nick := '';
Pin := '';
Active := true;
end;
end;
procedure Setup;
begin
if SMART_world <> 0 then
SMART_Server := SMART_world;
SMART_members := true;
SMART_signed := true;
SetUpSRL;
DeclarePlayers;
end;
// Extract Object Uptext name from string
Function GetInvName:String;
var
InvName, RawName, temp: String;
var
EFU : Array of string;
i :Integer;
begin
EFU := ['Wield','Use','Eat','Drink','Wear'];
RawName := (GetUpText);
for i := 0 to 4 do
begin
temp :=Between(EFU[i],'/',RawName);
if temp <> '' then
InvName := temp;
end;
Result := InvName;
end;
// grab properties of single invspot
Function GetSingleInv(InvSpot: Integer): InvItem;
var
TPA: TPointArray;
TP: TPoint;
InvObjectColors: TIntegerArray;
InvObjectBounds : Tbox;
w, x, y, i,j: Integer;
Begin
if not ExistsItem(InvSpot) then
begin
Exit;
end;
FindColorsSpiralTolerance(x, y, TPA, InvOutline, InvBox(InvSpot).x1, InvBox(InvSpot).y1, InvBox(InvSpot).x2, InvBox(InvSpot).y2, 0);
InvObjectBounds := GetTPABounds(TPA);
Result.w := InvObjectBounds.x2 - InvObjectBounds.x1;
Result.h := InvObjectBounds.y2 - InvObjectBounds.y1;
Result.z := Length(TPA);
end;
// Get properties of all spot...debugging purpose.
procedure GetAllInv;
var
TPA: TPointArray;
TP: TPoint;
InvObjectColors: TIntegerArray;
InvObjectBounds : Tbox;
InvObjectWidth, InvObjectHeight: Integer;
InvObjectName: String;
SumIntegerArray, color2, v, w, x, y, i,j: Integer;
Begin
for i := 1 to 28 do
begin
FindColorsSpiralTolerance(x, y, TPA, InvOutline, InvBox(i).x1, InvBox(i).y1, InvBox(i).x2, InvBox(i).y2, 0);
begin
// InvObjectColors := GetColors(TPA);
// SumIntegerArray(InvObjectColors);
InvObjectBounds := GetTPABounds(TPA);
InvObjectWidth := InvObjectBounds.x2 - InvObjectBounds.x1;
InvObjectHeight := InvObjectBounds.y2 - InvObjectBounds.y1;
MoveMouse(InvBox(i).x1 + (InvBox(i).x2-InvBox(i).x1)/2, InvBox(i).y2 - (InvBox(i).y2 -InvBox(i).y1)/2);
Wait(200);
InvObjectName := GetInvName;
InvBase[i].w := InvObjectWidth;
InvBase[i].h := InvObjectHeight;
InvBase[i].z := Length(TPA);
InvBase[i].n := InvObjectName;
Writeln('Inv ' + IntToStr(i) + ' = ' + InvObjectName + ' ' + IntToStr(Length(TPA))+ ' + '
+ IntToStr(InvObjectWidth) + ' + ' + IntToStr(InvObjectHeight) +' + ' + IntToStr(SumIntegerArray));
end
end
end;
procedure printoutinvbase;
var
i:Integer;
begin
writeln('_____CURRENT BASE______');
for i:= 1 to 28 do
begin
Writeln(InvBase[i].n);
end;
writeln('______________________');
end;
// Check if system works.
procedure CheckInv;
var
i,j:Integer;
TheInvItem: InvItem;
begin
for i := 1 to 28 do
begin
if not existsitem(i) then
begin
MyNamedInv[i] := '';
continue;
end;
TheInvItem := GetSingleInv(i);
For j := 1 to 28 do
begin
if (InvBase[j].w = TheInvItem.w) and (InvBase[j].h = TheInvItem.h) and
(InvBase[j].z = TheInvItem.z) then
begin
MyNamedInv[i] := InvBase[j].n; // Jackpot!, and place in current_invarray
end
end
end;
for i := 1 to 28 do
begin
writeln('Inv ' + IntToStr(i) + ' = ' + MyNamedInv[i]);
end
end;
begin
Setup;
LoginPlayer;
GetAllInv;
repeat
writeln('------------------------------------------');
CheckInv;
Wait(500);
Cleardebug;
writeln('------------------------------------------');
until false
end.