This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
crazylady77's profile picture

ATM system

Started by crazylady77, 06 August 2012 - 08:39 AM
crazylady77 #1
Posted 06 August 2012 - 10:39 AM
Im trying to create a atm system for computer craft using a disk. I need withdraw and deposit. For withdraw you cannot go past the intger stored in /disk/bal deposit it adds to the /disk/bal . I also need a script to display the balance.



Please note that im using a file called bal to have the amount of money stored
Noodle #2
Posted 06 August 2012 - 10:49 AM
You could use the FS api to open the files and edit them..
You could use rednet to communicate the money of the people.
crazylady77 #3
Posted 06 August 2012 - 11:06 AM
I already have that setup. I need some code to read the amount and check it to make sure that the inputed amount is not more than the ammount in the balance file.
And then the script to add the money
Noodle #4
Posted 06 August 2012 - 11:08 AM
Well, you could use tables. When you turn off the computer that table will no longer be there.
So I would suggest using files to write the amounts then compare the two to see if anyone has edited theirs.
crazylady77 #5
Posted 06 August 2012 - 11:24 AM
I am using a file, I just need something that will not allow it to go over the amount that is inside the balance file. I also need something to add to the balance file