I made quite the noob script probably, lol. I'm also expected a real noob mistake.. I don't really understand it all just yet.
I'm getting the following error(s):
ai\692.as: INFORMATION : Building.
ai\692.as: <12, 2>: ERROR : Unexpected token 'else'
ai\692.as: ERROR : Unable to build module
int ego(){
//close range:
if (target.y == 0 && abs(target.z-self.z) < 9 && (self.x-target.x)*((self.facing?1:0)*2-1) < 0 && (self.x-target.x)*((self.facing?1:0)*2-1) < 80 && target.state == 16 && self.mp >= 50){
if (abs(self.x-target.x) > 0 && (self.state == 2 || self.state == 0))
if (self.x-target.x > 0){left();} //turn back
else {right();}
}
else if (self.x-target.x < 0){left();} //
else {right();}
return 1;}
//basic move conditions:
else if (target.y == 0 && abs(target.z-self.z) < 9 && (self.x-target.x)*((self.facing?1:0)*2-1) > 0 && (self.x-target.x)*((self.facing?1:0)*2-1) < 80){
if (target.state == 16 && self.mp >= 50 && abs(self.x-target.x) > 50){DuA();} //D^A against DoP
else if (target.state == 16 && self.mp >= 50){ //adjust x for D^A
if (self.x-target.x < 0){left();}
else {right();}
return 1;
}
else if (target.state == 8 || target.state == 16){a();} //A against DoP and broken defense
else if target.state == 16) {dda();} //DvA against DoP
else if (target.state == 3 && self.mp >= 50){D();} //D against attacks with enough mp
if (self.state == 7 && self.bdefend >= 20){DuA();} //D^A from critical defense
//long/mid range:
if (target.y == 0 && abs(target.z-self.z) < 7 && (self.x-target.x)*((self.facing?1:0)*2-1) && if (((self.x-target.x) => 120) && ((self.x-target.x) =< 220)) && self.mp >= 110){
if (abs(self.x-target.x) > 0 && (self.state == 1 || self.state == 0))
if (self.x-target.x > 0){dda();} //DvA
else {left();} //turn back
else {right();} //turn back
}
if (target.y == 0 && abs(target.z-self.z) < 7 && (self.x-target.x)*((self.facing?1:0)*2-1) && if (((self.x-target.x) => 300) && ((self.x-target.x) =< 500)) && self.mp >= 175){
if (abs(self.x-target.x) > 0 && (self.state == 1 || self.state == 0)){
if (self.x-target.x > 0){DrJ();} //D>J
else if (self.x-target.x < 0){DlJ();} //D<J
else {right();} //turn back
else {left();} //turn back
}
else if (abs(100*(self.z-target.z)/((self.x-target.x)*((self.facing?1:0)*2-1))) <= 15 && abs(self.x-target.x) < 300 && abs(self.x-target.x) > 150){
if (self.x-target.x > 0){DlA();} //D<A
else if (self.x-target.x < 0){DrA();} //D>A
}
//instant attacks
if (self.state == 5){A();} //dash attack
if ((self.frame == 286 && target.state == 11 || target.state == 16) {A();} //long combination
if ((self.frame == 353 && target.state == 11 || target.state == 16) {J();} //meteor combination
else if ((self.frame == 353 && target.state == 11 || target.state == 16) {DrJ();} //kamehameha combination
if (self.frame == 244) && (abs(self.z-target.z) => 15){DuJ();} //IT kamehameha
return 0;
I also don't really understand when I should use certain characters such as {. And yes, I used Clide as a base for his AI...