jordantotty
2013-03-02 00:04:27
Does anyone know how to count the amount of a specific item in the inventory?
All help appreciated!
All help appreciated!
2013-03-02 00:04:27
2013-03-02 00:07:33
2013-03-02 00:07:46
From: jordantotty
Does anyone know how to count the amount of a specific item in the inventory?
All help appreciated!
GetAmountBox(InvBox(i));Where 'i' is the inventory slot.2013-03-02 00:08:05
GetAmountBox(InvBox(25)); // Gets the amount of an item in the specified inventory slotfunction GetAmountBox(box: TBox): integer;
var
Col: TIntegerArray;
X, Y, I: Integer;
B: TBox;
TPA: TPointArray;
S: String;
begin
Result := 0;
If Not FindColor(X, Y, srl_outline_black, box.x1, box.y1, box.x2, box.y2) then
Exit;
Inc(Result);
Col := [65535, 65278, 16777215, 8453888];
For I := 0 to High(Col) do
If FindColor(X, Y, Col[I], box.x1, box.y1, box.x2, box.y2)then
begin
FindColors(TPA, Col[i], box.x1, box.y1, box.x2, box.y2);
B := GetTPABounds(TPA);
//SMART_DrawBoxEx(False, b, clYellow);
B := IntToBox(b.x1-2, b.y1-2, b.x2+2, b.y2+2);
S := GetTextAtExWrap(b.x1, b.y1, b.x2, b.y2, 0, 1, 1, Col[i], 0, StatChars);
Result := StrToIntDef(GetNumbers(S), 1);
Case I of
2: Result := Result * 1000;
3: Result := Result * 1000000;
end;
Exit;
end;
end;2013-03-02 00:09:22
From: -daazndagger-
I use this:Where 'i' is the inventory slot.GetAmountBox(InvBox(i));
E: :ninja: Aw man, third time today
From: SRLKing
GetAmountBox(InvBox(25)); // Gets the amount of an item in the specified inventory slot
:ninja:'d me while typing guys :P
2013-03-02 00:10:51
From: Sjoekeloe
I DOUBLE NINJA'd u guys ;)
2013-03-02 00:11:02
2013-03-02 00:11:33
From: Sjoekeloe
I DOUBLE NINJA'd u guys ;)
2013-03-02 00:14:07
2013-03-02 00:16:34
2013-03-02 00:24:05
From: jordantotty
Do you know where I can get p07 Stat chars?
2013-03-02 00:26:01
From: jordantotty
Do you know where I can get p07 Stat chars?
2013-03-02 00:26:45
2013-03-02 00:32:00
From: jordantotty
Yes, please inform me on how to do that, :)!
2013-03-02 00:35:32
2013-03-02 00:38:09
From: jordantotty
Thanks, One more question, how does inttobox work?
var
B: TBox;
B := IntToBox(x1, y1, x2, y2);2013-03-02 00:39:52
2013-03-02 00:43:54
From: jordantotty
I've tried:
ItemSlot2 := IntToBox(601,209,635,243);
w1:=GetAmountBox(InvBox(2));
WriteLn(w1);
Returns 0
_______________
ItemSlot2 := IntToBox(601,209,635,243);
w1:=GetAmountBox(Itemslot2);
WriteLn(w1);
Returns 0
If Not FindColor(X, Y, srl_outline_black, box.x1, box.y1, box.x2, box.y2) then
Exit;
//Change to:
If Not FindColor(X, Y, {PUT YOU COLOR HERE}, box.x1, box.y1, box.x2, box.y2) then
Exit;2013-03-02 00:45:10
From: jordantotty
I've tried:
ItemSlot2 := IntToBox(601,209,635,243);
w1:=GetAmountBox(InvBox(2));
WriteLn(w1);
Returns 0
_______________
ItemSlot2 := IntToBox(601,209,635,243);
w1:=GetAmountBox(Itemslot2); //Also I believe this should be IntoStr as it is a numerical variable
WriteLn(w1);
Returns 0
2013-03-02 00:50:17
2013-03-02 00:51:41
From: jordantotty
Yeah, im using @DannyRs include
P07_GetAmountBox();
P07_InvBox();2013-03-02 00:52:08
From: SRLKing
Appears to not be using the text reading properly, @pm DannyRS about it, I'm sure he'd be glad to help since it is his include(:
E* It doesnt look like he is using the include as it would say P07_ before the commands, correct?
2013-03-02 00:52:30
From: -daazndagger-
Are there such functions as ?P07_GetAmountBox();
P07_InvBox();
2013-03-02 00:55:16
From: SRLKing
AS far as I know, this is what he should be using(:
E* You are going to have to edit the functions yourself, I'd be happy to help you over pm
:ninja:'d me again Sjoe
2013-03-02 00:59:21
function P07_GetAmountBox(box: TBox): integer;
var
Col: TIntegerArray;
X, Y, I: Integer;
B: TBox;
TPA: TPointArray;
S: String;
begin
Result := 0;
If Not FindColor(X, Y, P07_outline_black, box.x1, box.y1, box.x2, box.y2) then
Exit;
Inc(Result);
Col := [65535, 65278, 16777215, 8453888];
For I := 0 to High(Col) do
If FindColor(X, Y, Col[I], box.x1, box.y1, box.x2, box.y2)then
begin
FindColors(TPA, Col[i], box.x1, box.y1, box.x2, box.y2);
B := GetTPABounds(TPA);
//SMART_DrawBoxEx(False, b, clYellow);
B := IntToBox(b.x1-2, b.y1-2, b.x2+2, b.y2+2);
S := GetTextAtExWrap(b.x1, b.y1, b.x2, b.y2, 0, 1, 1, Col[i], 0, StatChars);
Result := StrToIntDef(GetNumbers(S), 1);
Case I of
2: Result := Result * 1000;
3: Result := Result * 1000000;
end;
Exit;
end;
end;2013-03-02 01:02:05
2013-03-02 01:06:31
From: -daazndagger-
okay, had a look at the include. Those functions don't exist ahah. Try this:function p07_getamountbox(box: Tbox): Integer;
var
col: Tintegerarray;
x, y, i: Integer;
b: Tbox;
tpa: Tpointarray;
s: String;
begin
result := 0;
if not findcolor(x, y, p07_outline_black, box.x1, box.y1, box.x2, box.y2) then
exit;
inc(result);
col := [65535, 65278, 16777215, 8453888];
for i := 0 to high(col) do
if findcolor(x, y, col[i], box.x1, box.y1, box.x2, box.y2)then
begin
findcolors(tpa, col[i], box.x1, box.y1, box.x2, box.y2);
b := gettpabounds(tpa);
//smart_drawboxex(false, b, clyellow);
b := inttobox(b.x1-2, b.y1-2, b.x2+2, b.y2+2);
s := gettextatexwrap(b.x1, b.y1, b.x2, b.y2, 0, 1, 1, col[i], 0, statchars);
result := strtointdef(getnumbers(s), 1);
case i of
2: Result := result * 1000;
3: Result := result * 1000000;
end;
exit;
end;
end;
if the statchars are the same, then you should be sweet. Otherwise… We can play the waiting game :)
2013-03-02 01:07:34
From: jordantotty
oh my god it worked!! Thankyou so much!!
2013-03-02 01:31:22