I'm working on a very simple turn-based system to start me off, but keep getting these errors with this...
mob
proc
Attack(M as mob in view())
var/list/Enemies()=new()
Enemies += M
Enemies -= usr
switch(input("Who to attack?")in list(Enemies,"Cancel"))
if(Enemies)
var/Damage=usr.Strength-src.Defense
src.HP-=Damage
usr << "You did [Damage] damage to [src]!"
Death()
usr.IsMyTurn=0
if("Cancel")
return
____________________________________________________
check.dm:67:error::invalid expression
check.dm:70:error:Enemies:expected a constant expression
____________________________________________________
I'm new to lists as well and I've had problems with them, so I'm not sure what I'm doing wrong.
ID:175161
Jun 3 2003, 4:49 pm
|
|
These two Enemies references arent meant to be indented (Tabbed).
The in list part is a little messed here. What you want to do is add "Cancel" too the list, then make the input() in enemies.
By putting in list(blablabla) your creating a new list for the input, so what you were doing there is asking it to select from a list which contains another list and "Cancel".
Here you want to make it so that instead of switch(input()), if(Enemies) then if("Cancel"), you have var/i = input(), then if(i == "Cancel") then else with all the damage stuff in it.
I hope that cleared things up. Its a little hard to explain since I had to swap a few things and add/remove others.