@name EGP for dummies V1 
@inputs EGP:wirelink  
@persist [Blue2 Orange Red Green Blue White Gray]:vector  
@persist [Index Shape Pos Size Color Mindex Sindex Material Said]:array 
@persist [Spos]:array 
@persist Mode I Me:entity Q:string 
@trigger   
runOnChat(1)  
if(chatClk(Me)){  

    LSL=Me:lastSaid():lower()  

    LSE=LSL:explode(" ")  
    LS=owner():lastSaid() 
      
    if(LSE[1,string]=="-draw"){  
          
              
        Shapes=LSE[2,string]  
        IDXs=LSE[3,string]  
        PosXs=LSE[4,string]  
        PosYs=LSE[5,string]  
        SizeXs=LSE[6,string]  
        SizeYs=LSE[7,string]  
        Rs=LSE[8,string]  
        Gs=LSE[9,string]  
        Bs=LSE[10,string]  
        As=LSE[11,string]      
         
        ##Default white  
        if(As==""){As="255"}  
        if(Rs==""){Rs="255"}  
        if(Gs==""){Gs="255"}  
        if(Bs==""){Bs="255"} 
         
        IDX=IDXs:toNumber()  
        PosX=PosXs:toNumber()  
        PosY=PosYs:toNumber()  
        SizeX=SizeXs:toNumber()  
        SizeY=SizeYs:toNumber()  
        R=Rs:toNumber()  
        G=Gs:toNumber()  
        B=Bs:toNumber()  
        A=As:toNumber()  
      

      

        if(LSE[2,string]=="box"){  
            EGP:egpBox(IDX,vec2(PosX,PosY),vec2(SizeX,SizeY),  
            vec4(R,G,B,A))  
            EGP:egpDraw()  
        }  

        if(LSE[2,string]=="boxoutline"){  
            EGP:egpBoxoutline(IDX,vec2(PosX,PosY),vec2(SizeX,SizeY),  
            vec4(R,G,B,A))  
            EGP:egpDraw()  
        }  

        if(LSE[2,string]=="circle"){  
            EGP:egpCircle(IDX,vec2(PosX,PosY),vec2(SizeX,SizeY),  
            vec4(R,G,B,A))  
            EGP:egpDraw()  
        }  
        if(LSE[2,string]=="line"){  
            EGP:egpLine(IDX,vec2(PosX,PosY),vec2(SizeX,SizeY),  
            vec4(R,G,B,A))  
            EGP:egpDraw()  
        }  
          
        Index[IDX,string]=(IDXs)  
          
        Shape[IDX,string]=(Shapes:sub(1,1):upper()+Shapes:sub(2))  
          
        Pos[IDX,string]=(PosXs+","+PosYs)  
          
        Size[IDX,string]=(SizeXs+","+SizeYs)          
          
        Color[IDX,string]=(Rs+","+Gs+","+Bs+","+As)  
          
        if(Mode==1){  
            printColor(Green,"EGP",White,":",Blue,"egp"+  
            Shapes:sub(1,1):upper()+Shapes:sub(2),White,"(",Red,  
            IDXs,White,",",Blue,"vec2",White,"(",Red,PosXs,White,  
            ",",Red,PosYs,White,"),",Blue,"vec2",White,"(",Red,SizeXs,  
            White,",",Red,SizeYs,White,"),",Blue,"vec4",White,"(",Red,  
            Rs,White,",",Red,Gs,White,",",Red,Bs,  
            White,",",Red,As,White,"))")  
        }  
        EGP:egpDraw()  
        EGP:egpClear()  
    }  
    if(LSE[1,string]=="-mat"){  
        Mat=LSE[3,string]  
        IDXs=LSE[2,string]  
        IDX=IDXs:toNumber()  
        EGP:egpMaterial(IDX,Mat)  
         
        Mindex[IDX,string]=IDXs  
        Material[IDX,string]=Mat  
          
            if(Mode==1){  
                printColor(Green,"   EGP",White,":",Blue,"egpMaterial",  
                White,"(",Red,IDXs,White,",",Gray,Q+Mat+Q,White,")")  
            }  
          
        EGP:egpDraw()  
        EGP:egpClear()  
    }       
    if(LSE[1,string]=="-write"){ 
        Txt=LS:explode(Q)[2,string] 
        IDXs=LSE[2,string] 
        IDX=IDXs:toNumber() 
        PosXs=LSE[3,string]  
        PosYs=LSE[4,string] 
        PosX=PosXs:toNumber() 
        PosY=PosYs:toNumber() 
        EGP:egpText(IDX,Txt,vec2(PosX,PosY),vec4(255,255,255,255)) 
        EGP:egpDraw() 
        if(Mode==1){ 
            printColor(Green,"   EGP",White,":",Blue,"egpMaterial",  
            White,"(",Red,IDXs,White,",",Gray,Q+Txt+Q,White,",",Blue, 
            "vec2",White,"(",Red,PosXs,White,",",Red,PosYs,White,"),", 
            Blue,"vec4",White,"(",Red,"255",White,",",Red,"255",White,",", 
            Red,"255",White,",",Red,"255",White,"))")  
        } 
        Sindex[IDX,string]=IDXs 
        Spos[IDX,string]=(PosXs+","+PosYs) 
    }        
    if(LSL=="!progressive on"){  
        Mode=1  
        printColor(Blue2,"Progressive Mode Enabled!")  
    }  
    if(LSL=="!progressive off"){  
        Mode=0  
        printColor(Blue2,"Progressive Mode Disabled!")  
    }  
    if(LSL=="!clear"){  
        EGP:egpClear()  
        Index:clear()  
        Shape:clear()  
        Pos:clear()  
        Size:clear()  
        Color:clear()  
    }  
    if(LSL=="!build e2"){  
        hideChat(1)  
        I=1 
        printColor(Orange,"@name EGP for dummies by Jacoby6000")  
        printColor(Orange,"@inputs EGP:wirelink")  
        printColor(Gray,"##GENERATED BY JACOBY6000'S EGP EASY INTERFACE")  
        printColor(Blue2,"if",White,"(",Blue,"first",White,"()){")  
        while(I<=Index:count()){  
            printColor(Green,"   EGP",White,":",Blue,"egp"+  
            Shape[I,string],White,"(",Red,Index[I,string],White,  
            ",",Blue,"vec2",White,"(",Red,Pos[I,string],White,"),",  
            Blue,"vec2",White,"(",Red,Size[I,string],White,"),",  
            Blue,"vec4",White,"(",Red,Color[I,string],White,"))")  
            I++  
        }  
        I=1 
        while(I<=Sindex:count()){  
            printColor(Green,"   EGP",White,":",Blue,"egpText", 
            White,"(",Red,Sindex[I,string],White,",",Blue,"vec2", 
            White,"(",Red,Spos[I,string],White,"),",Blue,"vec4", 
            White,"(",Red,"255,255,255,255",White,"))")  
            I++  
        }  
        I=1  
        while(I<=Mindex:count()){  
            printColor(Green,"   EGP",White,":",Blue,"egpMaterial",  
            White,"(",Red,Mindex[I,string],White,",",Gray,Q+ 
            Material[I,string]+Q,White,")")  
            I++  
        }  
          
        printColor(Green,"   EGP",White,":",Blue,"egpDraw",White,"()")  
        printColor(White,"}")  
    }  
              
}  
if(first()){  
    concmd("echo ----------------------------------------------------------------------------------------------------------------")  
    concmd("echo ----------------------------------------------------------------------------------------------------------------")  
    concmd("echo ####Version 0.5##########################  COMMANDS SECTION  ###################################################")  
    concmd("echo ## !progressive on/off enables/disables code printing to chat as you create new shapes")  
    concmd("echo ## !build e2 sends the code to console & chat, ready to be copied and pasted directly into an E2 chip")  
    concmd("echo ## !clear obviously, clears all arrays/screen")      
    concmd("echo ## -draw circle index Posx Posy Radiusx Radiusy R G B A Creates a circle with these attributes")  
    concmd("echo ## -draw box index Posx Posy Sizex Sizey R G B A Creates a box with these attributes")  
    concmd("echo ## -draw boxoutline index Posx Posy Sizex Sizey R G B A Creates a boxoutline with these attributes")  
    concmd("echo ## -draw line index Pos1x Pos1y Pos2x Pos2y R G B A Creates a line with these attributes")  
    concmd("echo ## -mat Index Material changes the specified index's material to the said material")  
    concmd("echo ## -write Index PosX PosY 'Text In Quotes' writes text in the stated position")  
    concmd("echo ################################################################################################################")  
    concmd("echo ## Remember this is a WIP")  
    concmd("echo ## Future Updates:")  
    concmd("echo ## Animations (maybe)")  
    concmd("echo ## Polygons")  
    concmd("echo ## Angular stuff")  
    concmd("echo ## Materials")  
    concmd("echo ----------------------------------------------------------------------------------------------------------------")  


    Green=vec(125,255,125)  
    Blue2=vec(65,105,225)  
    Red=vec(255,125,125)  
    White=vec(200,200,200)  
    Orange=vec(255,100,0)  
    Gray=vec(100,100,100)  
    Blue=vec(25,25,112)  
      
    printColor(Gray,"EGP for dummies V0.5",Blue2,"  |  ",Red,"Created by Jacoby6000")  
    printColor(Green,"Type ",Orange,"wire_expression2_concmd 1",Green," in console then respawn the chip for full access to this chips functions, and function list")  
    printColor(Green,"if you still do not see it try:",Orange," wire_expression2_concmd_whitelist echo",Green,", then respawn the chip")  

      
    printColor(Blue2,"Progressive Mode Currently Enabled!")  

    Q=toChar(34) 
    Index=array()  
    Shape=array()  
    Pos=array()  
    Size=array()  
    Color=array()  
    Me=owner()  
    Mode=1  
    I=1  
     
     
     
     
} 