Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AI Syntax Highlighter
#1
'sup guys,

I finally came around to add the desperately needed syntax-highlighting-mechanism for AI-scripts. This can be accessed by using [code=ai]. It'll render something like this:

    AI-Code:
void id(){
    // reset all inputs
    left(0,0);
    right(0,0);
    J(0,0);
    up(0,0);
    down(0,0);
    A(0,0);
    D(0,0);
 
    for (int i = 0; i < 400; i++)
    {
        if (loadTarget(i) == 0 && target.num != self.num)
            break;
    }
 
    int distance = abs(target.x - self.x);
    int zdistance = abs(target.z - self.z);
    bool jump = false;
 
 
 
 
    if(distance < 300 || self.state == 2 || (target.state == 2 && distance < 350))
    {
        jump = true;
 
        if (bg_width - self.x < 100)
        {
            left();
        }
        else if (self.x < 100)
        {
            right();
        }
        else if (target.x > self.x)
        {
            left();
        }
        else
        {
            right();
        }
 
        if(self.state == 2 && jump){J();}
    }
    else{
        if (target.x > self.x && self.facing)
        {
            right(1,1);
        }
        else if (target.x < self.x && !self.facing)
        {
            left(1,1);
        }
 
        if (target.blink == 0 && target.state != 6 && target.state != 12 && target.state != 14)
        {
            if (target.z > self.z && zdistance > 10)
            {
                down();
            }
            else if(target.z < self.z)
            {
                up();
            }
 
            if (distance < 473)
            {
                if (zdistance < 10)
                {
                    A();
                }
                else if (zdistance > 15 && zdistance < 40)
                {
                    if (target.z > self.z)
                    {
                        down(1,0);
                    }
                    else
                    {
                        up();
                    }
                    A();
                }
 
            }
        }
    }
}
Props to Silva for letting me steal his Annoying Henry AI without him even knowing :p

All for now, yo :D
Silverthorn / Blue Phoenix
~ Breaking LFE since 2008 ~

"Freeze, you're under vrest!" - Mark, probably.

» Gallery | » Sprites | » DeviantArt
Reply
Thanks given by: Rhino.Freak , Som1Lse , onikage , Eddie , YinYin , Dr. Time , AmadisLFE




Users browsing this thread: 1 Guest(s)