ID:142715
 
Code:
/*
prototypes with specific properties, then create instances
of the areas, and verbs to interact with them.
For now I'll focus on the core code, followed by verbs
for moving between rooms.
*/


world
New() //Overides the world's New() proc
for (var/Atype in typesof(/area)) //loops through area prototypes
var/area/A = new Atype //creates a new instance of each prototype
A.tag = A.name //makes it's take the same as it's name
..() //call the parent


area
var //declare new area variables
north
south
east
west


Lounge //creates a new area prototype
desc = "It is very comfy here. The walls are edged in beanbag chairs, and there is a benevolent-looking portrait of Zilal overhead."


mob
Login() //overrides mob's Login() proc
if(usr.loc = 0) usr.loc = 1
..()


Problem description:
Ok so I am a newb to byond code and I was messing around with Zilal's tutorial code (for making a mud) hoping in the process that I would learn something. But (naturally) I keep running into errors. This one I've been working on for forty minutes. Basically every time I attempt to compile, I get this error message "concept_environment.dm:31:error::missing expression" The message is intended for the second line from the last, the line "if(usr.loc = 0) usr.loc = 1" (quotes ate not part of the code line) I know that part of the expression must be missing, but I DID provide the "if" statement along with it's arguments, and a statement to execute if true. SO whats missing?

Edit, Problem Solved
Ok, so I checked the Reference book looked around for like twenty minutes, then noticed operator. Apparently I was making an assignement versus checking a value.
Ex. (wrong)
if(e=e) statement

Ex. (correct)
if(e==e) statement


So for all you newblets out there (like myself), when using 'if' statements and checking for equivalences, Always ALWAYS use TWO '==' equal signs!
lol ty :P, and i believe thats because its making the operation (whats in the ()'s after if) an Inequality, where
if(e=>b) (= are read as is) so that would be "if 'e' is greater than b..."
if(e=<b) if e is less than b...
if(e==b) if e is the same as b...<br/>

In response to RanEsu
All of that is wrong. = is not read as "is", = is the assignment operator. == is the comparison operator... but it's not read as "is", because that's too narrow of a definition of it, though that's not something that comes up often in BYOND. A simple example is that two strings can be equal to one another (a==b) but they aren't the same string, so "is" would be wrong.

Additionally, you've got your inequality operators all buggered up:

Less than: <
Greater than: >
Less than or equal to: <=
Greater than or equal to: >=