@name Secret Chat
@inputs Memory InUse User:entity 
#@inputs Friend1:string Sent1 
#@inputs Friend2:string Sent2
@outputs Message:string Send Activate Self
@persist Self Message:string Send Device:array
@trigger 
if(duped()){reset()}
gShare(1)
interval(200)
gSetGroup("Secret")
if(!Self){
S="Self"
    Num=gGetNum(S)
    Max=3
    if(!Num){Self=1 gSetNum(S,Self)}
    if(Num<Max){Self=Num+1 gSetNum(S,Self)}
    if(Num>=Max){Self=1 gSetNum(S,Self)}
    print("Your ID is: "+Self)
    }

Color1=vec(0,128,255)
Color2=vec(0,200,0)
Color3=vec(255,0,0)
Device=entity():getConstraints()
if(Self==1){ID="1" Friendly1="2" Friendly2="3"
            Colour1=Color2 Colour2=Color3
            entity():setColor(Color1)
            for(X=1,Device:count()){
                Device[X,entity]:setColor(Color1)
            }}
if(Self==2){ID="2" Friendly1="1" Friendly2="3"
            Colour1=Color1 Colour2=Color3
            entity():setColor(Color2)
            for(X=1,Device:count()){
                Device[X,entity]:setColor(Color2)
            }}
if(Self==3){ID="3" Friendly1="1" Friendly2="2"
            Colour1=Color1 Colour2=Color2
            entity():setColor(Color3)
            for(X=1,Device:count()){
                Device[X,entity]:setColor(Color3)
            }}
runOnChat(1)
K=chatClk()

Chat=entity():owner():lastSaid()
Com=Chat:find("#c")
if(first()){Message=entity():owner():name()+": "}
Check=~Memory&Memory
if(InUse&Check){
if(Memory&(Memory!=13|Memory!=127)){
Message+=toChar(Memory)

}
if(Memory==127){Message=Message:sub(1,Message:length()-2)} #backspace
if(Memory==13){timer("enter",200) Send=1} #enter
}
if(clk("enter")){Message=User:name()+": " Send=0}

if(clk()){
gSetStr(ID,Message)
gSetNum(ID,Send)

Friend1=gGetStr(Friendly1)
Sent1=gGetNum(Friendly1)

Friend2=gGetStr(Friendly2)
Sent2=gGetNum(Friendly2)
}

if(Sent1){printColor(Colour1,Friend1)}
if(Sent2){printColor(Colour2,Friend2)}

if(K&Com){Activate=1}else{Activate=0}
