Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error: expected expression value
#1
So i decided to rewrite all the old AI chai script to the new angel script AI's.BUT, i keep getting this error: "expected expression value".
Why is that? what did i do wrong??
here is a very simple short code that produces the error:
    C-Code:
int ego(){
 
    A(0,0); //reset keys
    D(0,0);
    J(0,0);
    up(0,0);
    down(0,0);
    left(0,0);
    right(0,0);
 
    for (int i = 0; i < 400; i++){ //target
        if (loadTarget(i) == 0 && target.num != self.num && target.hp > 0 && target.id < 100 && target.team != self.team){
            break;
        }
    }
 
 
    int xdist = target.x-self.x;
    int ydist = target.y-self.y;
    int zdist = target.z-self.z;
    int selfacing;
    int random = rand(4);
 
 
 
if (((self.x-target.x) => 0) && ((self.x-target.x) =< 80)){
  left()
}
return 1;
 
}

This code is small, simple AND useless. But still, i keep getting the same error in the "if (((self.x-target.x) => 0) && ((self.x-target.x) =< 80)){" line.
Any kind of help is appreciated.
[Image: signature.png]
A-Engine: A new beat em up game engine inspired by LF2. Coming soon

A-Engine Dev Blog - Update #8: Timeout

Reply
Thanks given by:
#2
>= and <= instead of => and =< (maybe?)

also missing ; after left().

also too many brackets

Code:
if (self.x-target.x >= 0 && self.x-target.x >= 80)
{
    left();
}
[Image: doty7Xn.gif]

10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.


Reply
Thanks given by: The Lost Global Mod , A-Man
#3
SSSSSSSSSSSSSS!!! It worked!! thanx dude!
@YinYin: Please update your tut. its <= not =<.
Ok. I got another problem and i though it would be stupid if i made another thread for it.
Well, It went fine, then i started getting this error: Expected ';'
I guess i did all the semi colons pretty fine. Here is my code:
    C-Code:
int ego(){
 
 
    int xdist = target.x-self.x;
    int ydist = target.y-self.y;
    int zdist = target.z-self.z;
    int xdista = (target.x-self.x)*(2*self.facing-1);
 
    int random = rand(4);
 
 
 
if (zdist >= 5)
{up();
}elseif (zdist <= -5)
{down();
}elseif (zdist <= 5)
{up(0,0);
}elseif (zdist >= -5)
{down(0,0);
}
 
if (zdist >= 5 && zdist <= -5 && xdista <= 45)
{
DuJ();
} 
 
 
 
return 1;
 
}

Help AGAIN!
Ok, I fixed that error now. It was because i typed "elseif" when the right thing is "else if". But, AGAIN, I got another error i once had in the morning. Error: No conversion from 'bool' to math type available . here is the code:
    C-Code:
int ego(){
 
 
    int xdist = target.x-self.x;
    int ydist = target.y-self.y;
    int zdist = target.z-self.z;
    int xdista = (target.x-self.x)*(2*self.facing-1);
 
    int random = rand(4);
 
 
 
if (zdist >= 5)
{
up();
}else if (zdist <= -5)
{
down();
}else if (zdist <= 5)
{
up(0,0);
}else if (zdist >= -5)
{
down(0,0);
}
 
if (zdist >= 5 && zdist <= -5 && xdista <= 45)
{
DuJ();
} 
return 1;
}

[Image: signature.png]
A-Engine: A new beat em up game engine inspired by LF2. Coming soon

A-Engine Dev Blog - Update #8: Timeout

Reply
Thanks given by:
#4
self.facing is a bool rather than an int (blame SomeoneElse he changed it). Also post the line the error happens on so people don't have to look everywhere. You could do:

Code:
int tempFacing;

if (self.facing)
{
    tempFacing = 1;
}
else
{
    tempFacing = 0;
}

int xdista = (target.x-self.x)*(2*tempFacing-1);

Anyway you god damn read about this(http://lf-empire.de/forum/thread-7927-po...#pid153289), and even posted about it! http://lf-empire.de/forum/thread-7927-po...#pid153292

Clearly proof that people don't read things and just post for some strange reason unknown to me.
[Image: doty7Xn.gif]

10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.


Reply
Thanks given by: A-Man
#5
Ok man. As that was suppose convert the bool value inside to int. That code it self got errors:
ai/10.as(2, 5): Error: Expected expression value
ai/10.as(9, 1): Error: Expected expression value

Code:
int ego(){
    int tempFacing:


if (self.facing)
{
    tempFacing = 1;
}
else
{
    tempFacing = 0;
}

    int xdist = target.x-self.x;
    int ydist = target.y-self.y;
    int zdist = target.z-self.z;
int xdista = (target.x-self.x)*(2*tempFacing-1);

    int random = rand(4);



if (zdist >= 5)
{
up();
}else if (zdist <= -5)
{
down();
}else if (zdist <= 5)
{
up(0,0);
}else if (zdist >= -5)
{
down(0,0);
}

if (zdist >= 5 && zdist <= -5 && xdista <= 45)
{
DuJ();
}



return 1;

}
[Image: signature.png]
A-Engine: A new beat em up game engine inspired by LF2. Coming soon

A-Engine Dev Blog - Update #8: Timeout

Reply
Thanks given by:
#6
(07-30-2012, 06:41 PM)A-MAN Wrote:  Ok man. As that was suppose convert the bool value inside to int. That code it self got errors:
ai/10.as(2, 5): Error: Expected expression value
ai/10.as(9, 1): Error: Expected expression value

Code:
int ego(){
    int tempFacing:


if (self.facing)
{
    tempFacing = 1;
}
else
{
    tempFacing = 0;
}

    int xdist = target.x-self.x;
    int ydist = target.y-self.y;
    int zdist = target.z-self.z;
int xdista = (target.x-self.x)*(2*tempFacing-1);

    int random = rand(4);



if (zdist >= 5)
{
up();
}else if (zdist <= -5)
{
down();
}else if (zdist <= 5)
{
up(0,0);
}else if (zdist >= -5)
{
down(0,0);
}

if (zdist >= 5 && zdist <= -5 && xdista <= 45)
{
DuJ();
}



return 1;

}

....

int tempFacing; not :

Code:
int ego(){

    int tempFacing;

    if (self.facing)
    {
        tempFacing = 1;
    }
    else
    {
        tempFacing = 0;
    }

    int xdist = target.x-self.x;
    int ydist = target.y-self.y;
    int zdist = target.z-self.z;
    int xdista = (target.x-self.x)*(2*tempFacing-1);

    int random = rand(4);

    if (zdist >= 5)
    {
        up();
    }
    else if (zdist <= -5)
    {
        down();
    }
    else if (zdist <= 5)
    {
        up(0,0);
    }
    else if (zdist >= -5)
    {
        down(0,0);
    }

    if (zdist >= 5 && zdist <= -5 && xdista <= 45)
    {
        DuJ();
    }
    return 1;
}
[Image: doty7Xn.gif]

10 ʏᴇᴀʀs sɪɴᴄᴇ ɪʀᴄ ɢᴏᴏᴅ.ɪ ᴡᴀʟᴋ ᴛʜʀᴏᴜɢʜ ᴛʜᴇ ᴇᴍᴘᴛʏ sᴛʀᴇᴇᴛs ᴛʀʏɪɴɢ ᴛᴏ ᴛʜɪɴᴋ ᴏғ sᴏᴍᴇᴛʜɪɴɢ ᴇʟsᴇ ʙᴜᴛ ᴍʏ ᴘᴀᴛʜ ᴀʟᴡᴀʏs ʟᴇᴀᴅs ᴛᴏ ᴛʜᴇ ɪʀᴄ. ɪ sᴛᴀʀᴇ ᴀᴛ ᴛʜᴇ sᴄʀᴇᴇɴ ғᴏʀ ʜᴏᴜʀs ᴀɴᴅ ᴛʀʏ ᴛᴏ sᴜᴍᴍᴏɴ ᴛʜᴇ ɢᴏᴏᴅ ɪʀᴄ. ɪ ᴡᴀᴛᴄʜ ᴏᴛʜᴇʀ ɪʀᴄ ᴄʜᴀɴɴᴇʟs ʙᴜᴛ ɪᴛ ɪs ɴᴏ ɢᴏᴏᴅ. ɪ ᴘᴇsᴛᴇʀ ᴢᴏʀᴛ ᴀɴᴅ ᴛʀʏ ᴛᴏ ʀᴇsɪsᴛ ʜɪs sᴇxɪɴᴇss ʙᴜᴛ ɪᴛ ɪs ᴀʟʟ ᴍᴇᴀɴɪɴɢʟᴇss. ᴛʜᴇ ᴇɴᴅ ɪs ɴᴇᴀʀ.ɪ ᴛʜᴇɴ ᴜsᴜᴀʟʟʏ ʀᴇᴀᴅ sᴏᴍᴇ ᴏʟᴅ ɪʀᴄ ʟᴏɢs ᴀɴᴅ ᴄʀʏ ᴍʏsᴇʟғ ᴛᴏ sʟᴇᴇᴘ.


Reply
Thanks given by: A-Man




Users browsing this thread: 1 Guest(s)