Wanted Posted December 12, 2011 Share Posted December 12, 2011 https://github.com/OSI1/OSI1/commit/5b02c1be417213453d2e08df393ebc1d75c8db95 So I have been getting a lot of requests and such to finish banking, I spent a long time today and manged to get everything done except for actual banking opening functions (NPCBank, OpenBooth, OpenBank etc.) however there are now 18 new banking functions in OSI. Here's a complete list of OSI banking functions * function BankScreen: Boolean; By: Wanted * function PinScreen: Boolean; By: Wanted * function EnterBankPin(Pin: string): Boolean; By: Wanted * function CloseBank(CheckBS: Boolean): Boolean; By: Wanted * function DepositAllEx(CheckBS, Inv, Equip, Summon: Boolean): Boolean; By: Wanted * function DepositAll(CheckBS: Boolean): Boolean; By: Wanted * function DepositItemsEx(Slots: TIntegerArray; Exclude: Boolean; CheckBS: Boolean): Boolean; By: Wanted * function DepositItems(Slots: TIntegerArray; CheckBS: Boolean): Boolean; By: Wanted * function DepositAllExclude(Exclude: TIntegerArray; CheckBS: Boolean): Boolean; By: Wanted * function ToggleUseNotes(Use: Boolean): Boolean; By: Wanted * function ToggleSwapMode(Use: Boolean): Boolean; By: Wanted * function SearchBank(CheckBS: Boolean; SearchText: string): Boolean; By: Wanted * function BankShowEquipStats(CheckBS: Boolean): Boolean; By: Wanted * function FixBank(FixUp: Boolean): Boolean; By: Wanted * function GetBankSlotIndex(Row, Column: Integer): Integer; By: Wanted * function GetBankSlotBounds(Slot: Integer): TBox; By: Wanted * function GetBankTabBounds(Tab: Integer): TBox; By: Wanted * function CordsToBankSlot(P: TPoint): Integer; By: Wanted * function BankItemExists(Slot: Integer; CheckBS: Boolean): Boolean; By: Wanted * function MouseBankItem(Slot: Integer; TypeC: ClickActions; CheckBS: Boolean): Boolean; By: Wanted * function DragBankItem(FromSlot, ToSlot: Integer; CheckBS: Boolean): Boolean; By: Wanted * function GetCurrentBankTab: Integer; By: Wanted * function BankTabExists(Tab: Integer): Boolean; By: Wanted * function SetBankTab(Tab: Integer; CheckBS: Boolean): Boolean; By: Wanted * function WithdrawEx2(Options: TStringArray; B: TBox; CheckBS: Boolean): Boolean; By: Wanted * function WithdrawEx(Amount: Integer; B: TBox; CheckBS: Boolean): Boolean; By: Wanted * function WithdrawSlotEx(Options: TStringArray; Slot: Integer; CheckBS: Boolean): Boolean; By: Wanted * function Withdraw(Amount, Slot: Integer; CheckBS: Boolean): Boolean; By: Wanted Notice the differences in DepositEx / DepositItems Exclude ... these same type of changes were done in inventory.scar with the drop functions. This will make your lives easier. You now have DropItems, and DepositItems. Here's dome debugs and indexes Withdraw can be used a few ways Either you can use it with a slot index (this will scroll the bank up when you do so) or you can use it with a B: Box for mouse box. You can (if you want to) use Ex to put in your own text to use with chooseoption, however the other one is quite powerful You can use it like such Withdraw(Withdraw_All_But_One, 0, True); Withdraw(5, 0, True); Withdraw(68432, 0, True); it will automatically do what's appropriate (withdraw-x, custom saved withdraw, existing withdraw, left click no chooseoption.. etc Here are the new indexes {=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= const Withdraw function indexes Contributors: Wanted Description: Index handles for withdrawing routines. Date Created: December 11th, 2011. By Wanted. RS2 Build 688. Last Modification: December 11th, 2011. By Wanted. RS2 Build 688. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=} const Withdraw_1 = 1; Withdraw_5 = 5; Withdraw_10 = 10; Withdraw_All = -1337; Withdraw_All_But_One = -13337; Unfortunately I had to add captial 'A' to the trim in chooseoptions because the OCR doesn't like it either ... like the i, and y (sometimes space) There's a few other small things I changed but this is everything notable Enjoy! I hope to get the bank opening functions done sometime in the next few days -Wanted Quote Link to comment Share on other sites More sharing options...
wyn10 Posted December 12, 2011 Share Posted December 12, 2011 Sweet. I can't wait to test these out when it comes to it. Also does "lot of requests" mean me bugging you for a week. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted January 14, 2012 Share Posted January 14, 2012 Withdraw routines have a small issue. Just tried to withdraw 3 and it selected 30. If you attempt to withdraw 4 and the option 42 exists it will select 42. You get the idea... Ran into the same issue when I wrote my own withdraw routines (before OSI had banking). Can't recall how I solved it and cbf to look it up before heading off to bed. Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 14, 2012 Author Share Posted January 14, 2012 Probably something simple, I'll look at it and figure it out soon Quote Link to comment Share on other sites More sharing options...
rsutton Posted January 14, 2012 Share Posted January 14, 2012 wow wyn still here, hey bro where ya been Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 21, 2012 Author Share Posted January 21, 2012 Withdraw routines have a small issue. Just tried to withdraw 3 and it selected 30. If you attempt to withdraw 4 and the option 42 exists it will select 42. You get the idea... Ran into the same issue when I wrote my own withdraw routines (before OSI had banking). Can't recall how I solved it and cbf to look it up before heading off to bed. I haven't forgot about this, I plan on finding this.. implementing SMART debug canvas shit, and probably some other stuff by the end of tomorrow to OSI... like XP Bar stuff and other random stuff. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted January 21, 2012 Share Posted January 21, 2012 It wasn't a big deal. Just something to be aware of. Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 23, 2012 Author Share Posted January 23, 2012 Wow that was a crazy easy bug to fix but incredibly hard to diagnose and I almost said it was non-reproducible. Simply added the '-' and + ' ' in Options := ['-' + IntToStr(Amount) + ' '];]; Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted February 23, 2012 Share Posted February 23, 2012 Testing new version of my superheater and as a consequence am paying super attention to everything to ensure I have the bugs out. I have noticed one banking issue that is fairly consistent. It doesn't happen every time but it does happen a lot. The first time banking (which is almost right away according to the flow of my script) after SMART has just loaded: The deposit works fine, then when it calls WithdrawEx the option menu pops up and it fails to select anything. Watching the screen closely I notice the spacing of the option text takes a huge jump almost right away. You can literally watch the characters slide to the right. After that the spacing is much more consistent. So when I stop the script and restart it things work. Related? Just for giggles just tried this using the browser as a client (man I had forgotten how *fast* it is compared to using SMART) and it works fine with the web browser. Sitting here typing this I just realized fully 60-70% (or more) of all my SCAR issues are centered around SMART in one way or another. Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted February 23, 2012 Share Posted February 23, 2012 Testing new version of my superheater and as a consequence am paying super attention to everything to ensure I have the bugs out. I have noticed one banking issue that is fairly consistent. It doesn't happen every time but it does happen a lot. The first time banking (which is almost right away according to the flow of my script) after SMART has just loaded: The deposit works fine, then when it calls WithdrawEx the option menu pops up and it fails to select anything. Watching the screen closely I notice the spacing of the option text takes a huge jump almost right away. You can literally watch the characters slide to the right. After that the spacing is much more consistent. So when I stop the script and restart it things work. Related? Just for giggles just tried this using the browser as a client (man I had forgotten how *fast* it is compared to using SMART) and it works fine with the web browser. Sitting here typing this I just realized fully 60-70% (or more) of all my SCAR issues are centered around SMART in one way or another. Yeah this was an issue i was having, I would also get the Text.scar error right after it quit. But i didnt think to use the browser as my scripts are imbedded into smart =/ Have you tried uping the refresh rate bar on the side of smart? Its default is 26 or something in all my script i push it up to about 29 and havent had that issue quite as often. [scar]SmartSetRefresh(29); [/scar] Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted February 23, 2012 Share Posted February 23, 2012 Yeah this was an issue i was having, I would also get the Text.scar error right after it quit. But i didnt think to use the browser as my scripts are imbedded into smart =/ Have you tried uping the refresh rate bar on the side of smart? Its default is 26 or something in all my script i push it up to about 29 and havent had that issue quite as often. [scar]SmartSetRefresh(29); [/scar] Hmm. Worth trying. I manually set it down so I can do other things at the same time. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted February 25, 2012 Share Posted February 25, 2012 Still doing it on my test machine. And to make it more fun this usually results in SCAR crashing when I try to quit. All of which only happens when running my script, which means there is something still not quite right with my script. I give up. Going back to being a leech and just running other peoples scripts. Life is simpler that way. Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted February 25, 2012 Share Posted February 25, 2012 Still doing it on my test machine. And to make it more fun this usually results in SCAR crashing when I try to quit. All of which only happens when running my script, which means there is something still not quite right with my script. I give up. Going back to being a leech and just running other peoples scripts. Life is simpler that way. Lol... this is another thing i added to my open bank that i think may of fixed the issue. Try this: [scar] repeat Try OpenBankEX(Cut_Loc[CurrentPlayer],True,True,True); except Wait(1000); end; wait(1000); until BankScreen or (T < GetSystemTime); [/scar] Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted February 27, 2012 Share Posted February 27, 2012 Whats up with banking method? For some reason it takes a few seconds longer when closing the bank screen. Im a second Nazi, its not a big deal but was wondering what changed. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted March 26, 2012 Share Posted March 26, 2012 Is there a particular reason the banking routines are noticeably slower lately? In particular the deposit and withdraw routines (especially the deposit) are decidedly slower. Have heard from others they are experiencing the same thing. Quote Link to comment Share on other sites More sharing options...
Wanted Posted March 26, 2012 Author Share Posted March 26, 2012 Jagex trolling as usual probably, I'll look into it when I have time. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted March 26, 2012 Share Posted March 26, 2012 Just for kicks hacked together a custom deposit routine that basically does the exact same thing as OSI's DepositAllExclude and it runs approx 1.5x faster. Runs at about the speed the OSI routines used to, but haven't for a couple of OSI updates. Wish I had taken notice exactly when it started happening. Quote Link to comment Share on other sites More sharing options...
Wanted Posted March 26, 2012 Author Share Posted March 26, 2012 Just for kicks hacked together a custom deposit routine that basically does the exact same thing as OSI's DepositAllExclude and it runs approx 1.5x faster. Runs at about the speed the OSI routines used to, but haven't for a couple of OSI updates. Wish I had taken notice exactly when it started happening. When I originally wrote these functions they were made in a way where there was no possible faster way. It would be helpful the most to me to explain what you changed.. in order to save me some diagnostic time. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted March 26, 2012 Share Posted March 26, 2012 (edited) Give me a few. I'll throw together that contains just the 2 routines. To test this login ahead of time and open the bank (leave the bank open and enable smart and press play). I had the following inventory setup: - 1 item in slot 0 (which will get excluded). - 10 of another item. - 10 of yet another item. Comment/uncomment lines 39 and 40 to change which method to use. Comment/uncomment line 27 to add a pause for menu to go away between deposits (slows it down a bit). program new; {$DEFINE RS2} {$DEFINE OSI_COLOR_ANTI_RANDOMS} // Comment out to disable random handling. {$DEFINE SMART} // Comment out to disable smart client. {$I OSI\OSI.scar} function MyDepositItems(ExcludeSlots: TIntArray): Boolean; var DepositSlots: TIntArray; ItemBox: TBox; I: Integer; begin Result := False; DepositSlots := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]; for I := 0 to High(ExcludeSlots) do TIARemove(DepositSlots, ExcludeSlots[i]); for I := 0 to High(DepositSlots) do begin if InvItemExists(DepositSlots[i]) then begin ItemBox := GetItemBounds(DepositSlots[i]); ItemBox := Box((ItemBox.X1 + 1), (ItemBox.Y1 + 1), (ItemBox.X2 - 1), (ItemBox.Y2 - 1)); MouseBox(ItemBox.X1, ItemBox.Y1, ItemBox.X2, ItemBox.Y2, ClickRight); ChooseOptionMulti(['t-A', 'All', 'posit']); WaitFunc(@OptionBoxExists, False, 5, 10, 2500, 5000); end; end; end; procedure TestBanking; var ExcludeSlots: TIntArray; // Inventory slots to not deposit. begin ExcludeSlots := [0]; // Deposit items. DepositAllExclude(ExcludeSlots, False); // MyDepositItems(ExcludeSlots); end; procedure ScriptTerminate; begin FreeOSI; end; begin SetUpOSI; TestBanking; end. OSI's DesositAllExlcude: Successfully executed (27727.6478 ms)MyDepositItems (without wait for menu): Successfully executed (8253.1003 ms) MyDepositItems (with wait for menu): Successfully executed (9827.8091 ms) This was running inside a VM so both routines are a bit slower than running full speed outside a VM. Times were fairly consistent across several runs. Edited March 26, 2012 by Bixby Sayz Quote Link to comment Share on other sites More sharing options...
Wanted Posted March 30, 2012 Author Share Posted March 30, 2012 Give me a few. I'll throw together that contains just the 2 routines. To test this login ahead of time and open the bank (leave the bank open and enable smart and press play). I had the following inventory setup: - 1 item in slot 0 (which will get excluded). - 10 of another item. - 10 of yet another item. Comment/uncomment lines 39 and 40 to change which method to use. Comment/uncomment line 27 to add a pause for menu to go away between deposits (slows it down a bit). program new; {$DEFINE RS2} {$DEFINE OSI_COLOR_ANTI_RANDOMS} // Comment out to disable random handling. {$DEFINE SMART} // Comment out to disable smart client. {$I OSI\OSI.scar} function MyDepositItems(ExcludeSlots: TIntArray): Boolean; var DepositSlots: TIntArray; ItemBox: TBox; I: Integer; begin Result := False; DepositSlots := [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27]; for I := 0 to High(ExcludeSlots) do TIARemove(DepositSlots, ExcludeSlots[i]); for I := 0 to High(DepositSlots) do begin if InvItemExists(DepositSlots[i]) then begin ItemBox := GetItemBounds(DepositSlots[i]); ItemBox := Box((ItemBox.X1 + 1), (ItemBox.Y1 + 1), (ItemBox.X2 - 1), (ItemBox.Y2 - 1)); MouseBox(ItemBox.X1, ItemBox.Y1, ItemBox.X2, ItemBox.Y2, ClickRight); ChooseOptionMulti(['t-A', 'All', 'posit']); WaitFunc(@OptionBoxExists, False, 5, 10, 2500, 5000); end; end; end; procedure TestBanking; var ExcludeSlots: TIntArray; // Inventory slots to not deposit. begin ExcludeSlots := [0]; // Deposit items. DepositAllExclude(ExcludeSlots, False); // MyDepositItems(ExcludeSlots); end; procedure ScriptTerminate; begin FreeOSI; end; begin SetUpOSI; TestBanking; end. This was running inside a VM so both routines are a bit slower than running full speed outside a VM. Times were fairly consistent across several runs. Should be fixed after you read this http://forums.scar-divi.com/showthread.php?1212-IMPORTANT-Tab-Screen-Check-Restructure-UPDATE-YOUR-SCRIPTS-NOW-OSI-Dev-3-30-12 Quote Link to comment Share on other sites More sharing options...