PageSort()
var/num=1//want 1 page minimum
var/list/L = RawData
if(L.len>7)
world<<"Raw Data is [L.len]"
num=round((L.len/7)+1,1)//add a page for the rest of the values
world<<"Raw Data is rounded to roughly [num] pages"
var/maxpage=num
winset(src,null,{"
pagelabel.text = "1 of [maxpage]";
Loader.text = "Loading....";
"})
var/list/x=list()// a temporary list to store data
for(var/i=1, i<maxpage+1, i++)// loops through the ammount of pages we need
x=new()//makes a new list x for us to use
for(var/j=7, j>0, j--)//loops through data and adds it to a page
if(!L[1]) return//nothing left, stop the loop
x.Add(L[1])//adds 7 things to [i] page
L.Remove(L[1])//removes them from the selection
AsocList["[i]"]=x//adds the list x the [i] page
var/i
for(i in AsocList)
world<<"Page [i] now has [AsocList[i]] items"
world<<"RawData now has [L.len] items left"
Problem description:
I'm getting a bad index runtime error when I try to run this code in game. The code is part of a system that generates pages with their own lists of items. I have looked around the forum and help files but cant find anything to explain why this error is coming up. Any help would be appreciated -Thanks