ID:141968
 
mob
icon = 'person.dmi'
var
HP = 30

Login()
bug
icon = 'bug.dmi'
icon_state = gender
..()

I have more of a code but this is where the beggining and error is. I am also new at this i ran ito trouble on a guide. Before i typed in bug and icon = 'bug.dmi' everything was fine but when i put it i tried to compile and i got one error on this line icon_state = gender The error is called "expected a constant expression". What does that mean and how do I fix it?

A constant is the exact opposite of a variable; it is something that can not be changed ever. Examples of a constant would be any number, a text string, null, or an icon. A variable, on the other hand, can be changed (unless it, too, is constant! You don't have to worry about that now, though), and so the compiler doesn't accept them outside of a proc etc. (verbs are procs that are added to the atom's verb list). A good place to set a variable to a non-constant value would be the New() proc, which all datums (what everything in DM is descended from, with a few exceptions) have.

From your code, however, it appears you just cut into your login proc and declared something new! You just can't do that; dream maker doesn't know that it's supposed to continue the Login() proc if a new mob is defined in the middle of it. So DM reads your code like this:

mob
icon = 'person.dmi'
var
HP = 30

Login() //DM thinks, "There is no stuff to do on Login()"


and

    bug //"Ok, we have a new mob here"
icon = 'bug.dmi' //"this isn't under anything! Disregard this/give errors"
icon_state = gender //"the bug's icon state is gender, which should be constant"
..() // "There is no parent when your defining a mob! Error!"


Two important things you should know:

1) Always keep your indentation consistent, whether your using tabs or spaces. I recommend spaces personally, as it makes the indentation bigger and more noticable.
2) When posting on the forums, put your code in DM tags. A tag is < > where there is something in place of the space. In this case it would be DM. Then, right below your code, you would put </ > where space is the same thing. It tells the BYOND server to give your code a white background and to highlight the verbs, procs, text strings, etc.
mob
icon = 'person.dmi'
var
HP = 30

Login()
..()
bug
icon = 'bug.dmi'
icon_state = "gender"





..() is used for pre-defined procs

Example:
mob/Move()            // override proc
world << "moving..."
return ..() // call default



And

If object O is derived from object P, P is called the parent of O. If a proc (or verb) is defined in both O and P, O can call P's version by using ..().


Also, when you call icon_state, you got to put it like = "(icon state name)".

Before you ask for help here, try this here

Hope i helped.

-Kenobi.
In response to Danny Kenobi
His problem was actually that his bug code cut into his Login() :P. I think he knew the parent etc. stuff, he's using the ZBT's.
In response to Jeff8500
In response to Danny Kenobi
He tried to use a variable, the gender variable, on purpose >_>