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 & HelpOther Libraries › Rita library Query
Page Index Toggle Pages: 1
Rita library Query (Read 463 times)
Rita library Query
Oct 21st, 2009, 8:07am
 
Hi again,

I am trying to get a Rita library example working and am getting this error message:

Exception in thread "Animation Thread" java.lang.IllegalStateException: [ERROR] Undefined grammar token: '<start>' in haiku.g.rtf

I have downloaded the Rita library from here:
http://www.rednoise.org/rita/

I have also created an RTF file in my data folder called:
"haiku.g.rtf"

It seems to be correct in terms of the library documentation (here):
http://www.rednoise.org/rita/documentation/rigrammar_class_rigrammar.htm

But for some reason I can not get it to work. Is it something really obvious? My apologies if it is!

the code is here. Thank you:
Code:
import rita.*;

RiText[] rts;
RiGrammar grammar;

void setup()
{
size(650, 200);
rts = new RiText[3];
RiText.setDefaultAlignment(CENTER);
RiText.setDefaultFont("Helvetica-48.vlw");
rts[0] = new RiText(this, "click to", width/2, 85);
rts[1] = new RiText(this, "generate", width/2, 110);
rts[2] = new RiText(this, "a haiku", width/2, 135);
grammar = new RiGrammar(this, "haiku.g.rtf");
}

void draw()
{
background(100);
}

void mouseClicked()
{
String result = grammar.expand();
String[] lines = result.split("%");
for (int i = 0; i < rts.length; i++) {
rts[i].fadeToText(lines[i].trim(), 1.0f);
}
}



Page Index Toggle Pages: 1