obj/lightable
var
range
intensity
list/atoms
New()
..()
atoms=new/list(range)
//Make each element a list using getring(). Thus making it a multidimensional list(I think)
for(var/i=1,i<range,i++)
atoms[i]=getring(src,i) //Getring returns a list. This is from AbyssDragon's BasicMath library
verb
On()
set src in oview(1)
for(var/i=0,i<=range,i++) // i is zero because of its use later in the verb
//Copy each list found at [i] element
var/list/temp=atoms.Copy((i+1),(i+2)) //ERROR LINE
//For each item copied, set it's intensity according to what index it was(which is relative to how many tiles it is away from src)
for(var/atom/A in temp)
var/j=i*3 //Multiples of 3 might create an unrealistic diminishing effect, but it's good for now
A.text=A.SetIntensity(intensity-j)
runtime error: list index out of bounds
proc name: On (/obj/lightable/verb/On)
source file: lighting.dm,19
usr: Prodigal Squirrel (/mob/char)
src: the torch (/obj/lightable/torch)
call stack:
the torch (/obj/lightable/torch): On()
Problem description:
This is going to be used for a text mode dynamic lighting system. My first step is to get the dissipating effect of a light working. However, when using the verb On(), I get the above runtime error. I've tried other ways of using and modifying the list, but I get problems everytime. I'm just not sure how multi-dimensional lists work.
Prodigal Squirrel
Let me draw a picture on what you were doing.
This is a programmer skill called debugging, where you run through your code, in your head, memorizing each variable as you progress from token to token.