Uses 1796K of libraries. Click here for Pure Java version (9387L/49K).
1 | !7 |
2 | |
3 | cmodule LaughAboutJokes > DynPrintLogAndEnabled { |
4 | long historical, hysterical; |
5 | switchable double jokeTimeout = 20.0; |
6 | switchable int volume = 25; |
7 | |
8 | start { |
9 | ownResource(onActiveOrPassiveSpeechRecognized(s -> enter { |
10 | if (!enabled) ret; |
11 | print("Got line: " + s); |
12 | if (cic(s, "histor")) setField(historical := now()); |
13 | if (cic(s, "hyster")) setField(hysterical := now()); |
14 | if (recent(historical) && recent(hysterical) |
15 | || cicOneOf(s, "hysterical day", "hysterical reason", "hysterically grown")) { |
16 | infoBox("Hahaha historical/hysterical joke"); |
17 | laugh_gain = volume/100.0; |
18 | laugh(); |
19 | setFields(historical := 0, hysterical := 0); |
20 | } |
21 | })); |
22 | } |
23 | |
24 | bool recent(long timestamp) { |
25 | ret elapsedSeconds_now(timestamp) <= jokeTimeout; |
26 | } |
27 | } |
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1029139 |
Snippet name: | Laugh About User's Jokes [OK, knows a single joke] |
Eternal ID of this version: | #1029139/15 |
Text MD5: | a0f09cb7fe5d6cb9a55faea25b358769 |
Transpilation MD5: | 786642e79f00c95e9ac4c044274ba344 |
Author: | stefan |
Category: | javax / speech |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-07-22 18:37:00 |
Source code size: | 843 bytes / 27 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 212 / 3065 |
Version history: | 14 change(s) |
Referenced in: | [show references] |