SRL Archive - MSI Suggestions

Banking.Scar


Naum

2009-10-14 12:58:34

I've decided to take over NCDS previous production of Banking.Scar.

Please post any functions which would be suitable to add to it. I can't really think of any, so a good outline and description would do me well :).

Thanks!

EDIT: The reason I posted this was because nearly every func I thought of was already in SRL :)

Sir R. M8gic1an

2009-10-14 14:21:49


{ Type TItem
Description: To be used for handling Items in all situations. }
TItem = Record
Name : String;
UpText : TStringArray;
ItemP : TPoint;
Stackable : Boolean;
Colors : TIntegerArray;
DTM : integer;
BMP : integer;
End;

TItemArray: Array of TItem;


function WithdrawStuff(what: TItemArray): boolean;
function DepositStuff(what: TItemArray): boolean;

~RM

Naum

2009-10-14 14:48:45

Hmm, well yeah :). I did something like that, but thought Deposit or Widthdraw would do better.

I will start working on this, just need some info:ninja: :

1. Could any of the records be left empty or defined as 'nil'.
2. Use Bitmaps or DTM's or Colors
3. Make it have a 'how much option'.

However, we can make the 'how much option' for every item in the array. So I thought:

MSI_Deposit(Items : TItemArray; Amounts : TIntegerArray);

So that every value corresponds with the index in each array. :)

Furthermore, for MSI_Withdraw the only thing we can use is Bitmaps on the BankScreen. So should I make a function which withdraws 'X' from the item specified by the bitmap.

Just need some clarification and direction, and i'll get to it.
Apart from that, any more that you would like to see in Banking.scar (directed at everyone).

E: Would you be able to add me to the SVN?

Sir R. M8gic1an

2009-10-14 15:06:45

1. all should eventully be filled up, however if not, DTMs, BMPs and Colors would have te default value, 0.

2. Use all three of them, backing each other up. I'd suggest using BMPs as a first course, if it fails to find it then search for the colors, split it into boxes and then search for the DTM in the right box. Also, you could use ItemP (in the type) to keep track of where you found the item so that next time you don't have to search for it, only confirm that it is there.

3. yes, forgot that.

~RM

Naum

2009-10-14 15:15:20

Thanks for the speedy reply, Rasta.

So mind-map wise:

OpenBank(Using NCDSs) -> Deposit Or Withdraw -> Widthdraw using Bitmaps -> If Bitmap is 0 -> Use Colors -> If Success the log position TP := Point(x, y); ELSE If not success then EXIT; Result := False.
………………………………………|
………………………………………v
………………………………………Deposit using bitmaps -> If bitmap is 0 -> use DTM's -> If DTM is 0 -> Use Color -> If Success, log position in Bank? ELSE Result := False, Exit;

Is what I should do something like that, it's a pretty crap map tbh. Or have I lost the plot?

Sir R. M8gic1an

2009-10-14 15:44:35


~RM

Naum

2009-10-15 16:04:58

Okay, Rasta. I've tried my best on it. It's pretty basic at this moment, but I hope with feedback I can beef it up; thought I would get back to you today - so i'm not slacking :p:

Function MSI_Withdraw(Items : TItemArray; Amount : TIntegerArray) : Boolean;
Var TPA : Array Of TPointArray; //The length is the same as items.colors
ATPA : T2DPointArray;
I, BX, BY, II, DX, DY, XX, YY, Tol : Integer;
BitmapCheck, TextCheck, DTMCheck : Boolean;
WithdrawP : TPoint;
TB : TBox;

Begin
If Not WaitFunc(@BankScreen, 70, 1300) Then //Just in case
Exit
Else
For I := 0 To High(Items) Do
Begin
Repeat
BitmapCheck := FindBitmapToleranceIn(Items[I].BMP, BX, BY, MBX1, MBY1, MBX2, MBY2, Tol);
Inc(Tol);
Until(BitmapCheck) xOr (Tol > 40);

If Not BitmapCheck Then
Begin
SetArrayLength(TPA, High(Items[I].Colors)+1)

For II := 0 To High(Items[I].Colors) Do
FindColors(TPA[II], Items[I].Colors[II], MBX1, MBY1, MBX2, MBY2);

TPA[0] := MergeATPA(TPA);
ATPA := SplitTPA(TPA[0], 5);
DebugATPA(ATPA, '');

For II := 0 To High(ATPA) Do
Begin
TB := IntToBox(ATPA[II][0].x - 50, ATPA[II][0].y - 50,
ATPA[II][0].x + 50, ATPA[II][0].y + 50);

DTMCheck := DTMRotated(Items[I].DTM, DX, DY, TB.x1, TB.y1, TB.x2, TB.y2);
MMouse(DX, DY, 2, 3);
TextCheck := WaitUpTextMulti(Items[I].UpText, 150+Random(30));
If TextCheck Then Break;
End;
End;

If BitmapCheck Or TextCheck Then
Begin
If BX + BY > 0 Then
MMouse(BX, BY, 2, 3);

TextCheck := WaitUpTextMulti(Items[I].UpText, 1200);
GetMousePos(XX, YY);
Result := TextCheck;

If Result Then
Begin
Items[I].ItemP := Point(XX, YY);
WithDrawP := MSTPointToBankPoint(Point(XX, YY));
Withdraw(WithDrawP.X, WithDrawP.Y, Amount[I]);
{ MSIDebug('MSI_Withdraw', 'Withdrew Amount '+IntToStr(Amount[I])+
' Of Item : ''' +Items[I].Name+'''', Debug_SmallDetails); }
End;
End;
End;
End;

I'll make Deposit tomorrow, I kinda will use the base of this for deposit. It shouldn't be hard :).

Coh3n

2009-10-15 19:37:00

Looks good! :)

I would increase the tolerance on the Bitmap by like 5 or so instead of one. Would make it go faster, but that's just my opinion.

Nice work, I'm glad you were chosen. :D You can make up for my lack of activity.

Coh3n

Sir R. M8gic1an

2009-10-15 20:12:20

Var
TPA : Array Of TPointArray; //The length is the same as items.colors
ATPA : T2DPointArray

T2DPointArray = Array of TPointArray;

Also, call your TPA –> ATPA2, cus otherwise it's confusing, cus what it is is actually an Array of TPArray.

Looks good otherwise, will have a closer look in the morning

~RM