SRL Archive - MSI Suggestions

Banking.scar check


NCDS

2009-09-18 00:13:52

Ok so, this is where I'm at so far:

//Used to find and withdraw/deposit items defined by ItemType and ItemMaterial.
//BankTool(True, Tool_Axe, Axe_Rune, 1);
function BankTool(Withdraw: Boolean; ItemType: TIntegerArray; ItemMaterial, Amount: Integer): Boolean;
begin

end;

I have ItemType as an array because I'm going to make it be able to accept specified slots as well.

I'm trying to get this function to be able to do all banking tasks. With that said I have a few questions, should I add a parameter to open the bank? are there any other things that need to be included? and any other input is appreciated.

Coh3n

2009-09-18 02:09:00

Looks good. I think you should add a parameter to open the bank, or just have it open the bank to begin with. After all, it is a banking function. ;)

NCDS

2009-09-18 02:10:46

From: Coh3n
Looks good. I think you should add a parameter to open the bank, or just have it open the bank to begin with. After all, it is a banking function. ;)


Yeah I just didn't know if I should leave the opening of the bank seperate or not. I can add it no problem though.

Coh3n

2009-09-18 02:34:58

From: NCDS
Yeah I just didn't know if I should leave the opening of the bank seperate or not. I can add it no problem though.


Considering it's only like one line because of the SRL functions, I'd say it's not a big deal.

Blumblebee

2009-09-18 05:31:12

I dunno I dont think we need to overcomplicate a function. We should break them up somewhat, things get too confusing if everything if jumbled together.

NCDS

2009-09-18 06:18:17

From: Blumblebee
I dunno I dont think we need to overcomplicate a function. We should break them up somewhat, things get too confusing if everything if jumbled together.


I agree that it can sometimes. I'm just going off what Rm mentioned before about an all in one function.

Coh3n

2009-09-18 06:37:27

From: Blumblebee
I dunno I dont think we need to overcomplicate a function. We should break them up somewhat, things get too confusing if everything if jumbled together.


That's a good point. Because it's like trying to carry 500 lbs from one place to another. It would be much easier to carry 50 lbs, 10 times, rather than all at once. Sorry for the bad analogy, but it was all I could think of right now. :p

It's like my object finding functions. They could be made into two functions, but they both would be massive. I think it would be smarter to make smaller, more manageable functions.

Since this is basically going to be an AIO script, we may as well make it as simple as we can for when it exceeds 10000 lines.

NCDS

2009-09-18 06:54:48

So does anyone have any suggestions then?

We may as well just use normal SRL OpenBankFast or whatever in that case to open them.

Coh3n

2009-09-18 06:59:23

From: NCDS
So does anyone have any suggestions then?

We may as well just use normal SRL OpenBankFast or whatever in that case to open them.


May as well, unless for some reason, that way sucks and we come up with a much better, faster way, something that would probably get replaced with the current functions anyway.

But yeah, I think we should just use the normal functions, it seems logical to me.

If we want to split the functions up, I would suggest using a different function for tools, maybe one for a specific skill, etc. I think it would be easier to follow and understand that way.

NCDS

2009-09-18 07:25:34

So are you thinkning have like:

BankTool(withdraw: Boolean; ItemType, ItemMaterial, Amount: Integer): Boolean;
for Tools ie hammer, axe etc.
and:

BankItem(Withdraw: Boolean; ItemType, ItemMaterial, Amount: Integer): Boolean;
for Skill Items?

It just seems like it can all be combined quite simply.


Edit: RM if you read this thread please post. I would like your opinion on this as well. and Cazax!

Blumblebee

2009-09-18 07:33:47

From: NCDS
So are you thinkning have like:

BankTool(withdraw: Boolean; ItemType, ItemMaterial, Amount: Integer): Boolean;
for Tools ie hammer, axe etc.
and:

BankItem(Withdraw: Boolean; ItemType, ItemMaterial, Amount: Integer): Boolean;
for Skill Items?

It just seems like it can all be combined quite simply.


Edit: RM if you read this thread please post. I would like your opinion on this as well. and Cazax!


item == tool. That idea is a waste. Banking should be separate from withdrawal IMO, I think MS finding and MI finding are too drastic to change unless you use a TBox and set it at the start of the Function. I'm fine with any direction you take it, maybe make BankTool first see how long/confusing it is and then decide if you want to break it up.

NCDS

2009-09-18 07:40:03

From: Blumblebee
I'm fine with any direction you take it, maybe make BankTool first see how long/confusing it is and then decide if you want to break it up.


I can do that. Then I'll post and we can all decide.

Cazax

2009-09-18 07:41:54

From: NCDS

Edit: RM if you read this thread please post. I would like your opinion on this as well. and Cazax!

Lol :p
I agree with Bumblebee tools and items should be treated as the same, and separate Banking from Withdrawing.

NCDS

2009-09-18 07:44:01

Ok :P

That's probably how it will end up then.

Sir R. M8gic1an

2009-09-18 10:01:30

Meh, i like the withdraw boolean :p But they are right, it could make the function somehwat large and incomprehensible. Remember to use constants.

About opening the bank that problem is easily solved. First check the other banking thread.

then, there are two things you could do:

if not WaitFunc(@BankScreen, 20, 1000) then
begin
MSIDebug('BankTool', 'Bank is not open', Debug_Force);
exit;
end;

or


if not WaitFunc(@BankScreen, 20, 1000) then
begin
MSIDebug('BankTool', 'Bank is not open', Debug_Force);
if MSI_OpenBank then
MSIDebug('BankTool', 'Opened bank', Debug_Force)
else
exit;
end;

~RM