ID:138890
 
Code:
//pick color
FavoriteColorButton
Click()
switch(input("What is your Favorite color?","Color Selections") in list("Red","Green","Blue"))
if("Red") usr.FavColor = rgb(#FF0000)
if("Green") usr.FavColor = rgb(#00FF00)
if("Blue") usr.FavColor = rgb(#0000FF)

//apply and add color
var/Shirt = new /obj/Items/Shirt
var/icon/i = Shirt.icon
i += usr.FavColor
Shirt.icon = i
var/Pants = new /obj/Items/Pants
var/icon/i = Pants.icon
i += usr.FavColor
Pants.icon = i
usr.contents+=new Shirt;usr.Items+=new Shirt
usr.contents+=new Pants;usr.Items+=new Pants

//Equip/Unequip
Shirt
icon_state="Shirt"
suffix = "A Shirt"
Click()
if(suffix != "Equiped")
usr.overlays+='Shirt.dmi'
suffix = "Equiped"
usr<<output("You put on the Shirt!","InfoBox")
else
usr.overlays-='Shirt.dmi'
suffix = "A Shirt"
usr<<output("You took off the Shirt!","InfoBox")


Problem description:For some reason when i use this method to Add/Create the colored item i need it decides to error with a result of no item, Create an item that doesnt give the right color, or resets the color upon an equip back to the base color. How would i fix this? Im trying to allow the player to pick his/her favorite color, then upon creating a character have the pants/shirt that you get for free become that color and stay that color regaurdless of unequiping/requiping.

obj/Pants
icon = 'Pants.dmi';

var
Colour;

mob/verb/GetPants() {
var/obj/Pants/Pants = new(src);
Pants.Colour = rgb(0, 255, 255);
Pants.icon += Pants.Colour;
}


Look at that, this may help you.

In tis case you don't need to do var/icon/i = Shirt.icon/Pants.icon Just Shirt.icon += rgb() / Pants.icon += rgb()
In response to Ocean King
Ocean King wrote:
> obj/Pants
> icon = 'Pants.dmi';
>
> var
> Colour;
>
> mob/verb/GetPants() {
> var/obj/Pants/Pants = new(src);
> Pants.Colour = rgb(0, 255, 255);
> Pants.icon += Pants.Colour;
> }
>

Look at that, this may help you.

In tis case you don't need to do var/icon/i = Shirt.icon/Pants.icon Just Shirt.icon += rgb() / Pants.icon += rgb()

i have the basic concept now, and i have a working system, but if you look at the shirt equip im going to post maybe youll see my delima
obj/items
var/Color
Shirt
icon_state="Shirt"
suffix = "A Shirt"
Click()
var/icon/i = 'Shirt.dmi'
i += Shirt.Color
if(suffix != "Equiped")
//var/ShirtOver = new /obj/Items/Shirt
usr.overlays+=i
suffix = "Equiped"
usr<<output("You put on the Shirt!","InfoBox")
else
usr.overlays-=i
suffix = "A Shirt"
usr<<output("You took off the Shirt!","InfoBox")


but i get unidentified var "Shirt.Color". the concept if you havent guessed is to be able to customize your cloths you obtain. Each item should get a preset value for rgb that applys to the Shirt.icon_state and the Shirt.dmi itself as its applied. :/
In response to XxLucifersJesterxX
Tab the Shirt. It's path should be obj/items/Shirt
In response to Ocean King
Ocean King wrote:
Tab the Shirt. It's path should be obj/items/Shirt

in the source it is, that was just me failing with C&P.