ID:1002256
 
(See the best response by Lummox JR.)
Descriptive Problem Summary:
i believe that DM has a bug in its if() pro.
usuall i would type a code like this

mob/proc/New()
if(usr.dead==0 && usr.attacking==0 && usr.firing==0)
if(usr.level==1)
usr<<"New Created"


but for some apparent reason DM doesnt read that code, so many verbs and procs arent working. In order for them to work i had to change the programming to this format...

mob/proc/New()
if(usr.dead) return
if(usr.attacking) return
if(usr.firing) return
if(usr.level == 1)
usr<<"New Created"


Could someone please explain whats happening. because DM didnt do this before so idk whats going on...

Expected Results:
- "New Created"
Actual Results:
-Nothing
Does the problem occur:
Every time? Or how often?
-this problem occurs everytime

In other games?
In other user accounts?
On other computers?
-im not sure

When does the problem NOT occur?

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

Workarounds:

This is a mistake on your part.
1. You can't declare a proc called New(), since it's a built-in proc.
2. You shouldn't use usr in declared procs because you likely don't know how to use it properly.
3. Place code between <dm> tags to conserve indentation. Your code is completely ambiguous without them.
lol i know all that its actually supposed to be a verb and i was just using it as an example..and what do you mean by place it in
 tag.?
I've tested that kind of scenario, and I'm pretty sure that works.

Please post a Developer Help topic with your specific code that doesn't work like that, and we can investigate it there. I do believe though at the moment, this is not a BYOND bug.
Stephen001 resolved issue (Not a bug)
Best response
Assuming this is meant to be a verb and usr abuse isn't an issue, the bottom line is there is obviously something at fault with the code, and a bug report is premature without trying to resolve it in Developer Help first. I've moved the post for that reason.

The reasons your specific code could be failing will vary, but I can think of one obvious reason: You're using the wrong test for a true/false value.

When you're testing a value that is only meant to be true or false, then using ==1 and ==0 to check its value is wrong. Instead of if(a==1) it should just be if(a), and if(a==0) should be if(!a). The reason: It's entirely possible for the value to be something you don't expect, like null, due to any number of scenarios that can arise if the code isn't bulletproofed against this.

Note that in your example, the code started working when you changed three of those ==0 tests to simple if(var) checks. This means that if the original if statement had been if(!usr.dead && !usr.attacking && !usr.firing), it would have worked just fine, so the ==0 obviously was the culprit. One of those values is false, but it isn't 0.

Reducing the number of vars would also tend to reduce the number of potential logic errors here. For instance, firing is just another form of attacking, so it doesn't make sense for most games to use separate vars for it. And if you do legitimately have a need for many vars like this--say, more than five or six--then the situation might call for using bitflags. If the same code is coming up frequently for almost all of your verbs, a #define macro wouldn't be a bad idea.
ok great thanks a lot Lummox JR