at first I load string in setup and because every time I need to loadstring ,so I write in draw function too, and code below, but there are the problem ,null pointerException.seems like sometimes there are null in the array ,but why ? actually I write something in the rtf, and even though maybe updating is the same text ,but there still will be something in the array .so could some guys help me with my problem or tell me if there are some better way to make the auto print extra word up
void setup()
{
size(1020, 640);
background(153,46,150);
s=loadStrings("b.txt");
totalS=join(s," ");
words=splitTokens(totalS," ,.?!οΌγοΌοΌββγ");
}
void draw(){
if(frameCount%60==0)
{
currentS=loadStrings("b.txt");
CurrenttotalS=join(currentS," ");
currentWords=splitTokens(CurrenttotalS," ,.?!οΌγοΌοΌββγ");
}
}
void mouseReleased()
{
if(CurrenttotalS.length()!=totalS.length()&¤tS!=null&&s!=null&¤tWords!=null&&words!=null)
{
for(int i=words.length;i<currentWords.length;i++)
{
println(currentWords[i]+i);
println(currentWords.length);
}
words=currentWords;
}
else if(CurrenttotalS.length()==totalS.length())
{
println(0);
}
}