ID:1969178
 
(See the best response by Kaiochao.)
Code:
obj
protein
icon = 'protein.dmi'
Entered(A)
if(ismob(A))
var/message = rand(1,3)
if(message == 1)
view() << "The trilobite devours the protein molecule."
else if(message == 2)
view() << "The trilobite hastily consumes the protein molecule."
else if(message == 3)
view() << "The trilobite scarfs down the molecule."
usr.ProteinConsumed += 1
del /obj/protein


Problem description:
I'm trying to get it to where when you walk over a protein molecule, you eat it, add a variable, and then it goes away. Oh, and have it display a random message.
Oh, right. so basically it does nothing when you walk over it.
You are looking for Crossed()

Entered() is when you step inside of something.

Crossed() is when you overlap an object while on the map (standing in a turf).

Common mistake. I remember having this problem maybe 12 years ago and never managed to figure it out for a matrix-inspired project I was working on when I was a wee little one.
Best response
First, replace Entered with Crossed. Since you don't enter the contents of objs when you walk over them, they have a different proc to handle that action.

Second, use view(A) and cast A to a mob variable so you can modify ProteinConsumed. Casting goes like this:
// make a variable with the type you want to cast to
// set it to the variable that contains something of the
// right type but wasn't declared as that type before
var mob/m = A

m.ProteinConsumed += 1
Also you'll want to use del(src) instead of telling byond to delete a type path.
Firstly does the user have a variable called 'ProteinConsumed', because assuming that you haven't included it into the snippet -- the parameter at the end is pointing to an object that may not exist. You'll need to indicate which object currently on the map you're talking about, which in this case if there's many 'proteins' -- using 'src' (short for source) to indicate the 'protein' the 'mob' has stepped onto, which brings me to my final point -- read the above comments and you're allgood.