anyything in a line past two forward slashes is just a comment, and does not affect the script.
// this is a comment
so, take a look at the following script. when it is "created" it sets this.enabled to true.
When a player says "birdie!" this.enabled is set to the negation of itself.
That setting of the negation is what causes the the toggling between the parrot repeating mode 'On' and 'Off'.
Whenever the player says something that is not "birdie!", it checks if this.enabled is true.
If that checks out, it repeats what the player says.
function onCreated() {
this.enabled = true;
}
function onPlayerChats() {
if (player.chat == "birdie!") {
// enable or disable here
this.enabled = !this.enabled;
} elseif (this.enabled) {
// if its enabled, repeat what player says
this.chat = player.chat;
}
}