ID:887012
 
(See the best response by Albro1.)
Code:
mob
npc
Banker
icon='Npc.dmi'
icon_state="Banker"
verb
Bank(n as num)
set src in oview(2)
switch(input(usr,"What Do You Wish To Do","Withdraw or Bank")in list("Withdraw","Bank","Balance"))
if("Withdraw")
switch(input(usr,"How much money","Withdraw") as num)
if(num >= usr.BankedGold)
usr<<"You Do Not Have That Much Money Banked"
return
if(num <= usr.BankedGold)
num += usr.Gold
usr<<"Have A Good Day"
return
if("Bank")
if(n >= usr.Gold)
usr<<"You Dont Have That Much Money"
return
if(n <= usr.Gold)
n += usr.BankedGold
usr<<"Have A Good Day"
if("Balance")
usr<<"You have [usr.BankedGold] in the bank"
//m.see_invisible = 1
return


Problem description:oading The Unreal.dme
loading Skin.dmf
Npc.dm:2:error: number: undefined var
Npc.dm:2:error: =: expected a constant expression
Npc.dm:14:error: : expected a constant expression
Npc.dm:17:error: : expected a constant expression

The Unreal.dmb - 4 errors, 0 warnings (double-click on an error to jump to it)


Fixed 2 first errors
Errors say it all; the switch statement only accepts a constant expression to evaluate the input against; the expression
if(num >= usr.BankedGold)

is not constant (or guaranteed to be constant) as they contain variables in which chances are will change during runtime.

Use a fixed value instead such as "coding sucks" or 123.
Best response
num isn't defined. You're using as num to say that it'll be a number. You don't need a switch statement there, just use input().
var/amount = input(usr, "How much?") as num

Then check amount in those if statements instead of num.

Also:
var
num = 1
num2 = 3

num += num2 // now num = 4, num2 still equals 3
num2 += num // now num2 = 4, num still equals 1


If you are wondering about what I'm talking about, then look at where you are adding Gold and BankedGold.
Contrary to common belief, alert() and input() don't require switch() to work. They return a value that you can use like any other variable.