We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › getting words from a text file on to screen
Page Index Toggle Pages: 1
getting words from a text file on to screen (Read 290 times)
getting words from a text file on to screen
Jan 28th, 2009, 12:15pm
 
hi im doing a project for uni and im completely stuck ive got a text file of the dark knight film script and i,m want to create a program that gets the words and places them on screen so far ive got a programme that loads the data and seperates the colums in the text file. im really struggling to get words on the screen. please help

heres what ive got so far

public PFont myfont;

public String lines[]=new String[1000];

void setup(){

size(1000,600);
background(0);
fill(0);
smooth();
myfont=createFont("Ariel",24);
lines= loadStrings("batmanthedarkknightend scene.txt");

for (int i=0; i < lines.length; i++) {
 //println(lines[i]);
 
 String[] list1 = split(lines[i],'\t');
 println(list1[1]);
   }
}


void draw(){

background(0);

//println("there are " + lines.length + " lines");
for (int i=0; i < lines.length; i++) {
 //println(lines[i]);
 
 String[] list1 = split(lines[i],'\t');
 println(list1[1]);
 textFont(myfont);
text(list1,30,30);// this is the bit that im strugglingwith


}

}
Re: getting words from a text file on to screen
Reply #1 - Jan 28th, 2009, 1:52pm
 
won't
background(0) followed by
fill(0) put black words on black ? try fill(254)...
Re: getting words from a text file on to screen
Reply #2 - Jan 28th, 2009, 1:54pm
 
also,
text(list1,30,30)
needs a string in the place of 'list1'
try 'list1[0]'
Page Index Toggle Pages: 1