What does this error mean?

Hello! I am making a bar graph program and I need to get some numbers in an array.
But an error pops out and I don’t get what it means. Can anybody tell me what this error is and what I have to do in order to fix it?
Thank you.

//

void setup(){
  background(0);
  size(1000, 1000);
  textSize(30);
  text("*GraphSaver Beta Instructions*\n\nPress the white button on the right top to end program.\n\n1.First enter the title.\n2.Then enter the number of rows.\n3.Then enter all of your data.\n4.A graph will be made.press enter to save and delete to erase it. \n\nWhen you finish reading click the screen.", 20, 30);
}

int num=0;
String title = "";
IntList arr;

void draw(){
  //text("*Instructions*\n\nPress the white button on the right top to end program.\n\n1.First enter the number of rows.\n2.Then enter the title.\n3.Then enter all of your data.\n4.A graph will be made. press enter to save and delete to erase it. ", 10, 10);
  square(950, 0, 50);
  
  textSize(30);
  if(keynum==0)text(title, 100, 100);
  if(keynum==1 && num != 0)text(num-48, 100, 100);
  if(keynum==2 && imsi-1 == num)for(int i = 0; i <= arr.size(); i++)text(arr.get(i), 100, 100);
}

void mousePressed(){//End process
  background(0);
  if(mouseX > 950 && mouseY < 50){
    fill(200, 11, 22);
    square(950, 0, 50);
    delay(5000);
    print("END");
  }
}

void mouseMoved(){
  if(mouseX > 950 && mouseY < 50){
    fill(200, 11, 22);
    square(950, 0, 50);
  }
  else {
    fill(255);
    square(950, 0, 50);
  }
}

int imsi=0;//temp
int keynum=0;//how nany times key has been pressed-0:title, 1: number of rows, 2 : data

void keyPressed(){//input
  background(0);
  if(key == ENTER){keynum++;return;}
  if(keynum == 0)title += key;
  if(keynum == 1){
    num = key;
  }
  if(keynum == 2){
    arr.append(key);
    imsi++;
  }
}
1 Like

please format your code posting
by paste it into the

</> code button

of the editor header menu ( context name: Preformatted text )
looks like
```
type or paste code here
```

also can use the
```
manually above and below your code.


somehow i not see where and what error you get??

2 Likes

Oh. I was just stupid enough to not write the arr = new IntList(); part. Still, thank you.

try a

  if (keynum == 2) {
    arr.append(key);
    imsi++;
    println(arr);
  }

to understand about your next problem

1 Like

Um, I guess the space bars are also being put into the arr?
Plus, strange numbers keep popping up but I don’t know why.
Please help me.


void setup(){
  background(0);
  size(1000, 1000);
  textSize(30);
  text("*GraphSaver Beta Instructions*\n\nPress the white button on the right top to end program.\n\n1.First enter the title.\n2.Then enter the number of rows.\n3.Then enter all of your data.\n4.A graph will be made.press enter to save and delete to erase it. \n\nWhen you finish reading click the screen.", 20, 30);
  arr = new IntList();
}

int num=0;
String title = "";
IntList arr;

void draw(){
  square(950, 0, 50);
  
  textSize(30);
  if(keynum==0)text(title, 100, 100);
  if(keynum==1 && num != 0){
    text(num-48, 100, 100);
    num -= 48;
  }
  if(keynum==2){
    for(int i = 0; i < arr.size(); i++){
      arr.sub(i, 48);
      text(arr.get(i), 100, 100);
    }
  }

}

void mousePressed(){//End process
  background(0);
  if(mouseX > 950 && mouseY < 50){
    fill(200, 11, 22);
    square(950, 0, 50);
    delay(5000);
    print("END");
  }
}

void mouseMoved(){
  if(mouseX > 950 && mouseY < 50){
    fill(200, 11, 22);
    square(950, 0, 50);
  }
  else {
    fill(255);
    square(950, 0, 50);
  }
}

int imsi=0;//temp
int keynum=0;//how nany times key has been pressed-0:title, 1: number of rows, 2 : data

void keyPressed(){//input
  background(0);
  if(key == ENTER){keynum++;return;}
  if(keynum == 0)title += key;
  if(keynum == 1){
    num = key;
  }
 if (keynum == 2) {
    arr.append(key);
    imsi++;
    println(arr);
  }
}

check some lines above how you do the title,
add keys to a string and on ENTER use that,
same here, just the resulting string of numbers you need to convert to number,
that can put into the intList
( IF YOU NEED NUMBERS > 0 … 9 )

Umm, sorry but I don’t understand… So am I supposed to get the enter like
get int, get char(space bar)…?

it is your program,
but i would expect that the first of X number typed be like
1234[ENTER]
so you must catch a string “1234”
and convert to number 1234
and append to intList?
sorry if i understand wrong what you try to do


yes, while you collect the string must check on each key if it is a number…
or the convert will fail ? possibly defaults to ‘0’

2 Likes

Aha so I should get it without space!
Thank you.

I think my code is really full of mistakes. It will take a century fixing this code.
Maybe I should just go to bed right now and think about it tomorrow.
Thank you for your kind explanation^^