ID:1135115
 
I have a problem: why is calling the variable form static_chr.

all code:
turf
var
from
icon='box.dmi'
chr
icon_state="blue"
static_chr
var
chr
clr
bgc
New()
.=..()
text = "<font bgcolor='[bgc]' color='[clr]'>[chr]"
text
icon_state="green"
static_text
var
txt
clr
bgc
Click()
.=..()
for(var/r = 1,r<=length(txt)+1,r++)
var/turf/chr/static_chr/ch = new(locate(x+(r-1),y,z))
ch.from = src
ch.clr = clr
ch.bgc = bgc
ch.chr = copytext(txt,r,r++)
del src


runtime
runtime error: undefined variable /turf/chr/static_chr/var/txt
proc name: Click (/turf/text/static_text/Click)
usr: Guest-4104234607 (/mob)
src: the static chr (1,10,1) (/turf/chr/static_chr)
call stack:
the static chr (1,10,1) (/turf/chr/static_chr): Click(the static chr (1,10,1) (/turf/chr/static_chr), "mapwindow.map", "icon-x=9;icon-y=9;left=1;scree...")
i repaired the problem:

replaced
var/turf/chr/static_chr/ch = new(locate(x+(r-1),y,z))

whit
var/turf/chr/static_chr/ch = new(locate(x+r,y,z))
Huh? What? How did that solve the problem?!
because t5he turf, when is created, recplaces the turf in location.