ID:157744
 
sorry for asking such a simple question but ive been looking for 20 minutes in the reference, guide, and articles and i cant find an example of how to make an if statement about an objects loc.
What are you trying to do exactly?
In response to Mega fart cannon
if (src.loc == M.contents)

im trying to see if the object which is src is located inside a mobs contents
In response to Netmanx
Netmanx wrote:
if (src.loc == M.contents)

im trying to see if the object which is src is located inside a mobs contents

Take a look at the in operator. It's good to get familiar with all of your key operators and procs. :)
In response to Mega fart cannon
i had tried that before but it didnt work, and since putting it back to in it still does not work for some reason -_-
In response to Netmanx
Define "didn't work"
In response to Netmanx
contents is not a location, it's simply a list of all the objects whose locs are src. So, you just should have if(src.loc == M).
In response to Netmanx
Are you just putting in in your previous code above? Or taking a look at the examples on the reference page?

If it's the former, it will always return false because you're checking if the object's location is inside the contents of the mob, which doesn't make sense because the object's location IS the mob.

There are two ways of tackling this: in and ==. You can check if that particular instance of an object is in the contents of an atom, or check if the loc of the object is the atom.
In response to Chowder
haha sorry for being really vague i assumed that i was on my own again, the problem has not changed regardless of changing == to in and removing the .contents

edit: changing in back to == solved it