SRL Archive - OSR Help

Banking Help


Inspirations

2010-09-23 14:55:50

EDIT: Woah wrong section! I'm so sorry, will a mod please move it!

Okay so I am making a cooker for my second script and I'm really trying to do something advanced (in hopes I can apply for members with it), but I've come to an issue. I don't want to use DTM's for withdrawal, I would prefer to use BlackLists (I think that's what MSI Called them) or the black outline of an object. Now the issue is that in the inventory the blackcount is lets say 77. In the bank, when you have more than one you get the yellow text. There is black around the yellow text, thus distorting the black color count, and changing it everytime you withdraw. Is there any way around this, or any suggestions besides using a dtm?

here's code:

function WithdrawBank: Boolean;
var
Area: TBox;
I, Index: Integer;
BlackCount: Integer;
TP: TPoint;
begin
for I := 1 to 25 do
begin
Area := BankIndexToMSBox(I);
BlackCount := CountColorTolerance(BlackColor, Area.x1, Area.y1, Area.x2,
Area.y2, 2);
writeLn('Slot['+IntToStr(I)+']: BlackCount = '+IntToStr(BlackCount));
if InRange(BlackCount, GlobalCount+15, GlobalCount-15) then // I did this to try to account for the change in blackcount
begin
Index := I;
Break;
end;
end;

if Index = 0 then
Exit;
WriteLn('Found Item in Slot: '+IntToStr(Index));
TP := BankIndexToMSPoint(Index);
Mouse(TP.x, TP.y, 5, 5, false);

result := WaitOption('All', 500);
end;

GlobalCount, like the name suggests is set globally in a different function

BraK

2010-09-23 15:00:34

Here check my withdraw proc for my herblore script it finds the item wherever it is as long as its visable.

~Brak

Function WithdrawHerbs: boolean;
Var
x, y, i, c, d, AHerbs :integer;
HTPA, HcTPA :TPointArray;
HATPA :T2DPointArray;
begin
result := False;
if not(bankscreen) then
exit;
C := (GetTimeRunning + 15000)
while (GetTimeRunning < c) do
begin
for i := 0 to High(Herbcolor) do
begin
if FindColorsTolerance(HcTPA, HerbColor[i], MBx1, MBy1, MBx2, MBy2, 5) then
HTPA := CombineTPA(HTPA, HcTPA);
end;
begin
HATPA := SplitTPAEx(HTPA, 10, 10);
SortATPAFrom(HATPA,Point(MBx1, MBy1));
for i := 0 to High(HATPA) do
begin
MiddleTPAEx(HATPA[i], x, y);
MMouse(x, y, 5, 5);
if WaitUpTextMulti(Herbtext, 500) then
begin
ClickMouse2(False);
Break;
end;
end;
end;
if Players[CurrentPlayer].Booleans[1] then
AHerbs := 28
else
AHerbs := 14;
If WaitOption('w-'+inttostr(AHerbs), RandomRange(500, 1000)) then
begin
While invcount < 14 do
Begin
Inc(d);
Wait(RandomRange(300, 500));
if d = 10 then
break;
if invcount = AHerbs then
begin
result := (invcount=AHerbs);
exit;
end;
end;
if InvCount > Aherbs then
DoDeposit;
end;
if WaitOption('w-X', RandomRange(300, 600)) then
begin
Wait(RandomRange(600, 900));
TypeSend(inttostr(AHerbs));
while invcount < AHerbs do
begin
Inc(d);
Wait(RandomRange(300, 500));
if d = 10 then
break;
if invcount = Aherbs then
begin
Result := True;
Exit;
end;
end;
end;
end;
begin
Debug('No More Herbs left Switching to Next Player.');
result := false;
CloseBank;
NextPlayer(false);
exit;
end;
end;

I forgot to tell you this is based on a 5 color TIntegerArray.

case Players[CurrentPlayer].Integers[0] of

1 : begin
Players[CurrentPlayer].Strings[PR_HN] := 'Guam';
HerbText := ['gua', 'uam', 'guam'];
HerbColor := [807945, 807433, 609289, 610313, 608521];
HerbColorC := 88; //Grimy>Clean
XP_H := 2.5;
if Players[CurrentPlayer].Integers[7] = 1 then
begin
Xp_P := 25.0;
Players[CurrentPlayer].Strings[PR_PN] := 'Attack Potion';
Secondary := ['Eye', 'e of', 'newt'];
end else
if Players[CurrentPlayer].Booleans[0] then
begin
Debug('unknown Ingredient Check Setup.');
end;
end;

Inspirations

2010-09-23 15:04:47

:o looks really good, I'll study up on it. I think I caught my error, I was using tolerance with the black count which messes it up. I think yours might be better, but I don't want to copy your idea, so I think I might try to incorporate something along the lines of that into my script if I can't get this working. If that is okay with you :)

BraK

2010-09-23 15:06:44

Meh you can use it just cred me on it. It'll take alot of modifying to get to work else where anyway.

~Brak

Markus

2010-09-23 16:29:37

Moved at request.

I'm not completely sure on MSI's Blacklists, but I know that Boreas' old implementation (2007) cut off the top X pixels in order to prevent messing around like this (stack size), or at least had an option for it to do.

But seeing as you're doing this just for members, I have one tip for you: KISS ;) DTMs are accurate enough. Really.

Inspirations

2010-09-23 16:43:51

From: Markus
Moved at request.

I'm not completely sure on MSI's Blacklists, but I know that Boreas' old implementation (2007) cut off the top X pixels in order to prevent messing around like this (stack size), or at least had an option for it to do.

But seeing as you're doing this just for members, I have one tip for you: KISS ;) DTMs are accurate enough. Really.


well this isn't specifically for members, I want to use it too. And I figure I might aswell expand my horizon while I'm at it :) Besides it would take a loooong time to make all the dtms :p

i luffs yeww

2010-09-24 03:47:20

:p DTMs only take 15-20 seconds, really.

NCDS

2010-09-24 09:21:38

From: Inspirations
well this isn't specifically for members, I want to use it too. And I figure I might aswell expand my horizon while I'm at it :) Besides it would take a loooong time to make all the dtms :p


Also keep in mind DDTM's.

A single DTM can be used for a type of tool or rune or something, then just do a simple color recognition to decide what your looking at.

BraK

2010-09-24 10:02:42

From: NCDS
Also keep in mind DDTM's.

A single DTM can be used for a type of tool or rune or something, then just do a simple color recognition to decide what your looking at.


I'm going to have to look into them more in depth there NCDS. I do Like the concept.

Inspirations

2010-09-24 13:27:53

From: NCDS
Also keep in mind DDTM's.

A single DTM can be used for a type of tool or rune or something, then just do a simple color recognition to decide what your looking at.


A DDTM can only be used for the same object with a different color. Cooking would require me to make a DTM for each fish type, which do not have the same shape. Collecting a blacklist number seems to be much easier. I've decided to combine a color recognition and a blacklist length check. I think it should provide me with the results I'm looking for. I'll post it up when I finish and you guys could critique it for me if that's cool :)

From: i luffs yeww
:p DTMs only take 15-20 seconds, really.


not for me :p besides like 15 of them would take me forever

NCDS

2010-09-24 14:44:59

From: Inspirations
A DDTM can only be used for the same object with a different color. Cooking would require me to make a DTM for each fish type, which do not have the same shape. Collecting a blacklist number seems to be much easier. I've decided to combine a color recognition and a blacklist length check. I think it should provide me with the results I'm looking for. I'll post it up when I finish and you guys could critique it for me if that's cool :)



not for me :p besides like 15 of them would take me forever


Check out Fishing.Simba in MSI and you may get a better understanding of what I was saying ;)

And of course, I'm always down to critique some code!

Inspirations

2010-09-24 14:54:03

okay well so far this has been working for me quite nicely, although I think I might make a global variable to hold the bankslot the item is in so it only actually has to search once.

here's code, critique away please :)

function WithdrawBank: Boolean;
var
TPA: TPointArray;
Area: TBox;
I, L, II: Integer;
Index: TIntegerArray;
BlackCount: Integer;
TP: TPoint;
x, y: Integer;
begin
for I := 1 to 25 do
begin
SetArrayLength(TPA, 0);
Area := BankIndexToMSBox(I);
BlackCount := CountColor(BlackColor, Area.x1, Area.y1+5, Area.x2,
Area.y2);
writeLn('Slot['+IntToStr(I)+']: BlackCount = '+IntToStr(BlackCount));
if InRange(BlackCount, GlobalCount-10, GlobalCount+10) then
begin
L := GetArrayLength(Index);
SetArrayLength(Index, L+1);
Index[L] := I;
end;
end;

writeLn('Length Index = '+IntToStr(Length(Index)));
if Length(Index) = 0 then
Exit;

for II := 0 to high(Index) do
begin
Area := BankIndexToMSBox(Index[II]);
FindColorsTolerance(TPA, GlobalColor, Area.x1, Area.y1, Area.x2, Area.y2, 5);
if Length(TPA) > 0 then
begin
TP := BankIndexToMSPoint(Index[II]);
MMouse(TP.x+5, TP.y+10, 5, 5);
getMousePos(x, y);
if waitOptionMulti(['aw', 'Raw', 'awr'], 500) then
begin
writeLn('Found '+Capitalize(Players[CurrentPlayer].Strings[0])+
' at Bank Index '+IntToStr(Index[II]));
Mouse(x, y, 0, 0, false);
result := WaitOption('All', 500);
if result then
Exit;
end;
end;
end;
end;

Gold

2010-09-24 16:09:52

So, could this be converted for banking tuna and swordfish?

Inspirations

2010-09-24 16:59:16

easily, just set the globalcount and globalcolor to that of a swordfish or tuna ;)