ID:176674
 
Hey all i got this peice of code like this.....

mob
var/account=0
var/lasttrans=0
Banker
icon='wutever.dmi'
icon_state="banker"
verb/Bank()
set src in oview(2)
switch(input("May I help you?","Banking","Deposit") in list("Deposit","Withdraw","Finished"))
if("Deposit")
var/lasttrans=input("How much money do you wish to deposit?","Banking",lasttrans) as num
if(lasttrans>=0&&usr.wealth>=lasttrans)
usr.wealth-=lasttrans
usr.account+=lasttrans
usr<<"Banker: Thank you for your deposit. You account now holds [account] gold pieces."
else
usr<<"Banker: You don't have enough."
if("Withdraw")
var/lasttrans=input("How much money do you wish to withdraw from you account?","Banking",lasttrans) as num
if(lasttrans>=0&&usr.account>=lasttrans)
usr.account-=lasttrans
usr.wealth+=lasttrans
usr<<"Banker: Thank you for your patronage. Your account now holds [account] gold pieces."
else
usr<<"Banker: There is not enough money in your account."

But when i compile theres a bunch of things wrong with it:


error:lasttrans: compile failed (possible infinite cross-reference loop)
((and))
error:usr.account:undefined var

Can someone please help me out, thanks

Superlink
You're defining lasttrans as a new variable. Take out the var/ part when changing it.
In response to Garthor
<Shameless plug>Just forget that and use my Pin Banks demo, and tweak it to your liking. :P</Shameless plug>