!7 module TurnOnWebCamRandomly > DynPrintLogAndEnabled { start { doLater(random(5.0, 20.0), r startCam); } void startAgain { doLater(random(180.0), r startCam); } void startCam enter { // TODO: choose favorite web cam if (enabled) pcall { printWithTime("Starting web cam"); dm_startWebCam(); BufferedImage img = dm_waitForWebCamImage(10.0); if (img != null) { printWithTime("[showing image]"); S text = dm_kevin("You look so stupid dude"); showAnim(img, printWithTime(text), 5.0); doLater(5.0, r { infoBox(dm_kevin("(just kidding)")) }); } } doLater(random(20.0, 30.0), r stopCam); } void stopCam enter { if (enabled) pcall { printWithTime("Stopping web cam"); dm_stopWebCam(); } startAgain(); } }