SRL Archive - General

BankMaterials


Gu3st...

2010-12-13 12:53:36

To cope with skills that require items to be taken out of the bank, and not only deposit items, I've added BankObjects to the TScript record.
This means that for each record you can specify what function you want to use to handle banking. Woodcutting and Mining uses BankMaterials, while other skills (like cooking) will have it's custom function.

To add a custom function, just add "BankObjects := @blah;"
to the script record.


When I think about it, it would be better if we had one function named "HandleBanking";
function HandleBanking(WhichSkill) : Bool;
begin
case WhichSkill of
skill_woodcutting: BankMaterials;
skill_mining: BankMaterials;
...
end;
end;
Which makes me think about another function; function MSI_SetupSkill(WhichSkill : Integer): Boolean;…

Sir R. M8gic1an

2010-12-13 17:31:07

Rep'd. The way you present this is really good practice. What, where, why, how and when.

Coh3n

2010-12-13 17:53:11

Nice. :) I don't think there should be separate functions like that. We don't want the include flustered with a hundred case functions. It just means there's more to update when new things are added. ;) I like the way you did it.

Gu3st...

2010-12-14 07:27:34

Thanks to both of you :)
Makes me fell secure about what I am doing.

And I have to agree, Coh3n; a lot of case-s inside many functions would be a mess