@name Banter
@persist GroupID:string MyNameColour:vector UsePrefix MyPrefix:string MyPrefixColour:vector MyTextColour:vector OldGroupID:string
runOnChat(1)
runOnSignal("banter_message", 2, 1)
runOnSignal("banter_playeraction", 2, 1)

#[
To use Banter, prefix your messages with "~".
Have fun!
-trolldonut
]#

hideChat(1)

#only change these variables

GroupID="banter_main" #automatically join the main chat group
MyNameColour=vec(255, 255, 255) #change your name colour
UsePrefix=0
MyPrefix=""
MyPrefixColour=vec(255, 255, 255) #change your prefix colour
MyTextColour=vec(255, 255, 255)

if(first()){
    dsSetScope(2)
    dsJoinGroup(GroupID)
    TempJoinedArray=array(vec(255, 255, 255),"[",vec(200, 255, 0),"Banter",vec(255, 255, 255),"] ",vec(200, 200, 200)," Player ",MyNameColour,owner():name(),vec(200, 200, 200)," has joined.")
    TempJoinedArray2=array(vec(255, 255, 255),"[",vec(200, 255, 0),"Banter",vec(255, 255, 255),"] ",vec(200, 200, 200)," Joined group ",vec(255, 200, 0),GroupID,vec(200, 200, 200),".")
    printColor(TempJoinedArray2)
    dsSend("banter_playeraction", GroupID, 2, TempJoinedArray)
    #OldGroupID=GroupID
    owner():soundPlay("banter_playeraction", 0, "ui/buttonclickrelease.wav")
}

if(chatClk(owner())){
    TempString=owner():lastSaid()
    if(TempString[1]=="~"){
        if(UsePrefix){
            TempMessageArray=array(vec(255, 255, 255),"[",MyPrefixColour,MyPrefix,vec(255, 255, 255),"]","[",MyNameColour,owner():name(),vec(255, 255, 255),"] ",vec(200, 200, 200),": ",MyTextColour,TempString:sub(2))
        }
        else{
            TempMessageArray=array(vec(255, 255, 255),"[",MyNameColour,owner():name(),vec(255, 255, 255),"]",vec(200, 200, 200),": ",MyTextColour,TempString:sub(2))
        }
        dsSend("banter_message", GroupID, 2, TempMessageArray)
        printColor(TempMessageArray)
    }
    elseif(TempString=="x~"){
        TempLeftArray=array(vec(255, 255, 255),"[",vec(200, 255, 0),"Banter",vec(255, 255, 255),"] ",vec(200, 200, 200), "Player ",MyNameColour,owner():name(),vec(200, 200, 200)," has left.")
        dsSend("banter_playeraction", GroupID, 2, TempLeftArray)
        printColor(TempLeftArray)
        selfDestruct()
    }
    elseif(TempString=="probe~"){
        print(dsProbe(GroupID))
    }else{hideChat(0)}
}

if(dsClk("banter_message")){
    printColor(dsGetArray())
    owner():soundPlay("banter_message", 0, "ui/buttonrollover.wav")
}

if(dsClk("banter_playeraction")){
    printColor(dsGetArray())
    owner():soundPlay("banter_playeraction", 0, "ui/buttonclickrelease.wav")
}

setName("Banter\n"+GroupID)