ID:148857
 
Why won't this code compile properly? Team is defined, so that can't be the error.

mob
proc
ScoreCheck()
if(usr.Team == Collective) // Error Here
TitanPoints += 1
else if(usr.Team == Titan) // Error Here
CollectivePoints += 1


The errors:

loading Inf.dme
Score.dm:4:error:Collective:undefined var
Score.dm:6:error:Titan:undefined var
f:\BYOND\users\MASTER\lib\spuzzum\s_admin\s_admin2.dm:998:if :warning: if statement has no effect
f:\BYOND\users\MASTER\lib\spuzzum\s_admin\s_admin2.dm:999:if :warning: if statement has no effect

Inf.dmb - 2 errors, 2 warnings (double-click on an error to jump to it)
if(usr.Team == Collective) // Error Here
TitanPoints += 1
else if(usr.Team == Titan) // Error Here
CollectivePoints += 1

you need "'s aroung the usr.team ==

So this should fix the errors, im not sure about the warnings though...
mob
proc
ScoreCheck()
if(usr.Team == "Collective") // Error Here
TitanPoints += 1
else if(usr.Team == "Titan") // Error Here
CollectivePoints += 1
In response to Nick231
Now, from this code:

var
TitanScore = 0
CollectiveScore = 0


mob
proc
ScoreDeath()
if(usr.Team == "Collective")
TitanScore += 1
usr.TitanScoreCheck()
else
CollectiveScore += 1
TitanScoreCheck()
if(TitanScore == 100)
world << "Titans win!!!"
for(M as mob in world)
M.score += 1000
M.Experience += 1000
world.Reboot()
CollectiveScoreCheck()
if(CollectiveScore == 100)
world << "Collectives win!!!"
for(M as mob in world)
M.score += 1000
M.Experience += 1000
world.Reboot()


I get:

loading Inf.dme
Second.dm:17:error:M:undefined var
Second.dm:18:error:M.score:undefined var
Second.dm:19:error:M.Experience:undefined var
Second.dm:24:error:M:undefined var
Second.dm:25:error:M.score:undefined var
Second.dm:26:error:M.Experience:undefined var
f:\BYOND\users\MASTER\lib\spuzzum\s_admin\s_admin2.dm:998:if :warning: if statement has no effect
f:\BYOND\users\MASTER\lib\spuzzum\s_admin\s_admin2.dm:999:if :warning: if statement has no effect

Inf.dmb - 6 errors, 2 warnings (double-click on an error to jump to it)

The warnings are only from s_admin.
In response to Drafonis
You never defined M as a var; you tried looping with it before it was ever defined.
for(M as mob in world)

First off, "as mob" won't do a darn thing here. Second, unless you have var/mob/M somewhere before this, that statement is invalid. What you need is this:
for(var/mob/M in world)

Lummox JR
In response to Lummox JR
Thanks. It's up and ready, and one more feature left.