ID:262535
 
Code:
mob
var
user.dither
Dithered = "0"

mob
Person
icon = 'Person.dmi'
icon_state = "Normal"
var
icon
OrigIcon //Can't set it's value here. You have to wait until runtime, when players get their icons.
OrigState = "Normal" //The icon_state can be stored in var/icon/OrigIcon, but we need 2 vars so we can manipulate them seperately.
New()
OrigIcon = new(icon) //Keeping track of the original icon.
verb
Say(msg as text) //Just in case you decide to show this to your friends...
world << "[usr]: [msg]"
world << "\icon [OrigIcon]"
Dither()
//You COULD put usr.icon = usr.OrigIcon here, but then it'd have a few seconds of 0 dither while they choose a new dither.
switch(input(src,"How much dither do you want?","Dither") in list("0","25","50","75")) //Look up switch, if you don't know what it is. Pretty useful.
if("0")
icon = OrigIcon
icon_state = usr.icon_state //Set it back to the original icon.
set 1 = "Dithered"
if("25")
set user.dither "1"
icon = usr.icon
icon_state = usr.icon_state //We don't want the dithers to overlap, do we?
icon += 'Dither25.dmi' //And set the usr's icon.
if("50")
set user.dither "2"
icon = usr.icon
icon_state = usr.icon_state
icon += 'Dither50.dmi'
if("75")
set user.dither "3"
icon = usr.icon
icon_state = usr.icon_state
icon += 'Dither75.dmi'

icon_state = "icon_state"
OrigState = icon_state //Set it so that the new icon_state saves.
mob/verb
Custom_Icon(icon as icon)
set category = "Customize"
var/icon/I = new(icon)
var/list/L = list()
L += I.IconStates()
L += "Blank"
usr.the_states = L
usr.icon = icon
usr.icon_state = O

var/dithered = ("")
if(dithered == "1")
icon += 'Dither25.dmi' //And set the usr's icon.
if(dithered == "2")
icon += 'Dither50.dmi' //And set the usr's icon.
if(dithered == "")
icon += 'Dither75.dmi' //And set the usr's icon.
if(dithered == "0")
return


Problem description:ok dithering did work but i for got to save and i messed it up and when i change icon it dosent set dithering back to what it was. im very new to this so any help would be appreciated

Just out of curiousity, is that ShadowDarke's demo? I think I've downloaded it before

Hiead
In response to Hiead
no this is garthors demo this is my first time trying to edit byond code so im lost i just tryed to mimick it best as i could

In response to Insomniak 420
Oh, well I think those demos are a bit complicated for a beginner. I'd recommend starting with
Your First World

and

Step BYOND

Those are the two I used to get started.

Hiead
In response to Insomniak 420
You're not meant to be copying demos, only libraries are to be implemented.
I don't understand what your problem is but it seems like:

You dithered, you changed icon and then found that the dither disappeared.

If so then you need to re-dither. In order to know how much was dithered beforehand, you need to set a dither variable which'll be altered in the dither verb and referred to when changing the icon.