turf
var
states = null
c_state = 1
Click()
if(src.Owner == usr.key)
if(usr.ClickM == 1)
if(src.states)
if(c_state == length(src.states))
c_state = 1
else c_state ++
icon_state = states[c_state]
//an example of a turf WITH extra states.
dirt
icon='LOZTILES.dmi'
icon_state="dirt"
states = list("dirt","dirt2","dirt3","dirt4")
//an example of a turf without any extra states.
WoodFloor
icon='LOZTILES.dmi'
icon_state="woodfloor"
Problem description:
Hmm.. perhaps this is a simple problem, but I'm a simple person. I mean, I dabble a bit in other coding languages but nothing serious really.... Anyways, the problem is, I get this fun error every time I click on a turf that doesn't have a states list even though I'm trying to prevent that from happening. What with the checking to see if the list is even THERE.
(Said Fun Error Below):
runtime error: cannot read from list
proc name: Click (/turf/Click)
usr: Warlin (/mob)
src: WoodFloor (18,15,3) (/turf/WoodFloor)
call stack:
WoodFloor (18,15,3) (/turf/WoodFloor): Click(WoodFloor (18,15,3) (/turf/WoodFloor), "mapwindow.map", "icon-x=21;icon-y=10;left=1;scr...")
That should give you the exact same effect without having to write out the states manually.
EDIT: This will even work with icons that only have 1 state which will fix your initial problem.