The bank controller's purpose is to allow for custom currency integrations.
All functions shown below are required and the data you provide is completely up to you.
(Usually currency integrations will use Websockets or WWWRequests to be the middle-man for talking between applications)
First you have to enable the LuaScript Integration found in: Shop Editing > Currency Settings.
script_trigger_type ='On Connect';--note:--the withdraw, deposit, getBalance, getRichest, fixedAdjustment --MUST return value(s);functionfixedAdjustment(viewerId,amount)--code to set the viewerId's currency to the exact amountreturn amount; --return the new balanceendfunctiongetRichest(howMany)--this is used for extension leaderboard data. the data returned here will be displayed on the extension--try to grab the top howMany requested and put it into a richest array like so...--this array will be sorted correctly so order doesnt matter, just ensure it's the richest users.local richestArray = { { displayName ='clonzeh', points =1234 }, { displayName ='Person2', points =442 }, { displayName ='Person3', points =14532 } };return richestArray; --return the richest users arrayendfunctiongetBalance(viewerId)--code to check lua balance of viewerId;return1234; --return the balance of the viewerendfunctiondeposit(viewerId,amount)--code to add points to the vieweridlocal newBalance =1234+ amount;--finish codereturn newBalance; --return the new balance of the viewerendfunctionwithdraw(viewerId,amount)local balanceFound =1234;local success =false;if balanceFound > amount then--code to subtract points from the viewerIdlocal newBalance = balanceFound - amount;--if the subtraction works then--set success to true... success =true;return success, newBalance;endreturn success, balanceFound; --return the new balance of the userendfunctionmassDeposit(viewerIds,amounts)--efficiently deposit large amounts points to users...--this is useful if a custom bot currency system has an endpoint to adjust multiple users at once.--or just do it one at a time inside a loop the deposit(viewerId, amount); functionfor key, value inipairs(viewerIds) dodeposit(value, amounts[key]);endendreturnfunction()setupBankController(); --adds all required events for the bank controlling system.--NOTE: All functions above must exist with the same parameters specificed.keepAlive();end