Friday, July 01, 2005


//loop aint working having difficulties with stops!

void setup() {
size (625,625); //was 625 by 625
background(252,255,255);
//stroke(0,0,0);
noStroke();
}


/////////////////////////////////////////////////
//global variables


int stopme = 0;
int count2 = 0;
int starthere = 0;
int endhere = 0;
int dont = 6;
int dont2 = 5;
int i = 0;
String intarr [];
String[] matchstart = { "ScriptLog: START MATCH","Log: appRequestExit(0)", "=" , "ScriptLog:"}; //when to start reading and when to stop
int counter = 0;
int arrlen =0;
int arrnum = 0;
String format;
float thelist[];

///////////////////////////////////////////////
//loop


void draw() {


if(dont2==5) { // read the text file know where it ends
intarr = loadStrings("C:/UT2004/System/UT2004.log"); //will read from correct place
dont2=dont2+1; //dont read the file again till you told!
endhere = intarr.length-1;
// need to minus 1 or errors will abound cuz of writing
starthere = starthere +180;

if (starthere >= endhere){
noLoop();
}

starthere = starthere-180;
}


//////////////////////////////////////////////
//find the relevant lines of the text file (want to speed this process up with a while other wise its stuck in the slow draw loop!)

while(dont == 6) {

if(intarr[i].equals(matchstart[0]) == true) { //check for when to begin
println("we hit start match at");
println(i);
starthere = i+1; //this is where the first x value is situated
println(intarr[starthere]);
i=i+1;
dont=dont+1;
} else {
i=i+1;
} //end start check

/*if(intarr[i].equals(matchstart[1]) == true) { //check for when to stop
println("we hit the end of the match at");
println(i);
endhere = i-1; //this is where the final z value is situated
println (intarr[endhere]);

}*/

}//endwhile

////////////////////////////////////////////////////////////////


if (dont ==7){

counter = starthere;
arrlen = endhere-starthere;
println("the end of the match this time is");
println (endhere);

String justnumstrings [] = new String[arrlen];
//println(justnumstrings.length);


dont=dont+1;
stopme = justnumstrings.length /3;
stopme = (stopme - 50); //divisible by 3
stopme = stopme *3;
//println(stopme); //stop me without big black circle!!!// needs to be divisible by 3


while (counter < endhere){ // start while
String temp [] = split(intarr[counter]);
//println (temp[2]);
if ((temp[0].equals(matchstart[3]) == true) && (temp[2].equals(matchstart[2]) == true)) { //stops log: warning: and error: pissing up the script
justnumstrings[arrnum] = temp[3];
arrnum = arrnum+1;
counter= counter+1;
} else {//could use this to read the whole thing... screw the end of the file
counter= counter+1;
}

} // end while

String format = join(justnumstrings, " ");
thelist = float (split(format));



//println(stopme);
}

/////////////////////////////////////////////////////////////////
//in big draw loop

float temp1 = thelist[count2];
float temp2 = thelist[count2+1];
float temp3 = thelist[count2+2];

temp1 = temp1+10000;
temp2 = temp2+10000;
temp3 = temp3+10000;
temp1 = temp1/32;
temp2 = temp2/32;
temp3 = temp3/32;
temp3=temp3-1;

//println (temp3);
int wihi = int(temp3); //width height

//println(wihi);
//point (temp1, temp2);
fill (0,70); //fill(gray, alpha)
ellipse(temp1, temp2, wihi, wihi);// (x,y,width,height)

if (count2 >= stopme){
//noLoop();
starthere = endhere;

intarr = loadStrings("C:/UT2004/System/UT2004.log"); //will read from correct place
endhere = intarr.length-1;

starthere = starthere +180;

if (starthere >= endhere){
noLoop();
println ("we are not looping");
}
starthere = starthere-180;

count2= 0;
dont = 7;
arrnum = 0;
counter =0;
println("match should start again at");
println (starthere);

//} else {
//noLoop();
//println("endof");
//save("diagonal.tif"); (save a piccy)
//}

}
//println (count2);
count2 = count2+3;

//delay(1000); //if delay is needed
}

0 Comments:

Post a Comment

<< Home