ID:157508
 
How would I do:

if(1 = 2)
world << "1 is the same as 2!"
Blafblabla wrote:
How would I do:

if(1 = 2)
> world << "1 is the same as 2!"


The = operator is for assignment; it assigns the value on the right side to the var on the left. The == operator is for testing if two things are equal.

if(1 == 2)
world << "1 is the same as 2!"
In response to Lummox JR
Ah OK thanks.
mob
verb
Check()

if(prob(50))//50% chance probabilty
if(a + b == 200)//if variables a + b equal 200. use == to compate
src << "It equals 200!"//send a message to the person who used the verb
else //else if they do not equal 200
src << "Error"//send this message
if(prob(50))//the other 50% chance. could also just be replaced with else in this situation
if(a == 100)
src << "It equals 100!"
else
src << "Error"
/var/a = 100
/var/b = 100
In response to Blafblabla
Another question.

How would I do:(Putting a limit and a minimum on something.)

mob/verb/set_1(S as text)
1 = S limit = 3 min = 1
In response to Blafblabla
Just as a side note, you can't assign variables where the first character is a number. Also, since you want "S" to be a number, it's best to set it to only accept numbers.

As for your minimum/maximum question, there are conveniently two procs that do just that: max() and min().

So putting the above to work, you'd get something like...

mob/verb/set_1(S as num)
var/_1 = max(1, min(S, 3))
In response to Mega fart cannon
Thanks.