Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

35
LINES

< > BotCompany Repo | #1019961 // Turn On Web Cam Randomly [OK]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (15723L/110K).

!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();
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019961
Snippet name: Turn On Web Cam Randomly [OK]
Eternal ID of this version: #1019961/22
Text MD5: 7176389860125cc834e83a3235b61268
Transpilation MD5: c64a91aa733eb2c322cf1ce755ed3f76
Author: stefan
Category: javax / automation
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-02 13:47:44
Source code size: 867 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 505 / 1512
Version history: 21 change(s)
Referenced in: #1019968 - doLater clean up test