ID:171394
 
ok i am making a new game and it has a battle system but i have one problem i've made so you can upgrade your self in battle and i use
[CODE]
startcombat(var/mob/monsters/M) //defining the procedure that starts the battle
if(M==null) //if the monster is already dead.
return //return and stop the battle loop.
if(src.isdead>0) //if you have died.
return //return and stop the battle loop.
if(src.upgrade==1)
var/upgrade=input(src,"Whould you like to use a upgrade attack?","Your Turn")in list("Twister","Cancel")
switch(upgrade) //switch to what you picked to do.
if("Attack") //if you picked attack
src.Attack(M)
if("Cancel")
return
sleep(15) //or else sleep for 1.5 seconds.
var/whatdo=input(src,"What would you like to do?","Your Turn")in list("Attack","Battle Chip","Defend","Run") //pick what you want to do in the battle.
switch(whatdo) //switch to what you picked to do.
if("Attack") //if you picked attack
src.Attack(M) //send them to the attack proc with the monster as the target
if("Battle Chip") //if picked spell
src.BC(M) //send them to the spell picking procedure with the monster as the target.
if("Defend") //if you choose to defend
src.Defend(M) //let them defend against the monsters attack.
if("Run") //if you picked run
src.Run(M) //let them try and run.
[/CODE]

See the upgrade bit i want that to come up if upgrade is 1 but when its 0 the thing still pops up how i stop that and i do get battles.dm:44::warning: empty switch statement ERROR

Thanks for the help
I can't see any reason why it should still be popping up the input(). Are you absolutely sure that src.upgrade is 0?

The warning is because you forgot to indent the cases underneath the switch(). Also, you're testing for "Attack" when you should be testing for "Twister".
In response to Crispy
ok thx i got working but now how if i hit cancel it will go to the whatdo bit?