@name Base Builder Main
@inputs 
@outputs 
@persist Models:gtable
@trigger 

if(first() | dupefinished()){
    Models = gTable("Models",0)
    Index=1
    MIndex=1
    }

interval(10)
runOnChat(1)

O=chatClk(owner())

if(O){
    Ow = owner()
    Chat = owner():lastSaid():explode(" ")
    C1= Chat:string(1)
    switch(C1){
        case "/on",
        hideChat(1)
        Ow:soundPlay(0,0,"buttons/button19.wav")
        print(_HUD_PRINTCENTER, "Base Builder Activated")
        On=1
        break
        
        case "/off",
        hideChat(1)
        Ow:soundPlay(0,0,"buttons/combine_button_locked.wav")
        print(_HUD_PRINTCENTER,"Base Builder Off")
        On=0
        break
        }
    }

Pos = owner():aimPos()
while(On & perf(100)){
    
    Ow = owner()
    if(Index>=1 | ~Index){
        holoCreate(Index)
        }
    if(Ow:keyAttack1()){
        MIndex++
        }
    if(Ow:keyAttack2()){
        MIndex--
        print(MIndex)
        }
    holoPos(Index,Pos)
    holoModel(Index, Models[MIndex, string])
    }
