Screen To Camera icon Screen To Camera — Capture any screen area and stream video to a configured camera device; requires a Custom device and 100% display scaling. Try it →
Asked
Shuffle-Bag Rewrite For Arc Script

Shuffle-Bag Rewrite For Arc Script

I've been working and spending a lot of credits (bought with real money) with the Script AI Assistant in ARC trying to get it to rewrite this script. I'm having trouble getting it to make the changes so I can get a fully working script. It will make the requested changes but only send a small block and then it wants me to splice it together or copy over some existing code blocks. After a while I got lost. It's probably me not being able to work with AI properly yet.

Anyway, I'm going to try it here as I've gotten good results using this AI. Also I'm out of money. LOL. Again, it's probably me.

So, here's what I need: I worked with Athena yesterday doing this with a much smaller script.

This script when called will randomly pick character from from the choices. It will then randomly pick a sound file to play for that character. It will repeat this action for a total of three times. Between each of the three character picks it will also say a random intermediate sound clip. When all three picks are complete it will play a closing sound clip. 

I want the character picks and sound clips random play choices changed from using the current Utility.GetRandomUnique() method to the Shuffle bag method. 

Use the below example as a guide to what I want to do:
//----------------------------------------------------------------------
var animationList = [
    "Attack",
    "Danger! Danger!",
    "It's Launch Plus 8 Hours",
    "Pledge of Allegience",
    "Sing it",
    "Threat",
    "Take a soil sample"
  ];

  // Load bag from global CSV string
  var bagText = getVar("$animationBag", "");

  // Convert CSV string to local array
  var bag = [];
  if (bagText != null && bagText != "") {
    bag = ("" + bagText).split(",");
  }

  // Refill if empty
  if (bag.length == 0) {
    bag = refillAnimationBag(animationList);
  }

  // Select first item
  var selectedAnimation = bag[0];

  // Remove first item manually
  var newBag = [];
  for (var i = 1; i < bag.length; i++) {
    newBag.push(bag[i]);
  }

  setVar("$animationBag", newBag.join(","));
  setVar("$lastAnimationPlayed", selectedAnimation);

  print("ADC3: starting random animation -> " + selectedAnimation);
  print("ADC3: remaining bag -> " + newBag.join(", "));

  controlCommand("Robot Anamations", "ScriptStart", selectedAnimation);

  // Safety timeout
  var timeoutMs = 30000;
  var elapsed = 0;
  var step = 100;

  while (getVar("$animationStatus", "1") == "1" && elapsed < timeoutMs) {
    sleep(step);
    elapsed += step;
  }

  if (getVar("$animationStatus", "1") == "1") {
    print("ADC3: timeout waiting for animation completion -> " + selectedAnimation);
    setVar("$animationStatus", "0");
  }

  print("ADC3: completed animation -> " + selectedAnimation);
};

function refillAnimationBag(animationList) {
  var temp = [];

  for (var i = 0; i < animationList.length; i++) {
    temp.push(animationList[i]);
  }

  // Fisher-Yates shuffle
  for (var j = temp.length - 1; j > 0; j--) {
    var k = Utility.getRandom(0, j + 1);
    var swap = temp[j];
    temp[j] = temp[k];
    temp[k] = swap;
  }

  // Avoid repeating last played as first after refill
  var lastAnimation = getVar("$lastAnimationPlayed", "");
  if (temp.length > 1 && temp[0] == lastAnimation) {
    var swapFirst = temp[0];
    temp[0] = temp[1];
    temp[1] = swapFirst;
  }

The script that the ARC Script AI did for me ran but it didn't have the 1 to 1 sleep command mapping correct. All the sound clips in the Character's would not complete before moving on the the next choice.

So, can you rewrite this script using the shuffle-bag method I showed above instead of using the current Utility.GetRandomUnique() method I use? I need this to pause and let each sound file complete. before moving on. All the Sleep commands in the below script are correct to let the sound file above it complete.

Feel free to refactor this script in any way to get it more efferent and to work with the shuffle bag method and let it complete playing the called sound clip. So mainly I need the rewrite to:

  • Builds a shuffled bag under each block that currently using the Utility.GetRandomUnique() method
  • Picks the next animation from the bag
  • Removes it from the bag after use
  • Rebuilds and reshuffles only when the bag is empty
  • Keeps my existing pause / wait / restart flow
  • Refill automatically when empty
  • Avoid repeating the same sound clip first after a refill
  • Make sure all sleep commands match their current sound files.

Here's the script I need refactores as I stated above (it's a long one):


// ------------------------------
// Main Entry
// ------------------------------
runImpressionShow();

function runImpressionShow() {
  beginShow();
  
  playOpeningAcknowledgement();
  // Loop the random character section 3 times
  for (var repete = 0; repete < 3; repete++) {
    playRandomCharacter(repete);
  }

  finishCharacterPhase();
  stopMotorsAndLights();
  playClosingPhrase();
  resetArmsAndReleaseServos();
  endShow();
}

// ------------------------------
// Show lifecycle helpers
// ------------------------------
function beginShow() {
  setVar("$Personality", "1"); //Mark "1" so all other scripts know this script is running
  setVar( "$animationStatus", "1") //ADC watcher Script is waiting for this to change to 0 when this script is coplete
  controlCommand("Personality Generator", "PauseOn"); //called script will restart this function
  controlCommand("Weather Loop", "ScriptStop"); //called script will restart this function
  sleep(100);

  // Start motion/lighting
  Digital.set(D0, true);   // Ear Motors (board 0)
  PWM.set(D9, 20);         // Crown Motor (board 0)
  Digital.set(D10, true);  // Fast Brain Lights
  Digital.set(D3, true);   // Fast Chest Lights

  // Initial arm and waist actions
  controlCommand("Left Arm", "ScriptStart", "Left Claw Closed");
  controlCommand("Right Arm", "ScriptStart", "Right Claw Closed");
  controlCommand("Leg Section", "ScriptStart", "Loop Random Waist 1/4 turns");
}

function finishCharacterPhase() {
  controlCommand("Head Section", "ScriptStart", "Bubble Up and Down");
  controlCommand("Head Section", "ScriptStart", "Radar Fast Sweep");
  controlCommand("Leg Section", "ScriptStop", "Loop Random Waist 1/4 turns");
}

function stopMotorsAndLights() {
  Digital.set(D0, false); // Stop Ear Motors
  sleep(50);
  PWM.set(D9, 0);         // Stop Crown Motor
  Digital.set(D3, false); // Stop Fast Chest Lights
  Digital.set(D10, false);// Stop Fast Brain Lights
}

function resetArmsAndReleaseServos() {
  controlCommand("Left Arm", "ScriptStart", "Left Claw Rest Open");
  controlCommand("Right Arm", "ScriptStart", "Right Claw Rest Open");
  controlCommand("Leg Section", "ScriptStart", "Waist Center"); 
  sleep(2000);

  // Release wrist servos on board 2
  //Servo.release(D4, 2); // Left Wrist Up/Down
  //Servo.release(D5, 2); // Left Wrist Side/Side
  //Servo.release(D1, 2); // Right Wrist Up/Down
  //Servo.release(D0, 2); // Right Wrist Side/Side
}

function endShow() {
  setVar("$Personality", "0"); //Mark "0" so all other scripts know this script has stopped  running
  setVar( "$animationStatus", "0") //ADC watcher Script is waiting for this to change to 1 when this script is coplete
  controlCommand("Personality Generator", "PauseOff");
  controlCommand("Weather Loop", "ScriptStart"); 
  sleep(100);
}

// ------------------------------
// Opening / Closing phrase blocks
// ------------------------------
function playOpeningAcknowledgement() {
  acknowledge = Utility.GetRandomUnique(1, 16)
sleep(100)

// Response depending on random number
if (acknowledge == 1) {
  controlCommand("Soundboard v4", "Track_60") //Say "I Do Impressions"
  sleep(3500)
} else if (acknowledge == 2) {
  controlCommand("Soundboard v4", "Track_61") //Say "Let's Party"
  sleep(3000)
} else if (acknowledge == 3) {
  controlCommand("Soundboard v4", "Track_62") //Say "Let's Rock"
  sleep(3000)
} else if (acknowledge == 4) {
  controlCommand("Soundboard v4", "Track_63") //Say "What Would You Like Me To Do?"
  sleep(3250)
  controlCommand("Soundboard v4", "Track_35") //Say "I Know"
  sleep(1500)
} else if (acknowledge == 5) {
  controlCommand("Soundboard v4", "Track_64") //Say " Will I be on telavision?"
  sleep(2500)
  controlCommand("Soundboard v4", "Track_99") //Say "I enjoy being on Telavision"
  sleep(3000)
} else if (acknowledge == 6) {
  controlCommand("Soundboard v4", "Track_65") //Say "Affirmative"
  sleep(2500)
} else if (acknowledge == 7) {
  controlCommand("Soundboard v4", "Track_66") //Say "Affirmative" (alternate)
  sleep(3000)
} else if (acknowledge == 8) {
  controlCommand("Soundboard v4", "Track_67") //Say "OK"
  sleep(3000)
} else if (acknowledge == 9) {
  controlCommand("Soundboard v4", "Track_68") //Say "OK" (alternate)
  sleep(3000)
} else if (acknowledge == 10) {
  controlCommand("Soundboard v4", "Play", "HaveNoFear-RobotHere.mp3");
  sleep(2500)
} else if (acknowledge == 11) {
  controlCommand("Soundboard v4", "Track_23") //Say "Green and go"
  sleep(3000)
} else if (acknowledge == 12) {
controlCommand("Soundboard 2", "Play", "Caution-PatienceAdvised.mp3");
  sleep(3000)
} else if (acknowledge == 13) {
  controlCommand("Soundboard v4", "Track_33") //Say "Please stand by"
  sleep(3500)
} else if (acknowledge == 14) {
  controlCommand("Soundboard v4", "Track_35") //Say "I know"
  sleep(2500)
} else if (acknowledge == 15) {
  controlCommand("Soundboard v4", "Play", "HowSweet-It-Is.mp3");
  sleep(3500)
}
}

function playClosingPhrase() {
  var End_Script = Utility.getRandomUnique(1, 16);
  sleep(100);

  if (End_Script == 1) {
  controlCommand("Soundboard v4", "Track_52") //Say "Thanks for coming"
  sleep(3500)
} else if (End_Script == 2) {
  controlCommand("Soundboard v4", "Track_83") //Say "It's been a pleasure to serve you"
  sleep(3000)
} else if (End_Script == 3) {
  controlCommand("Soundboard v4", "Track_84") //Say "Goodby"
  sleep(3000)
} else if (End_Script == 4) {
  controlCommand("Soundboard v4", "Track_85") //Say "My power pack needs charging"
  sleep(6000)
} else if (End_Script == 5) {
  controlCommand("Soundboard v4", "Track_86") //Say "Conclusion"
  sleep(3000)
} else if (End_Script == 6) {
  controlCommand("Soundboard v4", "Track_87") //Say "Do I amuse you?"
  sleep(2500)
} else if (End_Script == 7) {
  controlCommand("Soundboard v4", "Track_88") //Say "End of report"
  sleep(3000)
} else if (End_Script == 8) {
  controlCommand("Soundboard v4", "Track_89") //Say "How Sweet it is"
  sleep(3000)
} else if (End_Script == 9) {
  controlCommand("Soundboard v4", "Track_90") //Say "Have no fear, the robot is here"
  sleep(3000)
} else if (End_Script == 10) {
  controlCommand("Soundboard v4", "Track_91") //Say "May the force be with you"
  sleep(2500)
} else if (End_Script == 11) {
  controlCommand("Soundboard v4", "Track_92") //Say "To Boldly go where no Robot has gone before"
  sleep(4000)
} else if (End_Script == 12) {
  controlCommand("Soundboard v4", "Track_9") //Say "Hasta la vista baby"
  sleep(3000)
} else if (End_Script == 13) {
  controlCommand("Soundboard v4", "Track_10") //Say "Live Long and Prosper"
  sleep(3000)
} else if (End_Script == 14) {
  controlCommand("Soundboard v4", "Track_36") //Say "So it goes"
  sleep(2500)
} else if (End_Script == 15) {
  controlCommand("Soundboard v4", "Track_51") //Say "Drinks are on me"
  sleep(2500)
}
}

// ------------------------------
// Character router
// ------------------------------
function playRandomCharacter(repete) {
  var response = Utility.getRandomUnique(1, 14);

 // Response depending on random number
  if (response == 1) {
    response_Dr_Smith = Utility.GetRandomUnique(1, 3)
    if (response_Dr_Smith == 1) {
      controlCommand("Dr_Smith", "Track_0") //Say Dr Smith"
      sleep(2000)
    } else if (response_Dr_Smith == 2) {
      controlCommand("Soundboard v4", "Track_96") //Say "Jonathan Harris"
      sleep(2000)
    }
    doDr_Smith()

  } else if (response == 2) {
    controlCommand("R2D2", "Track_0") //Say "R2D2"
    sleep(2000)
    doR2D2()

  } else if (response == 3) {
    response_Will = Utility.GetRandomUnique(1, 3)
    if (response_Will == 1) {
      controlCommand("Will", "Track_0") //Say "Will Robinson"
      sleep(2000)
    } else if (response_Will == 2) {
      controlCommand("Soundboard v4", "Track_95") //Say "Billy Mumy"
      sleep(2000)
    }
    doWill()

  } else if (response == 4) {
    response_Don = Utility.GetRandomUnique(1, 3)
    if (response_Don == 1) {
      controlCommand("Don", "Track_0") //Say "Major West"
      sleep(2000)
    } else if (response_Don == 2) {
      controlCommand("Soundboard v4", "Track_94") //Say "Mark Goddard"
      sleep(2000)
    }
    doDon()

  } else if (response == 5) {
    controlCommand("Maureen", "Track_0") //Say "June Lockhart"
    sleep(2000)
    doMaureen()

  } else if (response == 6) {
    controlCommand("John", "Track_0") //Say "Guy Williams"
    sleep(2000)
    doJohn()

  } else if (response == 7) {
    controlCommand("Tufeld", "Track_0") //Say "Richard Tufeld"
    sleep(2000)
    doTufeld()

  } else if (response == 8) {
    response_Judy = Utility.GetRandomUnique(1, 4)
    controlCommand("Judy", "Track_0")
    sleep(2000)
    if (response_Judy == 1) {
      controlCommand("Soundboard v4", "Track_93") //Say "I liked Judy"
      sleep(1700)
    } else if (response_Judy == 2) {
      controlCommand("Soundboard v4", "Track_97") //Say "Jusy Robinson is a babe"
      sleep(4750)
    } else if (response_Judy == 3) {
      controlCommand("Soundboard v4", "Track_98") //Say Jusy would socalize with me"
      sleep(9250)
    }
    doJudy()

  } else if (response == 9) {
    controlCommand("Wall_e", "Track_0") //Say "WallE"
    sleep(2000)
    doWall_e()

  } else if (response == 10) {
    response_Penny = Utility.GetRandomUnique(1, 3)
    if (response_Penny == 1) {
      controlCommand("Penny", "Track_0") //Say "Angela Cartwright"
      sleep(2000)
    } else if (response_Penny == 2) {
      controlCommand("Penny", "Track_1") //Say "Penny"
      sleep(2000)
    }
    doPenny()

  } else if (response == 11) {
    response_Hal9000 = Utility.GetRandomUnique(1, 3)
    if (response_Hal9000 == 1) {
      controlCommand("Hal9000", "Track_0") //Say "I am Hal9000"
      sleep(6000)
    } else if (response_Hal9000 == 2) {
      controlCommand("Hal9000", "Track_24") //Say "Good Morning Dave"
      sleep(3250)
    }
    doHal9000()

  } else if (response == 12) {
    response_Bender = Utility.GetRandomUnique(1, 3)
    if (response_Bender == 1) {
      controlCommand("Bender", "Track_0") //Say "I am Bender"
      sleep(3000)
    } else if (response_Bender == 2) {
      controlCommand("Bender", "Track_42") //Sing the "Bender Song"
      sleep(8000)
    }
    doBender()

  } else if (response == 13) {
    controlCommand("Robby", "Track_0") //Say "Robby the Robot"
    sleep(3000)
    doRobby()

  }
}
// ------------------------------
// End-of-character helper
// ------------------------------

function doEnd_Character(repete) {
  // Arm/head animation dependent on loop pass
  if (repete == 0) {
    controlCommand("Left Arm", "ScriptStart", "Left Claw Open");
    controlCommand("Right Arm", "ScriptStart", "Right Claw Open");
    controlCommand("Head Section", "ScriptStart", "Happy, Sad Bubble");
    controlCommand("Head Section", "ScriptStart", "Radar Fast Sweep");
  } else if (repete == 1) {
    controlCommand("Head Section", "ScriptStart", "Radar Fast Sweep");
    controlCommand("Left Arm", "ScriptStart", "Left Claw Closed");
    controlCommand("Right Arm", "ScriptStart", "Right Claw Closed");
  }

  // Speak an interstitial phrase between character bits
  var repete_2 = Utility.GetRandomUnique(1, 13)
  sleep(100)

  // Response depending on random number
  if (repete_2 == 1) {
    controlCommand("Soundboard v4", "Track_79") //Say "And"
    sleep(1500)
  } else if (repete_2 == 2) {
    controlCommand("Soundboard v4", "Track_78") //Say "My Friend"
    sleep(1750)
  } else if (repete_2 == 3) {
    controlCommand("Soundboard v4", "Track_77") //Say "Loading"
    sleep(2000)
  } else if (repete_2 == 4) {
    controlCommand("Soundboard v4", "Track_76") //Say "What else Do I do?"
    sleep(2500)
  } else if (repete_2 == 5) {
    controlCommand("Soundboard v4", "Track_75") //Say "Thank You"
    sleep(1500)
  } else if (repete_2 == 6) {
    controlCommand("Soundboard v4", "Track_74") //Say "Thank You" (alternet)
    sleep(1500)
  } else if (repete_2 == 7) {
    controlCommand("Soundboard v4", "Track_73") //Say "Priceless"
    sleep(2000)
  } else if (repete_2 == 8) {
    controlCommand("Soundboard v4", "Track_71") //Say "Marvelous"
    sleep(2000)
  } else if (repete_2 == 9) {
    controlCommand("Soundboard v4", "Track_35") //Say "I know"
    sleep(2000)
  } else if (repete_2 == 10) {
    controlCommand("Soundboard v4", "Track_70") //Say "Swell"
    sleep(2000)
  } else if (repete_2 == 11) {
    controlCommand("Soundboard v4", "Track_81") //Say "Wow"
    sleep(2000)
  } else if (repete_2 == 12) {
    controlCommand("Soundboard v4", "Track_8") //Say "Good Night, Sleep Well"
    sleep(2750)
  }
}

// ------------------------------
// Character functions (kept behavior, now take repete)
// ------------------------------
function doDr_Smith(repete) {
  var DRresponse = Utility.getRandomUnique(2, 51);
  sleep(100);

  if (DRresponse == 2) { controlCommand("Dr_Smith", "Play", "Evil purpose.mp3"); sleep(5000); }
  else if (DRresponse == 3) { controlCommand("Dr_Smith", "Play", "Fatal contamination.mp3"); sleep(9000); }
  else if (DRresponse == 4) { controlCommand("Dr_Smith", "Play", "Genius.mp3"); sleep(4000); }
  else if (DRresponse == 5) { controlCommand("Dr_Smith", "Play", "Greatful creatures.mp3"); sleep(4000); }
  else if (DRresponse == 6) { controlCommand("Dr_Smith", "Play", "Irk_me.mp3"); sleep(3000); }
  else if (DRresponse == 7) { controlCommand("Dr_Smith", "Play", "The_pain.mp3"); sleep(3500); }
  else if (DRresponse == 8) { controlCommand("Dr_Smith", "Play", "silence.mp3"); sleep(3000); }
  else if (DRresponse == 9) { controlCommand("Dr_Smith", "Play", "smith_is_here.mp3"); sleep(3000); }
  else if (DRresponse == 10) { controlCommand("Dr_Smith", "Play", "System is full proof.mp3"); sleep(8500); }
  else if (DRresponse == 11) { controlCommand("Dr_Smith", "Play", "wont_do_it.mp3"); sleep(6500); }
  else if (DRresponse == 12) { controlCommand("Dr_Smith", "Play", "Alpha_Control.mp3"); sleep(13000); }
  else if (DRresponse == 13) { controlCommand("Dr_Smith", "Play", "Aolia_14_umbra.mp3"); sleep(7000); }
  else if (DRresponse == 14) { controlCommand("Dr_Smith", "Play", "Bha.mp3"); sleep(2500); }
  else if (DRresponse == 15) { controlCommand("Dr_Smith", "Play", "Cold_man.mp3"); sleep(3250); }
  else if (DRresponse == 16) { controlCommand("Dr_Smith", "Play", "Delightful.mp3"); sleep(3500); }
  else if (DRresponse == 17) { controlCommand("Dr_Smith", "Play", "Glass_headded.mp3"); sleep(3000); }
  else if (DRresponse == 18) { controlCommand("Dr_Smith", "Play", "Indeed.mp3"); sleep(2000); }
  else if (DRresponse == 19) { controlCommand("Dr_Smith", "Play", "Motherload.mp3"); sleep(7500); }
  else if (DRresponse == 20) { controlCommand("Dr_Smith", "Play", "Much_to_be_disired.mp3"); sleep(5000); }
  else if (DRresponse == 21) { controlCommand("Dr_Smith", "Play", "Neanderthal_Ninny.mp3"); sleep(5000); }
  else if (DRresponse == 22) { controlCommand("Dr_Smith", "Play", "Non_Discript_Ninny.mp3"); sleep(3000); }
  else if (DRresponse == 23) { controlCommand("Dr_Smith", "Play", "Not_gold.mp3"); sleep(7000); }
  else if (DRresponse == 24) { controlCommand("Dr_Smith", "Play", "Pairapharse.mp3"); sleep(7500); }
  else if (DRresponse == 25) { controlCommand("Dr_Smith", "Play", "Resent_it.mp3"); sleep(4500); }
  else if (DRresponse == 26) { controlCommand("Dr_Smith", "Play", "Splender.mp3"); sleep(7000); }
  else if (DRresponse == 27) { controlCommand("Dr_Smith", "Play", "Starve.mp3"); sleep(4000); }
  else if (DRresponse == 28) { controlCommand("Dr_Smith", "Play", "Talents.mp3"); sleep(12500); }
  else if (DRresponse == 29) { controlCommand("Dr_Smith", "Play", "Underestamate.mp3"); sleep(4500); }
  else if (DRresponse == 30) { controlCommand("Dr_Smith", "Play", "Working_robot.mp3"); sleep(7500); }
  else if (DRresponse == 31) { controlCommand("Dr_Smith", "Play", "Fine_Howdy.mp3"); sleep(2500); }
  else if (DRresponse == 32) { controlCommand("Dr_Smith", "Play", "Control_something.mp3"); sleep(5500); }
  else if (DRresponse == 33) { controlCommand("Dr_Smith", "Play", "Robot_puppit.mp3"); sleep(7000); }
  else if (DRresponse == 34) { controlCommand("Dr_Smith", "Play", "Spare_parts.mp3"); sleep(7000); }
  else if (DRresponse == 35) { controlCommand("Dr_Smith", "Play", "Utmost.mp3"); sleep(4000); }
  else if (DRresponse == 36) { controlCommand("Dr_Smith", "Play", "Bha(2).mp3"); sleep(2000); }
  else if (DRresponse == 37) { controlCommand("Dr_Smith", "Play", "Bird_brain.mp3"); sleep(4500); }
  else if (DRresponse == 38) { controlCommand("Dr_Smith", "Play", "Earth_so_Close.mp3"); sleep(5000); }
  else if (DRresponse == 39) { controlCommand("Dr_Smith", "Play", "Errors.mp3"); sleep(7000); }
  else if (DRresponse == 40) { controlCommand("Dr_Smith", "Play", "Junk_pile.mp3"); sleep(6000); }
  else if (DRresponse == 41) { controlCommand("Dr_Smith", "Play", "Not_go.mp3"); sleep(7000); }
  else if (DRresponse == 42) { controlCommand("Dr_Smith", "Play", "Proved_wrong.mp3"); sleep(6500); }
  else if (DRresponse == 43) { controlCommand("Dr_Smith", "Play", "Bad Back.mp3"); sleep(5500); }
  else if (DRresponse == 44) { controlCommand("Dr_Smith", "Play", "Better then that ninny.mp3"); sleep(3000); }
  else if (DRresponse == 45) { controlCommand("Dr_Smith", "Play", "Heaven and Earth.mp3"); sleep(15500); }
  else if (DRresponse == 46) { controlCommand("Dr_Smith", "Play", "Pinball.mp3"); sleep(8500); }
  else if (DRresponse == 47) { controlCommand("Dr_Smith", "Play", "Return to J2.mp3"); sleep(6000); }
  else if (DRresponse == 48) { controlCommand("Dr_Smith", "Play", "Scream.mp3"); sleep(2000); }
  else if (DRresponse == 49) { controlCommand("Dr_Smith", "Play", "Scream2.mp3"); sleep(4000); }
  else if (DRresponse == 50) { controlCommand("Dr_Smith", "Play", "Scream4.mp3"); sleep(3000); }

  doEnd_Character(repete);
}

function doR2D2(repete) { var x = Utility.getRandomUnique(2, 11); sleep(100);
  if (x == 2) { controlCommand("R2D2", "Play", "Proud R2D2.mp3"); sleep(3000); }
  else if (x == 3) { controlCommand("R2D2", "Play", "r2d2-scream.mp3"); sleep(5500); }
  else if (x == 4) { controlCommand("R2D2", "Play", "Playfull R2D2.mp3"); sleep(2500); }
  else if (x == 5) { controlCommand("R2D2", "Play", "Processing R2D2.mp3"); sleep(3000); }
  else if (x == 6) { controlCommand("R2D2", "Play", "r2d2-squeaks1.mp3"); sleep(3000); }
  else if (x == 7) { controlCommand("R2D2", "Play", "r2d2-squeaks5.mp3"); sleep(3000); }
  else if (x == 8) { controlCommand("R2D2", "Play", "Sad R2D2.mp3"); sleep(2000); }
  else if (x == 9) { controlCommand("R2D2", "Play", "Unbelievable R2D2.mp3"); sleep(2500); }
  else if (x == 10) { controlCommand("R2D2", "Play", "r2d2-whistle1.mp3"); sleep(3000); }
  doEnd_Character(repete);
}

function doWill(repete) { var x = Utility.getRandomUnique(1, 19); sleep(100);
  if (x == 1) { controlCommand("Will", "Play", "Will_identify.mp3"); sleep(3500); }
  else if (x == 2) { controlCommand("Will", "Play", "All_Right.mp3"); sleep(3500); }
  else if (x == 3) { controlCommand("Will", "Play", "But_dad.mp3"); sleep(1500); }
  else if (x == 4) { controlCommand("Will", "Play", "Dad_not_let_go.mp3"); sleep(3000); }
  else if (x == 5) { controlCommand("Will", "Play", "Dont_get_married.mp3"); sleep(23500); }
  else if (x == 6) { controlCommand("Will", "Play", "Hes_a_robot.mp3"); sleep(4000); }
  else if (x == 7) { controlCommand("Will", "Play", "Multi_demention.mp3"); sleep(4000); }
  else if (x == 8) { controlCommand("Will", "Play", "Murder.mp3"); sleep(6000); }
  else if (x == 9) { controlCommand("Will", "Play", "Robot_obey.mp3"); sleep(8000); }
  else if (x == 10) { controlCommand("Will", "Play", "Robot_part_of_comunity.mp3"); sleep(4000); }
  else if (x == 11) { controlCommand("Will", "Play", "Sunday_Chapel.mp3"); sleep(6000); }
  else if (x == 12) { controlCommand("Will", "Play", "Watch_me.mp3"); sleep(2500); }
  else if (x == 13) { controlCommand("Will", "Play", "Wheres_Smith.mp3"); sleep(2500); }
  else if (x == 14) { controlCommand("Will", "Play", "Are you sure.mp3"); sleep(3000); }
  else if (x == 15) { controlCommand("Will", "Play", "Change_mind.mp3"); sleep(3500); }
  else if (x == 16) { controlCommand("Will", "Play", "Explosive gas.mp3"); sleep(8000); }
  else if (x == 17) { controlCommand("Will", "Play", "Im_will.mp3"); sleep(2000); }
  else if (x == 18) { controlCommand("Will", "Play", "Superstition.mp3"); sleep(6000); }
  doEnd_Character(repete);
}

function doDon(repete) { 
  // Pick a unique random Don track from 3..30
  var donResponse = Utility.getRandomUnique(3, 31);
  sleep(100);

  if (donResponse == 2) {
    controlCommand("Don", "Play", "MarkGoddard.wav");
    sleep(3000);
  } else if (donResponse == 3) {
    controlCommand("Don", "Play", "Dig_Deeper.mp3");
    sleep(3500);
  } else if (donResponse == 4) {
    controlCommand("Don", "Play", "Wonder_what_guidance.mp3");
    sleep(3500);
  } else if (donResponse == 5) {
    controlCommand("Don", "Play", "Abort_30B_mission.mp3");
    sleep(6000);
  } else if (donResponse == 6) {
    controlCommand("Don", "Play", "Atmosphere.mp3");
    sleep(4000);
  } else if (donResponse == 7) {
    controlCommand("Don", "Play", "Extra_weight.mp3");
    sleep(7200);
  } else if (donResponse == 8) {
    controlCommand("Don", "Play", "Flip_Lid.mp3");
    sleep(4800);
  } else if (donResponse == 9) {
    controlCommand("Don", "Play", "Get_away.mp3");
    sleep(4000);
  } else if (donResponse == 10) {
    controlCommand("Don", "Play", "Hogwash.mp3");
    sleep(3500);
  } else if (donResponse == 11) {
    controlCommand("Don", "Play", "Keep_Going.mp3");
    sleep(3500);
  } else if (donResponse == 12) {
    controlCommand("Don", "Play", "Know_your_in_trouble.mp3");
    sleep(4500);
  } else if (donResponse == 13) {
    controlCommand("Don", "Play", "Let_you_off.mp3");
    sleep(6000);
  } else if (donResponse == 14) {
    controlCommand("Don", "Play", "Meal_in_space.mp3");
    sleep(6000);
  } else if (donResponse == 15) {
    controlCommand("Don", "Play", "Meteors_clobbered.mp3");
    sleep(6000);
  } else if (donResponse == 16) {
    controlCommand("Don", "Play", "Nice_try_smith.mp3");
    sleep(6500);
  } else if (donResponse == 17) {
    controlCommand("Don", "Play", "Pay_attention.mp3");
    sleep(3700);
  } else if (donResponse == 18) {
    controlCommand("Don", "Play", "Robot_conditions.mp3");
    sleep(3500);
  } else if (donResponse == 19) {
    controlCommand("Don", "Play", "School_bus_driver.mp3");
    sleep(4800);
  } else if (donResponse == 20) {
    controlCommand("Don", "Play", "Slippery_eels.mp3");
    sleep(4800);
  } else if (donResponse == 21) {
    controlCommand("Don", "Play", "Smith_layer.mp3");
    sleep(10500);
  } else if (donResponse == 22) {
    controlCommand("Don", "Play", "Sure_John.mp3");
    sleep(5500);
  } else if (donResponse == 23) {
    controlCommand("Don", "Play", "Thank_the_robot.mp3");
    sleep(3000);
  } else if (donResponse == 24) {
    controlCommand("Don", "Play", "Tin_monster.mp3");
    sleep(6750);
  } else if (donResponse == 25) {
    controlCommand("Don", "Play", "Your_funeral.mp3");
    sleep(2500);
  } else if (donResponse == 26) {
    controlCommand("Don", "Play", "Hanky panky.mp3");
    sleep(11000);
  } else if (donResponse == 27) {
    controlCommand("Don", "Play", "Less work for Smith.mp3");
    sleep(3500);
  } else if (donResponse == 28) {
    controlCommand("Don", "Play", "Look at this.mp3");
    sleep(3000);
  } else if (donResponse == 29) {
    controlCommand("Don", "Play", "Primitave force.mp3");
    sleep(5000);
  } else if (donResponse == 30) {
    controlCommand("Don", "Play", "Swimming in bog.mp3");
    sleep(10000);
  }
  doEnd_Character(repete); }
  
function doMaureen(repete) {
// Random phrase from 1 to 18
var JLresponse = Utility.getRandomUnique(1, 19);
  sleep(100);

  if (JLresponse == 1) {
    controlCommand("Maureen", "Play", "All_Rest.mp3");
    sleep(5000);
  } else if (JLresponse == 2) {
    controlCommand("Maureen", "Play", "Bully_us.mp3");
    sleep(7000);
  } else if (JLresponse == 3) {
    controlCommand("Maureen", "Play", "Cold_storage.mp3");
    sleep(9500);
  } else if (JLresponse == 4) {
    controlCommand("Maureen", "Play", "Come_back.mp3");
    sleep(3000);
  } else if (JLresponse == 5) {
    controlCommand("Maureen", "Play", "Dear_madum.mp3");
    sleep(4500);
  } else if (JLresponse == 6) {
    controlCommand("Maureen", "Play", "Fighting_for_lives.mp3");
    sleep(9500);
  } else if (JLresponse == 7) {
    controlCommand("Maureen", "Play", "Johns_eyes.mp3");
    sleep(5000);
  } else if (JLresponse == 8) {
    controlCommand("Maureen", "Play", "Reanamate.mp3");
    sleep(9500);
  } else if (JLresponse == 9) {
    controlCommand("Maureen", "Play", "Not_from_our_planet.mp3");
    sleep(6500);
  } else if (JLresponse == 10) {
    controlCommand("Maureen", "Play", "Rude.mp3");
    sleep(2500);
  } else if (JLresponse == 11) {
    controlCommand("Maureen", "Play", "Safeguard.mp3");
    sleep(13000);
  } else if (JLresponse == 12) {
    controlCommand("Maureen", "Play", "Not_bees.mp3");
    sleep(10500);
  } else if (JLresponse == 13) {
    controlCommand("Maureen", "Play", "Smith_explaned.mp3");
    sleep(4000);
  } else if (JLresponse == 14) {
    controlCommand("Maureen", "Play", "Frighten her.mp3");
    sleep(4500);
  } else if (JLresponse == 15) {
    controlCommand("Maureen", "Play", "How could you.mp3");
    sleep(5750);
  } else if (JLresponse == 16) {
    controlCommand("Maureen", "Play", "In attic.mp3");
    sleep(15000);
  } else if (JLresponse == 17) {
    controlCommand("Maureen", "Play", "mysterious.mp3");
    sleep(3000);
  } else if (JLresponse == 18) {
    controlCommand("Maureen", "Play", "Ridiculous.mp3");
    sleep(4500);
  }
 doEnd_Character(repete); }
 
 
function doJohn(repete) {
 // Random phrase from 1 to 26
  var JRresponse = Utility.getRandomUnique(1, 27);
  sleep(100);

  if (JRresponse == 1) {
    controlCommand("John", "Play", "Amen.mp3");
    sleep(6000);
  } else if (JRresponse == 2) {
    controlCommand("John", "Play", "Appointed_rounds.mp3");
    sleep(6500);
  } else if (JRresponse == 3) {
    controlCommand("John", "Play", "Busy_day.mp3");
    sleep(3500);
  } else if (JRresponse == 4) {
    controlCommand("John", "Play", "Can_you_hear_me.mp3");
    sleep(4500);
  } else if (JRresponse == 5) {
    controlCommand("John", "Play", "Cosmic_dust.mp3");
    sleep(10000);
  } else if (JRresponse == 6) {
    controlCommand("John", "Play", "Decision.mp3");
    sleep(7000);
  } else if (JRresponse == 7) {
    controlCommand("John", "Play", "Fix_the_charriot.mp3");
    sleep(4500);
  } else if (JRresponse == 8) {
    controlCommand("John", "Play", "Knew_what_we_were_getting_into.mp3");
    sleep(4000);
  } else if (JRresponse == 9) {
    controlCommand("John", "Play", "Magic_tricks.mp3");
    sleep(4000);
  } else if (JRresponse == 10) {
    controlCommand("John", "Play", "No_one_leaves_ship.mp3");
    sleep(4000);
  } else if (JRresponse == 11) {
    controlCommand("John", "Play", "Off_course.mp3");
    sleep(6000);
  } else if (JRresponse == 12) {
    controlCommand("John", "Play", "On_our_way.mp3");
    sleep(11000);
  } else if (JRresponse == 13) {
    controlCommand("John", "Play", "Robot_equipment.mp3");
    sleep(3000);
  } else if (JRresponse == 14) {
    controlCommand("John", "Play", "Safe_in_ship.mp3");
    sleep(3000);
  } else if (JRresponse == 15) {
    controlCommand("John", "Play", "Save_lives.mp3");
    sleep(4000);
  } else if (JRresponse == 16) {
    controlCommand("John", "Play", "Stand_much_more.mp3");
    sleep(7000);
  } else if (JRresponse == 17) {
    controlCommand("John", "Play", "Survival.mp3");
    sleep(8000);
  } else if (JRresponse == 18) {
    controlCommand("John", "Play", "Tamper_with_robot.mp3");
    sleep(5000);
  } else if (JRresponse == 19) {
    controlCommand("John", "Play", "Tests.mp3");
    sleep(5000);
  } else if (JRresponse == 20) {
    controlCommand("John", "Play", "Treated_as_Stowaway.mp3");
    sleep(15000);
  } else if (JRresponse == 21) {
    controlCommand("John", "Play", "Unload_Charriot.mp3");
    sleep(4000);
  } else if (JRresponse == 22) {
    controlCommand("John", "Play", "Where_are_we.mp3");
    sleep(6000);
  } else if (JRresponse == 23) {
    controlCommand("John", "Play", "Will_in_charge.mp3");
    sleep(5000);
  } else if (JRresponse == 24) {
    controlCommand("John", "Play", "Go right ahead.mp3");
    sleep(10000);
  } else if (JRresponse == 25) {
    controlCommand("John", "Play", "What did the robot say.mp3");
    sleep(4250);
  } else if (JRresponse == 26) {
    controlCommand("John", "Play", "What really happened.mp3");
    sleep(4500);
  }
   doEnd_Character(repete); 
   }

function doTufeld(repete) {  
// Random phrase from 1 to 18
  var Tufeld = Utility.getRandomUnique(1, 19);
  sleep(100);

  if (Tufeld == 1) {
    controlCommand("Tufeld", "Play", "Beginning.mp3");
    sleep(13000);
  } else if (Tufeld == 2) {
    controlCommand("Tufeld", "Play", "Derelict_epilog.mp3");
    sleep(34500);
  } else if (Tufeld == 3) {
    controlCommand("Tufeld", "Play", "Derelict_intro.mp3");
    sleep(27600);
  } else if (Tufeld == 4) {
    controlCommand("Tufeld", "Play", "Giants_intro.mp3");
    sleep(15000);
  } else if (Tufeld == 5) {
    controlCommand("Tufeld", "Play", "Island_Sky_intro.mp3");
    sleep(34500);
  } else if (Tufeld == 6) {
    controlCommand("Tufeld", "Play", "Wild_journy_intro.mp3");
    sleep(15500);
  } else if (Tufeld == 7) {
    controlCommand("Tufeld", "Play", "Another Era.mp3");
    sleep(16000);
  } else if (Tufeld == 8) {
    controlCommand("Tufeld", "Play", "Atomic fuel.mp3");
    sleep(18500);
  } else if (Tufeld == 9) {
    controlCommand("Tufeld", "Play", "Condemned.mp3");
    sleep(28000);
  } else if (Tufeld == 10) {
    controlCommand("Tufeld", "Play", "Distroy Robot.mp3");
    sleep(11500);
  } else if (Tufeld == 11) {
    controlCommand("Tufeld", "Play", "Forgotten Planet.mp3");
    sleep(17500);
  } else if (Tufeld == 12) {
    controlCommand("Tufeld", "Play", "ghostly Swamp.mp3");
    sleep(21500);
  } else if (Tufeld == 13) {
    controlCommand("Tufeld", "Play", "Robby Monster.mp3");
    sleep(17500);
  } else if (Tufeld == 14) {
    controlCommand("Tufeld", "Play", "Silence.mp3");
    sleep(10500);
  } else if (Tufeld == 15) {
    controlCommand("Tufeld", "Play", "Slipped away.mp3");
    sleep(18000);
  } else if (Tufeld == 16) {
    controlCommand("Tufeld", "Play", "Steal Spaceship.mp3");
    sleep(24000);
  } else if (Tufeld == 17) {
    controlCommand("Tufeld", "Play", "Watching every move.mp3");
    sleep(16750);
  } else if (Tufeld == 18) {
    controlCommand("Tufeld", "Play", "Weird eyes.mp3");
    sleep(12000);
  }
   doEnd_Character(repete); 
   }

function doJudy(repete) {
 // Random from 1..13
  var judy = Utility.getRandomUnique(1, 14);
  sleep(100);

  if (judy == 1) {
    controlCommand("Judy", "Play", "Don.mp3");
    sleep(1500);
  } else if (judy == 2) {
    controlCommand("Judy", "Play", "Earthquake.mp3");
    sleep(7750);
  } else if (judy == 3) {
    controlCommand("Judy", "Play", "Garden.mp3");
    sleep(3750);
  } else if (judy == 4) {
    controlCommand("Judy", "Play", "Im_not_tired.mp3");
    sleep(2000);
  } else if (judy == 5) {
    controlCommand("Judy", "Play", "Not_like_School.mp3");
    sleep(16000);
  } else if (judy == 6) {
    controlCommand("Judy", "Play", "Remoat_Planet.mp3");
    sleep(6750);
  } else if (judy == 7) {
    controlCommand("Judy", "Play", "No_answers.mp3");
    sleep(6750);
  } else if (judy == 8) {
    controlCommand("Judy", "Play", "As Long as I live.mp3");
    sleep(6250);
  } else if (judy == 9) {
    controlCommand("Judy", "Play", "Feelings.mp3");
    sleep(4750);
  } else if (judy == 10) {
    controlCommand("Judy", "Play", "Flat on Floor.mp3");
    sleep(6500);
  } else if (judy == 11) {
    controlCommand("Judy", "Play", "Not my Style.mp3");
    sleep(9000);
  } else if (judy == 12) {
    controlCommand("Judy", "Play", "Silly contest.mp3");
    sleep(6500);
  } else if (judy == 13) {
    controlCommand("Judy", "Play", "Robot short circuit.mp3");
    sleep(4500);
  }  doEnd_Character(repete); 
  }

function doWall_e(repete) { 
  // Random from 1..8
  var wall_e = Utility.getRandomUnique(1, 9);
  sleep(100);

  if (wall_e == 1) {
    controlCommand("Wall_e", "Play", "say-kiss.wav");
    sleep(1500);
  } else if (wall_e == 2) {
    controlCommand("Wall_e", "Play", "say-sigh.wav");
    sleep(2500);
  } else if (wall_e == 3) {
    controlCommand("Wall_e", "Play", "say-tada.wav");
    sleep(2500);
  } else if (wall_e == 4) {
    controlCommand("Wall_e", "Play", "say-whistle.wav");
    sleep(2500);
  } else if (wall_e == 5) {
    controlCommand("Wall_e", "Play", "say-whoa-interest.wav");
    sleep(2000);
  } else if (wall_e == 6) {
    controlCommand("Wall_e", "Play", "e-brrr.mp3");
    sleep(2500);
  } else if (wall_e == 7) {
    controlCommand("Wall_e", "Play", "e-caution.mp3");
    sleep(3000);
  } else if (wall_e == 8) {
    controlCommand("Wall_e", "Play", "walle_eve_name_eva.mp3");
    sleep(17750);
  }
   doEnd_Character(repete); 
   }

function doPenny(repete) { 
// Random from 2..14
  var penny = Utility.getRandomUnique(2, 15);
  sleep(100);

  if (penny == 2) {
    controlCommand("Penny", "Play", "Penny.mp3");
    sleep(5000);
  } else if (penny == 3) {
    controlCommand("Penny", "Play", "Eat_it_Debbie.mp3");
    sleep(4000);
  } else if (penny == 4) {
    controlCommand("Penny", "Play", "I-saw_him.mp3");
    sleep(5000);
  } else if (penny == 5) {
    controlCommand("Penny", "Play", "Model.mp3");
    sleep(4500);
  } else if (penny == 6) {
    controlCommand("Penny", "Play", "Oh-Debie.mp3");
    sleep(3000);
  } else if (penny == 7) {
    controlCommand("Penny", "Play", "Test.mp3");
    sleep(3000);
  } else if (penny == 8) {
    controlCommand("Penny", "Play", "What_makes_you_think.mp3");
    sleep(4000);
  } else if (penny == 9) {
    controlCommand("Penny", "Play", "Not a Baby.mp3");
    sleep(5500);
  } else if (penny == 10) {
    controlCommand("Penny", "Play", "Ouija Board.mp3");
    sleep(3500);
  } else if (penny == 11) {
    controlCommand("Penny", "Play", "Chess_this_evening.mp3");
    sleep(4000);
  } else if (penny == 12) {
    controlCommand("Penny", "Play", "Spoken to him.mp3");
    sleep(3500);
  } else if (penny == 13) {
    controlCommand("Penny", "Play", "Tight in wrong places.mp3");
    sleep(7250);
  } else if (penny == 14) {
    controlCommand("Penny", "Play", "What happened.mp3");
    sleep(3500);
  }
   doEnd_Character(repete); 
   }

function doHal9000(repete) {
  // Speak a random character phrase from 1 to 24
  Hal = Utility.GetRandomUnique(1, 25)
  sleep(100)

  // Response depending on random number
  if (Hal == 1) {
controlCommand("Hal9000", "Play", "cantdo.mp3");
    sleep(4000)
  } else if (Hal == 2) {
controlCommand("Hal9000", "Play", "chess.mp3");
    sleep(2500)
controlCommand("Phrases", "Play", "DidSomeoneSayChess-UsedToPlayLittle.mp3");
    sleep(4250)
  } else if (Hal == 3) {
controlCommand("Hal9000", "Play", "completed.mp3");
    sleep(2000)
  } else if (Hal == 4) {
controlCommand("Hal9000", "Play", "daisy.mp3");
    sleep(12250)
  } else if (Hal == 5) {
controlCommand("Hal9000", "Play", "dangerous_to_remain.mp3");
    sleep(3000)
  } else if (Hal == 6) {
controlCommand("Hal9000", "Play", "disconnect_me.mp3");
    sleep(7000)
  } else if (Hal == 7) {
controlCommand("Hal9000", "Play", "enough_info.mp3");
    sleep(3500)
  } else if (Hal == 8) {
controlCommand("Hal9000", "Play", "feel_much_better.mp3");
    sleep(7000)
  } else if (Hal == 9) {
controlCommand("Hal9000", "Play", "functional.mp3");
    sleep(2250)
  } else if (Hal == 10) {
controlCommand("Hal9000", "Play", "good_evening.mp3");
    sleep(3500)
  } else if (Hal == 11) {
controlCommand("Hal9000", "Play", "human_error.mp3");
    sleep(7500)
  } else if (Hal == 12) {
controlCommand("Hal9000", "Play", "ignition.mp3");
    sleep(2500)
  } else if (Hal == 13) {
controlCommand("Hal9000", "Play", "just_a_moment.mp3");
    sleep(6500)
  } else if (Hal == 14) {
controlCommand("Hal9000", "Play", "just_what.mp3");
    sleep(3750)
  } else if (Hal == 15) {
controlCommand("Hal9000", "Play", "mind_is_going.mp3");
    sleep(6000)
  } else if (Hal == 16) {
controlCommand("Hal9000", "Play", "mission.mp3");
    sleep(5000)
  } else if (Hal == 17) {
controlCommand("Hal9000", "Play", "operational.mp3");
    sleep(5000)
  } else if (Hal == 18) {
controlCommand("Hal9000", "Play", "quite_like_this.mp3");
    sleep(5750)
  } else if (Hal == 19) {
controlCommand("Hal9000", "Play", "sorry_dave.mp3");
    sleep(7500)
  } else if (Hal == 20) {
controlCommand("Hal9000", "Play", "stop2.mp3");
    sleep(11000)
  } else if (Hal == 21) {
controlCommand("Hal9000", "Play", "stress_pill.mp3");
    sleep(8500)
  } else if (Hal == 22) {
controlCommand("Hal9000", "Play", "upset.mp3");
    sleep(3250)
  } else if (Hal == 23) {
controlCommand("Hal9000", "Play", "well.mp3");
    sleep(2250)
  } else if (Hal == 24) {
controlCommand("Hal9000", "Play", "2_good_morning_dave.mp3");
    sleep(3000)
  }
   doEnd_Character(repete); 
   }

function doBender(repete) { 
  // Speak a random character phrase from 1 to 41
  Bender = Utility.GetRandomUnique(1, 42)
  sleep(100)

  // Response depending on random number
  if (Bender == 1) {
controlCommand("Bender", "Play", "Are you kidding.mp3");
    sleep(2000)
  } else if (Bender == 2) {
controlCommand("Bender", "Play", "Bite my Ass (2).mp3");
    sleep(3500)
  } else if (Bender == 3) {
controlCommand("Bender", "Play", "Bite my Ass.mp3");
    sleep(3000)
  } else if (Bender == 4) {
controlCommand("Bender", "Play", "Bodies are for hookers.mp3");
    sleep(4000)
  } else if (Bender == 5) {
controlCommand("Bender", "Play", "bringItOnBaby.mp3");
    sleep(1750)
  } else if (Bender == 6) {
controlCommand("Bender", "Play", "Cant you see Im using the toilet.mp3");
    sleep(3000)
  } else if (Bender == 7) {
controlCommand("Bender", "Play", "checkMyProgram.mp3");
    sleep(2000)
  } else if (Bender == 8) {
controlCommand("Bender", "Play", "Dont make me kick your neck.mp3");
    sleep(3000)
  } else if (Bender == 9) {
controlCommand("Bender", "Play", "Dream on skintube.mp3");
    sleep(3000)
  } else if (Bender == 10) {
controlCommand("Bender", "Play", "Ever been beaten up by a guy.mp3");
    sleep(3500)
  } else if (Bender == 11) {
controlCommand("Bender", "Play", "Hello peasants.mp3");
    sleep(3000)
  } else if (Bender == 12) {
controlCommand("Bender", "Play", "Hitting your kids.mp3");
    sleep(7750)
  } else if (Bender == 13) {
controlCommand("Bender", "Play", "I have all the money.mp3");
    sleep(2500)
  } else if (Bender == 14) {
controlCommand("Bender", "Play", "in your face.mp3");
    sleep(2000)
  } else if (Bender == 15) {
controlCommand("Bender", "Play", "Ive had it up to here.mp3");
    sleep(3750)
  } else if (Bender == 16) {
controlCommand("Bender", "Play", "Lets go get drunk.mp3");
    sleep(2000)
  } else if (Bender == 17) {
controlCommand("Bender", "Play", "Listen buddy Im in a hurry.mp3");
    sleep(2500)
  } else if (Bender == 18) {
controlCommand("Bender", "Play", "looks like your neck.mp3");
    sleep(3250)
  } else if (Bender == 19) {
controlCommand("Bender", "Play", "Luner Lander.mp3");
    sleep(13000)
  } else if (Bender == 20) {
controlCommand("Bender", "Play", "makeThisQuick.mp3");
    sleep(3250)
  } else if (Bender == 21) {
controlCommand("Bender", "Play", "My name is Coilette.mp3");
    sleep(2500)
  } else if (Bender == 22) {
controlCommand("Bender", "Play", "Nothing a lawsuit wont cure.mp3");
    sleep(3250)
  } else if (Bender == 23) {
controlCommand("Bender", "Play", "OMG.mp3");
    sleep(2000)
  } else if (Bender == 24) {
controlCommand("Bender", "Play", "Pleasure to meet you.mp3");
    sleep(2000)
  } else if (Bender == 25) {
controlCommand("Bender", "Play", "programEvil.mp3");
    sleep(2500)
  } else if (Bender == 26) {
controlCommand("Bender", "Play", "radical.mp3");
    sleep(4500)
  } else if (Bender == 27) {
controlCommand("Bender", "Play", "Right now I feel sorry for you.mp3");
    sleep(3000)
  } else if (Bender == 28) {
controlCommand("Bender", "Play", "showsOver.mp3");
    sleep(4500)
  } else if (Bender == 29) {
controlCommand("Bender", "Play", "So beautiful.mp3");
    sleep(2500)
  } else if (Bender == 30) {
controlCommand("Bender", "Play", "So long coffin stuffers.mp3");
    sleep(2500)
  } else if (Bender == 31) {
controlCommand("Bender", "Play", "Sroned in gutter.mp3");
    sleep(7500)
  } else if (Bender == 32) {
controlCommand("Bender", "Play", "Thank you.mp3");
    sleep(2500)
  } else if (Bender == 33) {
controlCommand("Bender", "Play", "Dirty double crossing *sugar plum*.mp3");
    sleep(3500)
  } else if (Bender == 34) {
controlCommand("Bender", "Play", "These will teach those.mp3");
    sleep(4000)
  } else if (Bender == 35) {
controlCommand("Bender", "Play", "This place has class.mp3");
    sleep(3000)
  } else if (Bender == 36) {
controlCommand("Bender", "Play", "Wanna kill all humans.mp3");
    sleep(3500)
  } else if (Bender == 37) {
controlCommand("Bender", "Play", "What am I gonna do.mp3");
    sleep(3500)
  } else if (Bender == 38) {
controlCommand("Bender", "Play", "Whoooh hew.mp3");
    sleep(2500)
  } else if (Bender == 39) {
controlCommand("Bender", "Play", "Would you kindly shut your...mp3");
    sleep(3500)
  } else if (Bender == 40) {
controlCommand("Bender", "Play", "You got it genius.mp3");
    sleep(3500)
  } else if (Bender == 41) {
controlCommand("Bender", "Play", "You gotta help me.mp3");
    sleep(4000)
  }
   doEnd_Character(repete); 
   }

function doRobby(repete) { 
  // Speak a random character phrase from 1 to 35
  Robby = Utility.GetRandomUnique(1, 36)
  sleep(100)

  // Response depending on random number
  if (Robby == 1) {
controlCommand("Robby", "Play", "60 gallons.mp3");
    sleep(8000)
  } else if (Robby == 2) {
controlCommand("Robby", "Play", "admit no one.mp3");
    sleep(14250)
  } else if (Robby == 3) {
controlCommand("Robby", "Play", "Altair 4.mp3");
    sleep(3500)
  } else if (Robby == 4) {
controlCommand("Robby", "Play", "Anyone need help.mp3");
    sleep(14000)
  } else if (Robby == 5) {
controlCommand("Robby", "Play", "Approching from SW.mp3");
    sleep(10500)
  } else if (Robby == 6) {
controlCommand("Robby", "Play", "Beemer.mp3");
    sleep(5000)
  } else if (Robby == 7) {
controlCommand("Robby", "Play", "Blaster.mp3");
    sleep(4250)
  } else if (Robby == 8) {
controlCommand("Robby", "Play", "Coffie is ready.mp3");
    sleep(2500)
  } else if (Robby == 9) {
controlCommand("Robby", "Play", "Come for you.mp3");
    sleep(16250)
  } else if (Robby == 10) {
controlCommand("Robby", "Play", "Dialects and Subtongues.mp3");
    sleep(9500)
  } else if (Robby == 11) {
controlCommand("Robby", "Play", "Dimonds.mp3");
    sleep(7250)
  } else if (Robby == 12) {
controlCommand("Robby", "Play", "Distroied Me.mp3");
    sleep(4500)
  } else if (Robby == 13) {
controlCommand("Robby", "Play", "Engen plans.mp3");
    sleep(10000)
  } else if (Robby == 14) {
controlCommand("Robby", "Play", "Function again.mp3");
    sleep(11500)
  } else if (Robby == 15) {
controlCommand("Robby", "Play", "Harmless.mp3");
    sleep(8250)
  } else if (Robby == 16) {
controlCommand("Robby", "Play", "Help You.mp3");
    sleep(5250)
  } else if (Robby == 17) {
controlCommand("Robby", "Play", "Hostial act.mp3");
    sleep(11500)
  } else if (Robby == 18) {
controlCommand("Robby", "Play", "I am analyzing.mp3");
    sleep(3250)
  } else if (Robby == 19) {
controlCommand("Robby", "Play", "I'm in command.mp3");
    sleep(12500)
  } else if (Robby == 20) {
controlCommand("Robby", "Play", "In study.mp3");
    sleep(6250)
  } else if (Robby == 21) {
controlCommand("Robby", "Play", "No Assitance.mp3");
    sleep(8000)
  } else if (Robby == 22) {
controlCommand("Robby", "Play", "Nothing coming.mp3");
    sleep(4000)
  } else if (Robby == 23) {
controlCommand("Robby", "Play", "Obay.mp3");
    sleep(4000)
  } else if (Robby == 24) {
controlCommand("Robby", "Play", "Oil Job.mp3");
    sleep(8000)
  } else if (Robby == 25) {
controlCommand("Robby", "Play", "Parlay.mp3");
    sleep(137000)
  } else if (Robby == 26) {
controlCommand("Robby", "Play", "Respond to Robby.mp3");
    sleep(8000)
  } else if (Robby == 27) {
controlCommand("Robby", "Play", "Seatbelts.mp3");
    sleep(4000)
  } else if (Robby == 28) {
controlCommand("Robby", "Play", "Servent.mp3");
    sleep(6500)
  } else if (Robby == 29) {
controlCommand("Robby", "Play", "Service Sir.mp3");
    sleep(2500)
  } else if (Robby == 30) {
controlCommand("Robby", "Play", "Sleep Well.mp3");
    sleep(2500)
  } else if (Robby == 31) {
controlCommand("Robby", "Play", "Slept well.mp3");
    sleep(6000)
  } else if (Robby == 32) {
controlCommand("Robby", "Play", "Ten Tons.mp3");
    sleep(13750)
  } else if (Robby == 33) {
controlCommand("Robby", "Play", "That is correct.mp3");
    sleep(2250)
  } else if (Robby == 34) {
controlCommand("Robby", "Play", "Welcome.mp3");
    sleep(17750)
  } else if (Robby == 35) {
controlCommand("Robby", "Play", "You're Expected.mp3");
    sleep(4000)
  }
 doEnd_Character(repete); 
 }
 
function doThadious(repete) { controlCommand("SFX", "Track_1"); sleep(14000); doEnd_Character(repete); }


Related Hardware (view all EZB hardware)
EZ-B V4 by EZ-Robot
EZ-B v4 with Synthiam ARCx controls servos, sensors, camera and audio over Wi-Fi or USB serial, no firmware needed.
Wi-Fi / USB
Servos 24
Camera
Audio
UART 3
I2C
ADC 8
Digital 24

ARC Pro

Upgrade to ARC Pro

With ARC Pro, your robot is not just a machine; it's your creative partner in the journey of technological exploration.