ID:147999
 
I am trying to make it so that players can block certain attacks, but I'm stuck on a certain procedure.

mob/proc/highblock(M)
alert(src,"Do you wish to block [M]'s head strike?","Yes,","No")) //Both errors flag this line
if("Yes")
if(src.bodydefense == 1)
src.bodydefense == 0
src.headdefense == 1
else
src.headdefense == 1


Out of that code, I get the following errors:

combat.dm:2:error: ): expected }
combat.dm:2:error: location of top-most unmatched {

The weirdest thing is that a have another proc defined that is the same code except with different variables, but that proc gets no errors.
mob/proc/highblock(M)
alert(src,"Do you wish to block [M]'s head strike?","Yes,","No")) //Both errors flag this line
if("Yes")
if(src.bodydefense == 1)
src.bodydefense == 0
src.headdefense == 1
else
src.headdefense == 1

You have an extra )
In response to Nick231
Now it says combat.dm:3:error: proc definition not allowed inside another proc on the following line:

if("Yes")
In response to Drafonis
Drafonis wrote:
Now it says combat.dm:3:error: proc definition not allowed inside another proc on the following line:

if("Yes")

from if("Yes"), try bringing everything below it (including it) back a tab space
In response to Lazyboy
Lazyboy wrote:
Drafonis wrote:
Now it says combat.dm:3:error: proc definition not allowed inside another proc on the following line:

if("Yes")

from if("Yes"), try bringing everything below it (including it) back a tab line

That didn't work.
In response to Drafonis
It doesnt work because you didn't use a switch statement. Here is how you should do it

mob/proc/highblock(M)
switch(alert(src,"Do you wish to block [M]'s head strike?","Yes,","No"))
if("Yes")
if(src.bodydefense == 1)
src.bodydefense == 0
src.headdefense == 1
else
src.headdefense == 1