ID:141459
 
Code:
var/list/Item/ListOfItemImported=dd_file2list('Texts/Item.txt')
var/list/Item/ListOfItemNumbered
var/list/Item/ListOfItemNumbered.len = 0
mob/verb/test_list()
var/seperator=27
var/number=0
var/max=1
var/total=0
for(var/V in ListOfItemImported)
if(total>=max)
return
ListOfItemNumbered.len+=1//this is line 132

ListOfItemNumbered[ListOfItemNumbered.len]=ListOfItemImported[V]
src<<"[V]=[ListOfItemImported[V]]"
number+=1
if(number>=seperator)
sleep(1)
number=0
total+=1


Problem description:

I have a list of items in a text box for quick and easy edits without having to re-compile the entire source (which for some reason lags horribly, but that is another problem I will solve later.) It is formatted like so, without the comments:
[0]//Item Number
potion_1//item name
HP+=50//what it does
[1]//Item Number
potion_2//item name
HP+=150//what it does


What I am trying to do is reference each line to a number, in this case:

(1="[0]",2="potion_1") etc


for some reason though, the debugging output is wrote:

runtime error: Cannot read null.len
proc name: test list (/mob/verb/test_list)
source file: Player.dm,132
usr: KingCold999 (/mob)
src: KingCold999 (/mob)
call stack:
KingCold999 (/mob): test list()

even though it is referenced to an actual list. Without trying to increase the length though, it wrote:

list index out of bounds

Does anyone see what I am doing wrong?

I am using Deadron.texthandling
I have a feeling it is because of how you defined the var.

var/list/Item/whatever


The "Item" in there is probably messing everything up, unless you can declare subtypes of /list, which I don't think you can do.
In response to Jeff8500
I tried that, and it did not fix the problem of null.len
Um, yes.
var/list/Item/ListOfItemNumbered
var/list/Item/ListOfItemNumbered.len = 0


You need to make it an actual list, like so:
var/list/Item/ListOfItemNumbered = list()


Also, this line
var/list/Item/ListOfItemNumbered.len = 0

Makes a variable called "ListOfItemNumbered.len", which is the number 0 (but normally holds a list).
It is not the same as using "ListOfItemNumbered.len" elsewhere.
KingCold999 wrote:
var/list/Item/ListOfItemNumbered.len = 0


That's not legal code. You can't access the variables of an object you just defined.
In response to Immibis
Ok, I removed that part out but am now getting:

runtime error: list index out of bounds
proc name: test list (/mob/verb/test_list)
source file: Player.dm,133
usr: KingCold999 (/mob)
src: KingCold999 (/mob)
call stack:
KingCold999 (/mob): test list()

again
In response to KingCold999
   ListOfItemNumbered[ListOfPokemonNumbered.len]=ListOfItemImported[V]
<dm>

ListOfPokemonNumbered.len is greater than the len of ListOfItemNumbered, or less than or equal to zero.
In response to Jeff8500
I tried this as well:
ListOfItemNumbered+=list(ListOfItemNumbered.len+1=ListOfItemImported[V])

that returned the same problem. It seams that ListOfItemNumbered does not have a len var for some reason