[SCRIPT] BOF Bank - easy banking

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
B-O'F
Posts: 724
Joined: Sat, 21. Feb 04, 02:15
x3tc

[SCRIPT] BOF Bank - easy banking

Post by B-O'F » Sat, 29. Dec 07, 22:28

BOF Bank Account

2007-12-29 Version 1 released.

Here it is, really easy banking - as easy as putting your excess cash under the mattress - but not as lumpy.

Just like putting your money under the mattress, there are no charges, no interest is paid, no overdrafts, and there are no standing orders.

Just like putting your money under the mattress, all transactions - Deposit, Withdrawal, and Balance check - are made in one location (command slot) - no more having to go to different windows/tellers/command slots for each different transaction.

The whole idea is to make banking easier for you (but I draw the line at supplying the money):-
- Deposits are positive amounts
- Withdrawals are negative amounts
- Balance queries are 'bal' or deposit/withdraw 0 Cr.

Each successful deposit/withdrawal tells you the amount transferred, your current account balance, and how much is left in your wallet - all in one pop-up message with comma separated amounts. Error messages are also pop-up, so you can see the error immediately, and re-enter it correctly.

Now you no longer have to go and find your personal details to find out how much is in your wallet, then find the correct command slot for your deposit or withdrawal, and then find the success/fail message in your logbook etc.

Ease of use extends to entering the amount you want to transfer - and even this can be customised.


Opening an account;
Just go to BOF Bank in your Piracy commands (old habit, piracy - there are not many free slots), and enter a positive amount to transfer from your wallet.


Entering Transaction requests:
All entries are case insensitive - so you can use upper-case, lower-case, or a combination (this is built in, so I won't forget to include the library this time...).

'bal' or 0 - you get a statement of the current bank balance, and how much is in your wallet.
amount (with or without a '+' sign) - is counted as a deposit
amount with a '-' sign is a withdrawal
amounts are up to the 2 billion limit
if a withdrawal would take your wallet contents above the 2 billion limit, it is cancelled and you get a warning message.

Signs can be leading or trailing
Amounts are numeric - with a few extras to make it easier to enter the required amounts.

Suppose you wanted to transfer one billion two hundred thousand credits, you would normally have to enter: 1200000000 - it is not easy keeping track of the zeros, and the 'anti-keyboard bounce' does not help.
You can still enter the amount this way, or you can enter
1,200,000,000 or
1 200 000 000 or
1,200,000t or
1,200m or
(the easiest) 1.2b or 1.2 B

You can even enter 0.000000001b to transfer 1 Credit, but that is rather a lot of (pointless - yup, a pun) work.

Valid characters are:-
digits 0 to 9 (obviously!)
+ or - to indicate the type of transaction, they can be leading or trailing (+ is not essential)
, (comma) as a separator
space as a separator
t to indicate thousands
m to indicate millions
b to indicate billions
. (full stop / period) to indicate a decimal point (only valid with a t/m/b multiplier)

The bal, b, m, t, comma, and period can be changed in the t-file for easy customisation (see below), and do not need to be single characters.
The space, +, and - characters can not be changed (I do not know of a reason why they should be changeable).


Why should I use it?
Only one command slot
It is free (the best reason)
It is very easy to use (nearly the best reason, but it is hard to beat free)


Installation:
The .zip file contains a .spk file for those that use Cycrow's installer, and the .xml files for those that prefer to know what is being installed, or just want to look at the files.


Uses:
Command: COMMAND_TYPE_PIRACY_47 (647) - all the General ones are taken
t-file: 8898

Available courtesy of Xai Corp.
BOF Bank.zip .zip file which includes the .spk and the .xml files.




Messages:
Successful transactions -

Withdrawal:
x,xxx Cr. withdrawn from bank account
Current balance is: x,xxx,xxx Cr.
Your wallet contains: x,xxx,xxx Cr.

Deposit:
An account has been opened for you.

x,xxx Cr. added to bank account
Current balance is: x,xxx,xxx Cr.
Your wallet contains: x,xxx,xxx Cr.

Invalid Transactions -

You have requested a Balance Statement, but do not have an existing account.
You have requested a Withdrawal, but do not have existing account.
Insufficient funds in bank account.
Insufficient funds in your wallet.
Would take your money over the 2 billion limit.
Amount entered is over the 2 billion limit.

These are followed by -
Transaction cancelled.


Invalid input -
Invalid input:- {your input}

Followed by whichever reason -
Both + and - found.
More than one multiplier found.
Decimal point found, but no multiplier.
More than one decimal points found.
Too many digits after decimal point.
Unrecognised character in string

Followed by -
Transaction cancelled


Customisation:

The decimal point, separator (comma), 'bal' and the multipliers can easily be changed in the 448898 t-file.
The appropriate section is reproduced here.
For example, to change the decimal point to a comma, and the separator to a period, just change:-
<t id="1">.</t> to <t id="1">,</t> and
<t id="2">,</t> to <t id="2">.</t>

Or to change the 't' for thousands to 'k'
<t id="3">t</t> to <t id="3">k</t>

Similarly for any other required changes.

From the t-file.

<page id="8898" title="Messages" desc="Messages to the player">

<!-- decimal point $point-->
<t id="1">.</t>

<!-- thousands separator $comma -->
<t id="2">,</t>

<!-- short form of thousands $t -->
<t id="3">t</t>

<!-- short form of millions $m -->
<t id="4">m</t>

<!-- short form of billions $b -->
<t id="5">b</t>

<!-- short form of balance $bal -->
<t id="6">bal</t>

=============================
Enjoy,
Boron - Ol Fh'art
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.

jlehtone
Posts: 21809
Joined: Sat, 23. Apr 05, 21:42
x4

Post by jlehtone » Sat, 29. Dec 07, 22:45

I've heard of a Teladi Mogul who would like to do daily deposits of one billion Credits each, but is worried that the banks may not be able to garantee the safety of extended deposits. Particularly the smaller players in the banking set the ceiling at two deposits. My old eyes failed to catch the small print about such detail in otherwise interesting advertizement.


Free, easy, and Piracy? :gruebel:
Goner Pancake Protector X
Insanity included at no extra charge.
There is no Box. I am the sand.

B-O'F
Posts: 724
Joined: Sat, 21. Feb 04, 02:15
x3tc

Post by B-O'F » Sat, 29. Dec 07, 23:06

Hi jlehtone,

Yes, it is in the piracy section, as that had a free slot... that is also the section that has most of my other scripts - for some strange reason...

As usual, all my scripts carry a full money back guarantee - if they fail to work correctly you get back the cost of the script...

I often have to transfer a billion or more at a time, due to all the people making contributions to the 'Help make the Ol Fh'art even richer Fund' via my other scripts. I thank you all from the bottom of my wallet, please don't stop...

In fact, it was all those contributions that made me write this script, as the banking script I was using required all those zeros to be entered. I wrote a front-end for it to allow me to enter 1 b instead of the 1 and all those zeros (the eyesight is not as good as it was).. and it grew from there.

Have fun, I am,
Boron - Ol Fh'art
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.

eladan
Posts: 7168
Joined: Sat, 7. Jan 06, 16:01
x4

Post by eladan » Sun, 30. Dec 07, 08:01

Hi B-O'F, if you've done your usual thorough job on this, it should be a very nice script. Downloading. :wink:

MJALowe
Posts: 461
Joined: Fri, 5. Jan 07, 06:27
x3

Post by MJALowe » Sun, 30. Dec 07, 08:06

whats the max account limit? *crosses fingers* i've noted problems when working on my scripts with numbers that go over 2b - had to store 1b as 1 in a seprate variable and put some checks in

B-O'F
Posts: 724
Joined: Sat, 21. Feb 04, 02:15
x3tc

Post by B-O'F » Sun, 30. Dec 07, 11:45

Hi MJALowe,

Sorry, I did not put that in the ReadMe - the billions are split off and handled separately. So the maximum amount that can be held in the bank account is just over 2 billion, (2 billion in hex) billion... I thought that was enough - even for me.

Individual transactions are capped at 2 billion, as that is all the game allows in the player's wallet.

This is all explained in the script - it is well documented and you can sit and read it - not a 'whodunit', but a 'howhedunit'.....

Something else that I did not put in the ReadMe - as usual the script is available for anyone to use, read, learn, modify or anything else that they want.

So you can uncross your fingers now... it should make typing easier...

@ eladan : I hope that it lives up to your expectations, as I said above, it is well documented......

Boron - Ol Fh'art
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.

MJALowe
Posts: 461
Joined: Fri, 5. Jan 07, 06:27
x3

Post by MJALowe » Sun, 30. Dec 07, 12:30

well, havening downloaded it and read through it with the x3script editor i now understand what you said....max account balance is 2 billion billion....or if typed out - 2,000,000,000,999,999,999 ?

it seems like it should be compatible with T.U.B.S., checking now - looks like both could run at the same time safely, one like a real world bank account (including automatic deposits and withdrawls), the other (as stated in OP) like sticking your money under your matress....

VERY nice....now to write an interchanger script
*grin* use yours to handle deposits/withdrawls, and the other for the automatic transfers (i couldn't care less about the interest)

edit:
so if i change "bof.bank.account.player" to "plugin.banking.account" and the index numbers of acount to 1 and 2 instead of 0 and 1, and remember to start a t.u.b.s. account first this script should let me withdrawl and deposit from t.u.b.s. right? or am i completely insane? or are the values here stored as a string instead of a number?
Last edited by MJALowe on Sun, 30. Dec 07, 13:08, edited 1 time in total.

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 30. Dec 07, 12:31

Out of curiosity, why not use k as thousand?

B-O'F
Posts: 724
Joined: Sat, 21. Feb 04, 02:15
x3tc

Post by B-O'F » Sun, 30. Dec 07, 13:15

Hi MJALowe,

Yes, you can use both together - I did while writing and testing this one. I was using an older version of TUBS - about 1.5, I think...

For the max amount it is 2 billion in hex = 2,147,483,648 billions plus the small change.

An interchange script is possible - I wrote a very quick script to transfer the money from TUBS to my new account. As it was an older version of TUBS, I won't give the full details - as I am not certain if they would be compatible with the latest TUBS. Just find the data in the globals and transfer as required.

EDIT: In response to your edit - try it and see. The values are stored as numbers in both scripts, and those are the index numbers I used to transfer my money across. It should work correctly.. but as ever, you change scripts at your own risk.. just don't save until you are happy that it is working as you want.
No testing and trying = no learning..
/EDIT.

@s9ilent: I did think about using k as thousands - but I was not sure how common or popular this would be. As a programmer of many years standing - and even more sitting - I am used to using k. This was one of the reasons for making it easily customisable via the t-file.

Boron - Ol Fh'art
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.

MJALowe
Posts: 461
Joined: Fri, 5. Jan 07, 06:27
x3

Post by MJALowe » Sun, 30. Dec 07, 13:28

so it should be 2,147,483,648,999,999,999 (cause it increments the billions every time it reaches 1 billion) ?

B-O'F
Posts: 724
Joined: Sat, 21. Feb 04, 02:15
x3tc

Post by B-O'F » Sun, 30. Dec 07, 13:48

Hi MJALowe,
That sounds about right - I have not actually checked the maximum yet, as I haven't got that much money, but it should be enough for any normal game.. thinks: how long would you have to play to reach anywhere near the maximum???

If that is not enough money for you, then you could always adapt the script to add in another counter to cope with the billion billions.... <grin>

Boron - Ol Fh'art
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.

MJALowe
Posts: 461
Joined: Fri, 5. Jan 07, 06:27
x3

Post by MJALowe » Sun, 30. Dec 07, 14:59

naw, i was just checking to see if my math was right, btw....im adding the string checking part of your script into the t.u.b.s. so that t.u.b.s. can handle string entry instead of a number *evil grin* that way i'll get the best of both worlds....

edit: success, and works wonderfully, only had to add it to 3 files and change the incoming variable in 5 files to be string or var/string instead of number or var/number

(altered it so it doesn't remove sign,and so it doesn't seperate the billions, and so it doesnt query)

B-O'F
Posts: 724
Joined: Sat, 21. Feb 04, 02:15
x3tc

Post by B-O'F » Sun, 30. Dec 07, 15:34

Hi MJALowe,

Do you mean that I wasted my time - you would have been happy with the simple front-end to TUBS that I made a long time ago???

Not really, I am glad that you have the best of both scripts - do you want to post your modifications in full, so that others can use both scripts.

Or you can have another thread to supply your changed version of this script.. I have no problems with that. After all, the purpose of all scripts is to extend people's enjoyment of the game. I am sure that the different front end, and the tried and tested TUBS would interest quite a few people.

If you do go the separate route, it would be worth checking with Blacky_BPG as he has been working on his script for a long time.

Boron - Ol Fh'art
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.

MJALowe
Posts: 461
Joined: Fri, 5. Jan 07, 06:27
x3

Post by MJALowe » Sun, 30. Dec 07, 15:39

ill post just the modified files, where should i post em, over on blacky's? or here? put it in my sig for now

B-O'F
Posts: 724
Joined: Sat, 21. Feb 04, 02:15
x3tc

Post by B-O'F » Sun, 30. Dec 07, 15:49

Hi MJALowe,

Good question. Depends which files you have modified, if they are just mine - then they could go here. If you have modified Blacky's files - then his permission is required.. I will PM him, so please wait a while.

Boron - Ol Fh'art
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.

MJALowe
Posts: 461
Joined: Fri, 5. Jan 07, 06:27
x3

Post by MJALowe » Sun, 30. Dec 07, 15:57

5 of blackys, with info copied from yours (no unused variable checks from the header)

auto.start
autorun.stat
book
inbound
outbound

and i dont think my sig is updating...(got to figure out how to make links shorter)

edit: and it wasn't the interface that was the "good stuff" it was the autotransfer features, i figured it would be easier to make his more like yours than it would be to make yours more like his

edit2: ya...i put the link to it there...it doesn't get a thread of its own till i get permission, i also got the "Collection" post in my sig....silly 300 character limit (counted before conversion)
Last edited by MJALowe on Mon, 31. Dec 07, 03:57, edited 2 times in total.

B-O'F
Posts: 724
Joined: Sat, 21. Feb 04, 02:15
x3tc

Post by B-O'F » Sun, 30. Dec 07, 16:08

Hi MJALowe,

I have PM'd Blacky_BPG. so we will wait for his reply.

Boron - Ol Fh'art

EDIT: I have just checked Blacky's profile, and no posts since October. There may not be an answer for a while...
I see that MJALowe has posted his update in Collection] All Main Posts
/EDIT
Public Service announcement

Growing old is not a disease - it is a delayed symptom of birth trauma.

Post Reply

Return to “X³: Reunion - Scripts and Modding”