ID:145088
 
Intangibility(mob/M in world)
if(density=0)
density=1
world<<"[usr] has become tangible"
else
density=0
world<<"[usr] has become intangible"



Gmstuff.dm:11:error::missing expression

Please dont ignore just because it's me.


Please use the <.dm> and <./dm> tags (without the periods) please. That's why they're there.
Intangibility(mob/M in world)
if(density==0) //You need two equal signs in any equivalency statement
density=1
world<<"[usr] has become tangible"
else
density=0
world<<"[usr] has become intangible"
I'm really starting to wonder if you did read the DM guide... course I didn't either lol. I taught myself DM, with help from the forum.

Anyway, whenever you have an if() statement, if something is supposed to equals something else, you always use ==.

In other words:

in an if() statement: ==

if not in an if() statement: =
In response to Popisfizzy
Popisfizzy wrote:
Please use the <.dm> and <./dm> tags (without the periods) please. That's why they're there.
</dm>

What do you mean?
In response to Pyro_dragons
Oh yeah, I knew that :D
In response to Sorcerb
Those tags are used to show code in the format that Dream Maker shows them. It makes it easier for programmers to read.
mob/Login()
..()
world << "[src] logs in"

That is easier to read than this:

mob/Login()
..()
world << "[src] logs in"
In response to Sorcerb
He (or she, I don't know them) means when you post code, put the DM tags around it, like you would put the [img] tags around a link to show an image on another forum. That why in code problems, when you post a new topic, the DM tags are at the top and done for you.
In response to Popisfizzy
But on mine, it says "code:" inside the part, so I did... :/
In response to Sorcerb
Look again (using edit). They have <.dm> and <./dm> (without the periods). That's where it goes.
In response to Popisfizzy
You beat me to it lol. But yeah, exactly.
In response to Pyro_dragons
O.K.
In response to Sorcerb
if(!thing.density) means kinda the same thing as if(thing.density==0). I believe that if(!thing.density) checks if it is equal to or below zero. I never really put much thought into that though.
In response to Sorcerb
Sorcerb wrote:
But on mine, it says "code:" inside the part, so I did... :/

in other words, u use <dm> to show a code, and </dm>to return to normal message

understand?
In response to Sorcerb
Clarification on Exophus's post ([link])

Quote:
if(!thing.density) means kinda the same thing as if(thing.density==0). I believe that if(!thing.density) checks if it is equal to or below zero. I never really put much thought into that though.

Actually, if(!var) checks if the var (variable) is FALSE instead of TRUE, which if(var) looks for...Boolean variable checkers, per say...

FALSE => 0, null, "", FALSE
TRUE => Anything other than the values in FALSE, INCLUDING negatives
if(!var)//looks if var is one of the FALSE values
if(var)//looks if var is NOT one of the FALSE values [TRUE]


My entry about quick-Boolean methods <.< *spams that link ;x*

- GhostAnime
In response to Exophus
! = the not operator.

Not applies to a boolean function - !TRUE = FALSE, !FALSE=TRUE. !!A = A.

There is no boolean data type in DM - but various things are considered 'true' or 'false'. That's the main reason for using ! - to capture instances where something is false, but not zero.

These things are considered false: 0, "" (An empty string), null.

Everything else is considered true - any other number, any other string, any reference to an extant object.

! returns either 1 or 0 as true or false.

And, of course, if() takes a boolean argument - if it is considered true, it does whatever is inside the if().

<= checks if something is less then or equal to other number - say, zero.