ID:145562
 
Code:
mob
icon='g.dmi'
icon_state="player"
var/gold=50000
Stat()
..()
statpanel("Stats")
stat(src)
stat("Gold",gold)
Banker
icon_state="bank"
var/list/clients=list()
verb/Bank()
set src in oview(1)
usr<<browse({"
<html>
<head><title>Cornelius the Banker</title></head>
<body bgcolor="#222222" style="font-family:tahoma;color:#fff;text-align:center;">
Hello there m'lad! What do ye wish to do this fine evenin'?
<br><br>
<a href="?action=Deposit&src=\ref
[src]">Deposit</a> - <a href="?action=Withdraw&src=\ref[src]">Withdraw</a> - <a href="?action=Close&target=Banking">Close</a>
</body>
</html>
"}
,"window=Banking,size=300x300")
client/Topic(href,list[])
switch(list["action"])
if("Deposit")
var/amount=input("How much do ye want to deposit? \nFrom what I sees here ye have [usr.gold] piece[(usr.gold>1)?"s":] o' gold.","Cornelius the Banker")as null|num
if(amount==null) return
if(usr.gold<amount) {usr<<"Ohh, seems ye don't have yourself enough gold to fill yer deposit request.";return}
if(amount<1) {usr<<"This bank only accepts gold deposits 1 gold or over, lad.";return}
var/mob/Banker/B=list["src"]
if(!B) {usr<<"It seems the banker doesn't exist anymore, transaction has been canceled.";return}
B.clients[usr.ckey]+=amount
usr.gold-=amount
usr<<"Yer [amount] gold's been deposited leavin' yer balance at [B.clients[usr.ckey]]. Alright, be seein' ya then, laddie."
if("Withdraw")
var/mob/Banker/B=list["src"]
if(!B.clients[usr.ckey]) {usr<<"Seems ye don't have any gold in m'bank.";return}
var/amount=input("So, how much do ye want to withdraw? \nFrom what I see, ye have [B.clients[usr.ckey]] gold in our vault.","Cornelius the Banker")as null|num
if(!B) {usr<<"It seems the banker doesn't exist anymore, transaction has been canceled.";return}
if(amount==null) return
if(B.clients[usr.ckey]<amount) {usr<<"Ohh, seems ye don't have yourself enough gold in this bank to fill yer withdrawl request.";return}
if(amount<1) {usr<<"This bank only allows gold withdrawls 1 gold or over, lad.";return}
B.clients[usr.ckey]-=amount
usr.gold+=amount
usr<<"Yer [amount] gold's been withdrawn leavin' yer balance at [B.clients[usr.ckey]]. Alright, be seein' ya then, laddie."
if("Close") if(list["target"]) usr<<browse(null,"window=[list["target"]]")


Problem description: For some reason I get this runtime error when trying to access the clients variable.


runtime error: Cannot read "\[0x3000000]".clients
proc name: Topic (/client/Topic)
usr: Artemio (/mob)
src: Artemio (/client)
call stack:
Artemio (/client): Topic("action=Withdraw&src=\[0x300000...", /list (/list), Banker (/mob/Banker))


You're trying to access a variable belonging to a text string. That's never going to work. =)

You need to turn the text string into an object reference using locate():

var/mob/Banker/B=locate(list["src"])
In response to Crispy
Thanks. :)