@name EGP Store Tutorial
@inputs EGP:wirelink Up Down Select Money
@inputs  R1 R2 R3 R4 R5 R6 
@outputs U1 U2 U3 U4 U5 U6 UM
@outputs I1:string I2:string I3:string I4:string I5:string I6:string 
@outputs P1 P2 P3 P4 P5 P6 
@persist Index
@persist Prices:array
@trigger 



#Screen 
if(first() | duped()){
    hint("type /help for commands", 3)
    EGP:egpClear()
    Index = 1
    #creating a title
    EGP:egpText(2, owner():name()+"'s gun store", vec2(110, 30))
    EGP:egpSize(2, 30)
    EGP:egpColor(2, vec(0,120,255))
    #create a box for the title
    EGP:egpBox(1, vec2(150, 10), vec2(1000, 200)) 
    EGP:egpAlpha(1, 120)
    EGP:egpColor(1, vec(100,100,100))
    #Split the Screen
    EGP:egpLine(3, vec2(255, 110), vec2(255, 510))
    #Items Side
    for(I=1, 6){
        EGP:egpCircle(3+I, vec2(30,100+50*I),vec2(10,10))
        EGP:egpColor(3+I, vec(0,120,255))
        }
    for(I=1, 6){
        EGP:egpText(9+I, "$", vec2(275, 90+50*I))
        }
    EGP:egpColor(9, vec(120,20,200))
    EGP:egpText(289, "Amount: $", vec2(30, 450))
    }

#Chat Commands
runOnChat(1)
if(chatClk(owner())){
    Chat = owner():lastSaid():explode(" ")
    if(Chat:string(1)=="/help"){
        hint("Check Console", 4)
        print(_HUD_PRINTCONSOLE, "===================================")
        print(_HUD_PRINTCONSOLE, "|Type /i (number) (name) (price)   |")
        print(_HUD_PRINTCONSOLE, "|Example: /i 1 ak 600              |")
        print(_HUD_PRINTCONSOLE, "===================================")
        }
    # Hello world this is jim
    if(Chat:string(1)=="/i"){
        hideChat(1)
        ioSetOutput("I"+Chat:string(2), Chat:string(3))
        ioSetOutput("P"+Chat:string(2), Chat:string(4):toNumber())
        }
    Items = array(I1, I2, I3, I4, I5, I6)
    Prices = array(P1, P2, P3, P4, P5, P6)
    for(I=1, 6){
        EGP:egpText(I+100, Items[I, string], vec2(55, 90+50*I))
        }
    for(I=1, 6){
        EGP:egpText(I+200, Prices[I, number]:toString(), vec2(285, 90+50*I))
        }

    }

#Controls & Highlighter
if(Up & ~Up){
    Index--
    soundPlay(0,0,"buttons/lightswitch2.wav")
    }    
if(Down & ~Down){
    Index++
    soundPlay(0,0,"buttons/lightswitch2.wav")
    }

if(Index < 1){
    Index = 6
    }
if(Index > 6){
    Index = 1
    }

if(Select & ~Select){
    UM=1
    if(Money>=Prices[Index, number]){
        ioSetOutput("U"+Index, 1)
        soundPlay(0,0,"buttons/weapon_confirm.wav")
    }
    else{
    soundPlay(0,0,"buttons/weapon_cant_buy.wav")
}
    }
else{
    
    UM=0
        for(I=1, 6){
            ioSetOutput("U"+I, 0)
            }
    }





EGP:egpText(290, Money:toString(), vec2(110, 450))
if(Index==1){EGP:egpColor(4, vec(255,0,0))}else{EGP:egpColor(4, vec(0,120,255))}
if(Index==2){EGP:egpColor(5, vec(255,0,0))}else{EGP:egpColor(5, vec(0,120,255))}
if(Index==3){EGP:egpColor(6, vec(255,0,0))}else{EGP:egpColor(6, vec(0,120,255))}
if(Index==4){EGP:egpColor(7, vec(255,0,0))}else{EGP:egpColor(7, vec(0,120,255))}
if(Index==5){EGP:egpColor(8, vec(255,0,0))}else{EGP:egpColor(8, vec(0,120,255))}
if(Index==6){EGP:egpColor(9, vec(255,0,0))}else{EGP:egpColor(9, vec(0,120,255))}
