ID:165381
 
Right.. its not more of a 'it doesnt work' But more of a 'Im a noob and dont what im doing ^.^' '

obj
Shades
name = "Shades"
icon = 'shades.dmi'//dont have a base icon so cant make weights icon!lol
worn = 0
price = 158
verb
Wear()
if(src.icon == 'kidbase.dmi')
src.worn = 1
usr.overlays += 'gord.dmi'
usr << "You wear the [src.name]."
src.suffix = "Equipped"
if(src.worn == 1)
src:worn = 0
usr.overlays -= 'shades.dmi'//temp icon
usr << "You remove the [src.name]."
src.suffix = ""
else
src:worn = 1
usr.overlays += 'shades.dmi'
usr << "You wear the [src.name]."
src.suffix = "Equipped"


What im trying to achieave(Sp) Is To change the diffrent shades icon depending on what icon the src has at the time.
If you want me to elaborate more then please say, And i thank you for your time and effort if you help me.
src is equivalent to the shades obj.

So src.icon = 'shades.dmi'

Which means that for /obj/Shades the first if statement will never return true (never execute it's indented code block). Try switching src to usr for your if statement. I think that is what you intended to do in the first place. You were meaning that if the usr's icon is 'kidbase.dmi' correct?

Also when the first if statement is executed the second if statement will always execute. Meaning that you will always "wear" src but then always remove it right afterwards.

The second if statement should be an else if.

Oh and from the looks of it the first if statement--when it does work--will allow people to wear more than one pair of shades. Which isn't currently a problem since they will be removed shortly thereafter when the second if executes.
In response to Vermolius
Okay thank you, Ill try that now and reply soon on if it works or not,
-Edit- THANK YOU SO MUCH, .. And such a stupid mistake i should have seen xD Thanks thanks thanks ^.^
In response to Keiron
Now when i remove the item it doesnt actualy remove it.
In response to Keiron
You mean when you remove the shades when the usr's icon is kidbase.dmi?

That's because the overlay you remove isn't the same as the one you added.

You need to remove the same overlay. Either add src.icon to overlays or create a copy of the obj's icon with image() to add to overlays.

You would add src.icon if each of your objects is in a separate icon file (.dmi file).

usr.overlays += src.icon
//and to remove
usr.overlays -= src.icon


Otherwise, if you are using icon_state's, use

usr.overlays += image(src.icon,src.icon_state)
//and to remove
usr.overlays -= image(src.icon,src.icon_state)


In response to Vermolius
Thanks its working now,