ID:147111
 
I need help designing combat for a game that I'm making. I want combat to be set up turn-based in such a way that the players equipped weaponry and skills affect his efficiency in combat. However, I also want attack names to depend on what his characteristics are. For example, if he has a sword, the game calls that attack "Sword", but when he has a bow, it calls it "Bow". When I try to drive that feature using variables and input procs, it says "error: expected a constant statement". Here is the current Engage verb:

mob
verb
Engage(mob/M in oview(usr.range))
world << "[usr] has attacked [M]!"
M << "[usr] attacks you!"
switch(input("What do you want to attack with?","Attack",,"[usr.weapon]","[usr.ability]"))
if("[usr.weapon]")


All the used variables are defined, and it only complains if I add the if("[usr.weapon]") statement.
Your input is wrong. Try this.

switch(input("What do you want to attack with?","Attack") in list("[usr.weapon]","[usr.ability]"))

Followed by the fact that you haven't put anything under the if statement.
I think its because there's nothing under the if.
Engage(mob/M in oview(usr.range))

Last I checked, you can't do that.
In response to Garthor
Check again, then. :p
In response to tenkuu
My mistake. Don't remember that working.

Anyway, though it's not a problem with your code, it is a design issue. Popping up and input box every time someone tries to attack (especially with no way to avoid it by typing into the command line) is extremely annoying.