wow that seem a bit complicated and not to mention troublesome.
also what if the player need lumber for building too?
i believe using substrings would be a better choice.
for example:
trigger 1
event
layer(red) type -bank as a sunstring
action: set(your varable) = substring(last typed substring),7,9
than - add (your varable) to player(brown) ie. bank
add (-)(your varable) to player(red)
else - game display to (triggering player) (your message)
trigger2
if - if player(red) current gold is greater than or = to (your varable)
event: every 30sec
action: add player(brown) current gold (*) (X%) to player(brown) current gold
trigger3
event: player(red) type -withdraw as a substring
action:
if - substring(last typed substring),10,12 is less than or equal to player(brown) current gold
than - add (substring(last typed substring),10,12) to player(red) ie. bank
add (-)(substring(last typed substring),10,12) to player(brown)
else - game display to (triggering player) (your message)