include control/do

 

proc wallet {name cash maker lifetime} {

 

require wall $lifetime

 

agent_name $name

agent_event $maker wallet $cash

 

do {

"STOP" {

agent_send $maker 0 DONE

agent_end

exit 0

}

"gimme" {

if {[info exists cash]} {

agent_send $sender $cash

unset cash

} else {

agent_send $sender "taken"}}

{"here %s" cash} {}}

}