ID:141429
 
Code:
mob
verb
Attack(mob/M in get_step(src,src.dir))
set category="Fighting"
if(!usr.knife)
usr<<"<b>You must first equipe a knife!"
return
if(M.race == src.race)
return
if(M.owner1 == src.key||M.owner4 == src.key)
return
if(M.NPC1 == 1)
return
if(src.underwater == 1||src.flying == 1||src.driving == 1||src.shootinggun == 1||src.shootinggun2 == 1)
return
else
var/damage=round(src.str-M.def/2)
if(damage <= 0).
damage = 1
flick("slash",src)
M.health-=damage
view()<<"[src] slashed [M] with his [usr.knife] inflicting [damage] damage!"
M.death()


Problem description:
It asks who in my oview() I want to ask with a switch(input statement, however I set it to only attack the person 1 space in front of me... Any ideas?
The switch() misconception is horrible: switch() does not create input dialogs, and is not related to them at all. switch() is a general statement that can take any kind of value as its argument, not only one returned by input() or even a proc to begin with. BYOND's input dialogs are invoked by either verb arguments or calls to input(), and it doesn't matter where the call is (inside switch(), if() or nothing at all).

In your Attack()verb you use a verb argument making the player choose a mob in the tile that's in front of him. If there is one then it will be chosen automatically as with all inputting cases, but if there's more than one the player will be prompted to choose between them, so that's a possible cause. If you don't want that to happen, you mustn't use a verb argument - you can use locate() in the verb's body to find a single mob in front of the player instead. Another possible cause could potentially be that you have another attacking verb defined somewhere you've forgotten about which also uses the attack command, and it is getting fired up instead, and it looks in oview().
Also, there are various things that should be done or designed differently that can be seen in that code, however IIRC you wouldn't be interested in any of the details, so I'm only pointing that out.
In response to Kaioken (#1)
It happens for all mobs no matter where it is it could be 8 spaces diagnally away from me and it will still be a choice. And as for the switch() conception it was the best I could come up with.

EDIT: Whats IIRC mean? Oh and I'm looking for a different attack verb if there is one..
EDIT2: Nope theres not one..
In response to SadoSoldier (#2)
There's plenty of different kinds of "attack verbs" >_> You're only limited by your own imagination.
In response to Spunky_Girl (#3)
If thats the case lord help me because I have a huge imagination x.x
In response to SadoSoldier (#4)
I'm a little fuzzy on what exactly you are trying to accomplish. Do you want it to automatically select only the mob in front of the user? Or do you want to input any victim who may be 1 space away from the user? Or in the general oview of the user? I might be able to help if you clarify a little bit.

For my game I use a targeting system that creates a visual cursor on any mob that you click on. The mob that you click on becomes the user's "target" and any attacks issued will be directed to the user's target only, whether the attack has an adjacent range or long-distance. It allows great ease and control for the attacker. I'd be willing to give you some pointers on that type of system if you'd be interested, or help you with what you are already trying to accomplish.
In response to Shinentai of Sephiroth (#5)
A "system", it shouldn't be >_> I don't think a single variable type casted where needed is considered a "system".
In response to Spunky_Girl (#6)
potato, potawto. It's all just semantics. It works, isn't that all that matters?
In response to Shinentai of Sephiroth (#7)
Unfortunetly to most people no, thats not all that matters, it is to me but some people just have a different point of view. In any case I want it to automatically select the mob 1 space in front of the usr and then tell the code to attack that mob, if there are more then 1 mob in that space then randomly choose one or just ask which one to attack either is fine with me.
In response to SadoSoldier (#8)
Hmm... Well I did a little test with the "mob/M in get_step(src, src.dir)", and under normal circumstances, it performs it's functions like you say you want it to. It automatically chooses the mob 1 space in front of the user and attacks it when the verb is pressed. If there are mobs of different types occupying the same space and the attack verb is pressed, an input box pops up letting you choose which one you want to attack. From your last post, this is what it sounds like you want... Of course I could be misinterpreting. If your verb is functioning in a different way (looking in oview) then I am going to refer back to Kaioken's post suggesting you might have a bug elsewhere in the code, another attack verb that you've forgotten about(though you say you couldn't find another one), or any other number of conflicts that may be much less obvious.

Sorry I can't be of more help. Hopefully a more experienced coder will come along and be able to help you with your problem more fully.