ID:147197
 
I've tried to include this into my game



Coding


===========================================================


world.New()
var/savefile/F = new("banks.sav")
F["stuff"] >> accounts
if(accounts == null)
accounts = list()
world.log << "[accounts.len] bank account\s loaded upon world startup."
world.Del()
var/savefile/F = new("banks.sav")
F["stuff"] << accounts
world.log << "[accounts.len] bank account\s saves upon world shutdown."

obj/var/amount
obj/var/owner
obj/var/code
obj/accthing

obj/proc/doublecheck()
for(var/obj/A in accounts)
if(src.code == A.code)
var/fd1 = rand(1,9)
var/fd2 = rand(1,9)
var/fd3 = rand(1,9)
var/fd4 = rand(1,9)
var/fd5 = rand(1,9)
var/fd6 = rand(1,9)
src.code = text2num("[fd1][fd2][fd3][fd4][fd5][fd6]")
for(var/obj/B in accounts)
if(src.code == B.code)
src.doublecheck()

mob/Banker
icon = 'Banker.dmi'
icon_state = "banker"
verb/Banking()
set src in orange(2)
var/firstaction = input("What will you do?","Action?")in list("Create a new account","Access Account","Nothing")
if(firstaction == "Create a new account")
usr << "Creating a new bank account will run you Ten Bucks!"
var/create = input("","Pay ten bucks?")in list("Yes","No")
if(create == "Yes")
if(usr.zenni <= 10)
usr << "You do not have enough money!"
return
else
usr << "Please wait 3 Seconds!"
var/obj/access = new /obj/accthing(locate(0,0,0))
usr.zenni -= 10
var/fd1 = rand(1,9)
var/fd2 = rand(1,9)
var/fd3 = rand(1,9)
var/fd4 = rand(1,9)
var/fd5 = rand(1,9)
var/fd6 = rand(1,9)
access.code = text2num("[fd1][fd2][fd3][fd4][fd5][fd6]")
access.doublecheck()
access.owner = usr
access.amount = 5
sleep(30)
usr << "Done! The pin number for your bank account is [access.code]. Do NOT lose it or give it to anybody else! Otherwise you may either find yourself unable to use the account or find all your zenni missing!"
usr << "Also, half of the startup fee has been left in your account."
accounts.Add(access)
if(firstaction == "Access Account")
var/pincode = input("What is the 6 number pin code for the account you wish to use?")as num
for(var/obj/something in accounts)
if(pincode == something.code)
var/accaction = input("[something.owner]'s account has been accessed. What will you do with it?","[something.owner]'s account")in list("Deposit","Withdraw","Nothing")
if(accaction == "Deposit")
var/damount = input("How much will you deposit? Max [usr.zenni - 1] buck\s max!")as num
if(damount <= 0)
usr << "You may not deposit or withdraw less than 1."
return
if(damount >= usr.zenni)
usr << "What the! You don't HAVE that much zenni!"
else
something.amount += damount
usr.zenni -= damount
usr << "Done!"
if(accaction == "Withdraw")
var/wamount = input("How much will you withdraw? [something.amount - 1] buck\s max!")as num
if(wamount <= 0)
usr << "You cannot withdraw or deposit less than 1."
return
if(wamount >= something.amount)
usr << "This account does not have this much!"
else
something.amount -= wamount
usr.zenni += wamount
usr << "Done! You now have [usr.zenni] buck\s!"

mob/Login()
world << "[usr] joins Dragonball Rekuden"
usr.loc = locate(rand(1,10),rand(1,7),1)
usr.icon = 'Banker.dmi'
usr.icon_state = "character"

mob/Logout()
world << "[usr] Leaves Dragonball Rekuden!"
del usr

turf/whitefloor

===========================================================

This is the errors i get

bank.dm:3:error:accounts:undefined var
bank.dm:4:error:accounts:undefined var
bank.dm:5:error:accounts:undefined var
bank.dm:6:error:accounts.len:undefined var
bank.dm:9:error:accounts:undefined var
bank.dm:10:error:accounts.len:undefined var
bank.dm:18:error:accounts:undefined var
bank.dm:27:error:accounts:undefined var
bank.dm:61:error:accounts.Add:undefined var
bank.dm:64:error:accounts:undefined var


How can i fix these errors?</<>
try adding this somewhere:

var/list/accounts = list()

or
var/accounts[]



note that lists arent my favourites (and after these ones as to make it look more organized :P):

obj/var/amount
obj/var/owner
obj/var/code
obj/accthing
In response to GhostAnime
GhostAnime wrote:
try adding this somewhere:

var/list/accounts = list()

or
var/accounts[]



note that lists arent my favourites (and after these ones as to make it look more organized :P):

obj/var/amount
obj/var/owner
obj/var/code
obj/accthing

Now i get these errors

bank.dm:11:error:list:undefined proc
bank.dm:46:error:/obj/accthing:undefined type path
bank.dm:54:error:access.code:undefined var
bank.dm:56:error:access.owner:undefined var
bank.dm:57:error:access.amount:undefined var
bank.dm:59:error:access.code:undefined var
bank.dm:65:error:something.code:undefined var
bank.dm:66:error:something.owner:undefined var
bank.dm:66:error:something.owner:undefined var
bank.dm:75:error:something.amount:undefined var
bank.dm:79:error:something.amount:undefined var
bank.dm:83:error:something.amount:undefined var
bank.dm:86:error:something.amount:undefined var
bank.dm:12:error::empty type name (indentation error?)
bank.dm:19:error:src.code:undefined var
bank.dm:19:error:A.code:undefined var
bank.dm:26:error:src.code:undefined var
bank.dm:28:error:src.code:undefined var
bank.dm:28:error:B.code:undefined var

==========================================================
world.New()
var/savefile/F = new("banks.sav")
F["stuff"] >> accounts
if(accounts == null)
accounts = list()
world.log << "[accounts.len] bank account\s loaded upon world startup."
world.Del()
var/savefile/F = new("banks.sav")
F["stuff"] << accounts
world.log << "[accounts.len] bank account\s saves upon world shutdown."
var/list/accounts = list()
obj/var/amount
obj/var/owner
obj/var/code
obj/accthing

obj/proc/doublecheck()
for(var/obj/A in accounts)
if(src.code == A.code)
var/fd1 = rand(1,9)
var/fd2 = rand(1,9)
var/fd3 = rand(1,9)
var/fd4 = rand(1,9)
var/fd5 = rand(1,9)
var/fd6 = rand(1,9)
src.code = text2num("[fd1][fd2][fd3][fd4][fd5][fd6]")
for(var/obj/B in accounts)
if(src.code == B.code)
src.doublecheck()

mob/Banker
icon = 'Banker.dmi'
icon_state = "banker"
verb/Banking()
set src in orange(2)
var/firstaction = input("What will you do?","Action?")in list("Create a new account","Access Account","Nothing")
if(firstaction == "Create a new account")
usr << "Creating a new bank account will run you Ten Bucks!"
var/create = input("","Pay ten bucks?")in list("Yes","No")
if(create == "Yes")
if(usr.zenni <= 10)
usr << "You do not have enough money!"
return
else
usr << "Please wait 3 Seconds!"
var/obj/access = new /obj/accthing(locate(0,0,0))
usr.zenni -= 10
var/fd1 = rand(1,9)
var/fd2 = rand(1,9)
var/fd3 = rand(1,9)
var/fd4 = rand(1,9)
var/fd5 = rand(1,9)
var/fd6 = rand(1,9)
access.code = text2num("[fd1][fd2][fd3][fd4][fd5][fd6]")
access.doublecheck()
access.owner = usr
access.amount = 5
sleep(30)
usr << "Done! The pin number for your bank account is [access.code]. Do NOT lose it or give it to anybody else! Otherwise you may either find yourself unable to use the account or find all your zenni missing!"
usr << "Also, half of the startup fee has been left in your account."
accounts.Add(access)
if(firstaction == "Access Account")
var/pincode = input("What is the 6 number pin code for the account you wish to use?")as num
for(var/obj/something in accounts)
if(pincode == something.code)
var/accaction = input("[something.owner]'s account has been accessed. What will you do with it?","[something.owner]'s account")in list("Deposit","Withdraw","Nothing")
if(accaction == "Deposit")
var/damount = input("How much will you deposit? Max [usr.zenni - 1] buck\s max!")as num
if(damount <= 0)
usr << "You may not deposit or withdraw less than 1."
return
if(damount >= usr.zenni)
usr << "What the! You don't HAVE that much zenni!"
else
something.amount += damount
usr.zenni -= damount
usr << "Done!"
if(accaction == "Withdraw")
var/wamount = input("How much will you withdraw? [something.amount - 1] buck\s max!")as num
if(wamount <= 0)
usr << "You cannot withdraw or deposit less than 1."
return
if(wamount >= something.amount)
usr << "This account does not have this much!"
else
something.amount -= wamount
usr.zenni += wamount
usr << "Done! You now have [usr.zenni] buck\s!"

mob/Login()
world << "[usr] joins Dragonball Rekuden"
usr.loc = locate(rand(1,10),rand(1,7),1)
usr.icon = 'Banker.dmi'
usr.icon_state = "character"

mob/Logout()
world << "[usr] Leaves Dragonball Rekuden!"
del usr

turf/whitefloor

===========================================================

Also where it says this

mob/Login()
world << "[usr] joins Dragonball Rekuden"
usr.loc = locate(rand(1,10),rand(1,7),1)
usr.icon = 'Banker.dmi'
usr.icon_state = "character"

How do i get it select which race a person is say like elf for example or somthing like that because they are in icon file

so how can i make it work for all character's races